Changeset 92c8d41 for irc_im.c


Ignore:
Timestamp:
2010-06-26T21:26:41Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
e907683
Parents:
41d415b
Message:

Remember in which channel the user talked to someone and show responses in
that same channel.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_im.c

    r41d415b r92c8d41  
    3434{
    3535        irc_user_t *iu;
     36        irc_t *irc = (irc_t*) bee->ui_data;
    3637        char nick[MAX_NICK_LENGTH+1], *s;
    3738       
     
    3940        strcpy( nick, nick_get( bu->ic->acc, bu->handle ) );
    4041       
    41         bu->ui_data = iu = irc_user_new( (irc_t*) bee->ui_data, nick );
     42        bu->ui_data = iu = irc_user_new( irc, nick );
    4243        iu->bu = bu;
    4344       
     
    6364        }
    6465       
    65         if( set_getbool( &bee->set, "private" ) )
    66                 iu->flags |= IRC_USER_PRIVATE;
    67        
    6866        if( bu->flags & BEE_USER_LOCAL )
    6967        {
     
    7169               
    7270                if( strcmp( s, "add_private" ) == 0 )
    73                         iu->flags |= IRC_USER_PRIVATE;
     71                        iu->last_channel = NULL;
    7472                else if( strcmp( s, "add_channel" ) == 0 )
    75                         iu->flags &= ~IRC_USER_PRIVATE;
     73                        iu->last_channel = irc->default_channel;
    7674        }
    7775       
    7876        iu->f = &irc_user_im_funcs;
    79         //iu->last_typing_notice = 0;
    8077       
    8178        return TRUE;
     
    180177{
    181178        irc_t *irc = bee->ui_data;
    182         irc_channel_t *ic = irc->default_channel;
    183179        irc_user_t *iu = (irc_user_t *) bu->ui_data;
    184180        char *dst, *prefix = NULL;
     
    188184                ts = irc_format_timestamp( irc, sent_at );
    189185       
    190         if( iu->flags & IRC_USER_PRIVATE )
     186        if( iu->last_channel )
     187        {
     188                dst = iu->last_channel->name;
     189                prefix = g_strdup_printf( "%s%s%s", irc->user->nick, set_getstr( &bee->set, "to_char" ), ts ? : "" );
     190        }
     191        else
    191192        {
    192193                dst = irc->user->nick;
    193194                prefix = ts;
    194195                ts = NULL;
    195         }
    196         else
    197         {
    198                 dst = ic->name;
    199                 prefix = g_strdup_printf( "%s%s%s", irc->user->nick, set_getstr( &bee->set, "to_char" ), ts ? : "" );
    200196        }
    201197       
Note: See TracChangeset for help on using the changeset viewer.