Changeset d343eaa


Ignore:
Timestamp:
2010-05-08T12:37:49Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
9e27f18
Parents:
bfb99ee
Message:

Restored imcb_chat_name_hint().

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • irc_im.c

    rbfb99ee rd343eaa  
    338338}
    339339
     340static gboolean bee_irc_chat_name_hint( bee_t *bee, struct groupchat *c, const char *name )
     341{
     342        irc_t *irc = bee->ui_data;
     343        irc_channel_t *ic = c->ui_data;
     344        char stripped[MAX_NICK_LENGTH+1], *full_name;
     345       
     346        /* Don't rename a channel if the user's in it already. */
     347        if( ic->flags & IRC_CHANNEL_JOINED )
     348                return FALSE;
     349       
     350        strncpy( stripped, name, MAX_NICK_LENGTH );
     351        stripped[MAX_NICK_LENGTH] = '\0';
     352        nick_strip( stripped );
     353        if( set_getbool( &bee->set, "lcnicks" ) )
     354                nick_lc( stripped );
     355       
     356        full_name = g_strdup_printf( "&%s", stripped );
     357       
     358        if( stripped[0] && irc_channel_by_name( irc, full_name ) == NULL )
     359        {
     360                g_free( ic->name );
     361                ic->name = full_name;
     362        }
     363        else
     364        {
     365                g_free( full_name );
     366        }
     367       
     368        return TRUE;
     369}
     370
    340371/* IRC->IM */
    341372static gboolean bee_irc_channel_chat_privmsg( irc_channel_t *ic, const char *msg )
     
    362393static const struct irc_channel_funcs irc_channel_im_chat_funcs = {
    363394        bee_irc_channel_chat_privmsg,
    364         NULL,
     395        NULL, /* join */
    365396        bee_irc_channel_chat_part,
     397        NULL, /* topic */
    366398};
    367399
     
    407439        bee_irc_chat_add_user,
    408440        bee_irc_chat_remove_user,
     441        bee_irc_chat_name_hint,
    409442       
    410443        bee_irc_ft_in_start,
  • protocols/bee.h

    rbfb99ee rd343eaa  
    8585        gboolean (*chat_add_user)( bee_t *bee, struct groupchat *c, bee_user_t *bu );
    8686        gboolean (*chat_remove_user)( bee_t *bee, struct groupchat *c, bee_user_t *bu );
     87        gboolean (*chat_name_hint)( bee_t *bee, struct groupchat *c, const char *name );
    8788       
    8889        struct file_transfer* (*ft_in_start)( bee_t *bee, bee_user_t *bu, const char *file_name, size_t file_size );
  • protocols/bee_chat.c

    rbfb99ee rd343eaa  
    5252void imcb_chat_name_hint( struct groupchat *c, const char *name )
    5353{
    54 #if 0
    55         if( !c->joined )
    56         {
    57                 struct im_connection *ic = c->ic;
    58                 char stripped[MAX_NICK_LENGTH+1], *full_name;
    59                
    60                 strncpy( stripped, name, MAX_NICK_LENGTH );
    61                 stripped[MAX_NICK_LENGTH] = '\0';
    62                 nick_strip( stripped );
    63                 if( set_getbool( &ic->irc->set, "lcnicks" ) )
    64                         nick_lc( stripped );
    65                
    66                 full_name = g_strdup_printf( "&%s", stripped );
    67                
    68                 if( stripped[0] &&
    69                     nick_cmp( stripped, ic->irc->channel + 1 ) != 0 &&
    70                     irc_chat_by_channel( ic->irc, full_name ) == NULL )
    71                 {
    72                         g_free( c->channel );
    73                         c->channel = full_name;
    74                 }
    75                 else
    76                 {
    77                         g_free( full_name );
    78                 }
    79         }
    80 #endif
     54        bee_t *bee = c->ic->bee;
     55       
     56        if( bee->ui->chat_name_hint )
     57                bee->ui->chat_name_hint( bee, c, name );
    8158}
    8259
     
    225202}
    226203
    227 #if 0
    228 static int remove_chat_buddy_silent( struct groupchat *b, const char *handle )
    229 {
    230         GList *i;
    231        
    232         /* Find the handle in the room userlist and shoot it */
    233         i = b->in_room;
    234         while( i )
    235         {
    236                 if( g_strcasecmp( handle, i->data ) == 0 )
    237                 {
    238                         g_free( i->data );
    239                         b->in_room = g_list_remove( b->in_room, i->data );
    240                         return( 1 );
    241                 }
    242                
    243                 i = i->next;
    244         }
    245        
    246         return 0;
    247 }
    248 #endif
    249 
    250204int bee_chat_msg( bee_t *bee, struct groupchat *c, const char *msg, int flags )
    251205{
Note: See TracChangeset for help on using the changeset viewer.