Changeset f5c0d8e for irc_im.c


Ignore:
Timestamp:
2010-08-31T20:06:14Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
0c85c08
Parents:
8358691 (diff), 31dbb90a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_im.c

    r8358691 rf5c0d8e  
    252252{
    253253        irc_user_t *iu = (irc_user_t *) bu->ui_data;
    254         irc_t *irc = (irc_t *) bee->ui_data;
    255254        char *s;
    256255       
     
    266265        if( ( bu->ic->flags & OPT_LOGGED_IN ) && set_getbool( &bee->set, "display_namechanges" ) )
    267266        {
     267                /* People don't like this /NOTICE. Meh, let's go back to the old one.
    268268                char *msg = g_strdup_printf( "<< \002BitlBee\002 - Changed name to `%s' >>", iu->fullname );
    269269                irc_send_msg( iu, "NOTICE", irc->user->nick, msg, NULL );
     270                */
     271                imcb_log( bu->ic, "User `%s' changed name to `%s'", iu->nick, iu->fullname );
    270272        }
    271273       
     
    613615}
    614616
     617static gboolean bee_irc_chat_invite( bee_t *bee, bee_user_t *bu, const char *name, const char *msg )
     618{
     619        char *channel, *s;
     620        irc_t *irc = bee->ui_data;
     621        irc_user_t *iu = bu->ui_data;
     622        irc_channel_t *chan;
     623       
     624        if( strchr( CTYPES, name[0] ) )
     625                channel = g_strdup( name );
     626        else
     627                channel = g_strdup_printf( "#%s", name );
     628       
     629        if( ( s = strchr( channel, '@' ) ) )
     630                *s = '\0';
     631       
     632        if( strlen( channel ) > MAX_NICK_LENGTH )
     633        {
     634                /* If the channel name is very long (like those insane GTalk
     635                   UUID names), try if we can use the inviter's nick. */
     636                s = g_strdup_printf( "#%s", iu->nick );
     637                if( irc_channel_by_name( irc, s ) == NULL )
     638                {
     639                        g_free( channel );
     640                        channel = s;
     641                }
     642        }
     643       
     644        if( ( chan = irc_channel_new( irc, channel ) ) &&
     645            set_setstr( &chan->set, "type", "chat" ) &&
     646            set_setstr( &chan->set, "chat_type", "room" ) &&
     647            set_setstr( &chan->set, "account", bu->ic->acc->tag ) &&
     648            set_setstr( &chan->set, "room", (char*) name ) )
     649        {
     650                /* I'm assuming that if the user didn't "chat add" the room
     651                   himself but got invited, it's temporary, so make this a
     652                   temporary mapping that is removed as soon as we /PART. */
     653                chan->flags |= IRC_CHANNEL_TEMP;
     654        }
     655        else
     656        {
     657                irc_channel_free( chan );
     658                chan = NULL;
     659        }
     660        g_free( channel );
     661       
     662        irc_send_msg_f( iu, "PRIVMSG", irc->user->nick, "<< \002BitlBee\002 - Invitation to chatroom %s >>", name );
     663        if( msg )
     664                irc_send_msg( iu, "PRIVMSG", irc->user->nick, msg, NULL );
     665        if( chan )
     666        {
     667                irc_send_msg_f( iu, "PRIVMSG", irc->user->nick, "To join the room, just /join %s", chan->name );
     668                irc_send_invite( iu, chan );
     669        }
     670       
     671        return TRUE;
     672}
     673
    615674/* IRC->IM */
    616675static gboolean bee_irc_channel_chat_privmsg_cb( gpointer data, gint fd, b_input_condition cond );
     
    909968        bee_irc_chat_topic,
    910969        bee_irc_chat_name_hint,
     970        bee_irc_chat_invite,
    911971       
    912972        bee_irc_ft_in_start,
Note: See TracChangeset for help on using the changeset viewer.