Changeset f7ca587 for irc_send.c


Ignore:
Timestamp:
2010-07-29T18:18:54Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
1521a85
Parents:
2fe5eb9
Message:

Restore default_target setting, kill last_root_cmd variable and just use
the last_channel variable, like for any other user.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_send.c

    r2fe5eb9 rf7ca587  
    104104void irc_usermsg( irc_t *irc, char *format, ... )
    105105{
    106         irc_channel_t *ic;
    107         irc_user_t *iu;
     106        irc_channel_t *ic = NULL;
     107        irc_user_t *iu = irc->root;
    108108        char text[1024];
    109109        va_list params;
     110        char *dst;
    110111       
    111112        va_start( params, format );
     
    113114        va_end( params );
    114115       
    115         if( irc->last_root_cmd &&
    116             irc_channel_name_ok( irc->last_root_cmd ) &&
    117             ( ic = irc_channel_by_name( irc, irc->last_root_cmd ) ) &&
    118             ic->flags & IRC_CHANNEL_JOINED )
    119                 irc_send_msg( irc->root, "PRIVMSG", irc->last_root_cmd, text, NULL );
    120         else if( irc->last_root_cmd &&
    121                  ( iu = irc_user_by_name( irc, irc->last_root_cmd ) ) &&
    122                  iu->f == &irc_user_root_funcs )
    123                 irc_send_msg( iu, "PRIVMSG", irc->user->nick, text, NULL );
    124         else
    125         {
    126                 g_free( irc->last_root_cmd );
    127                 irc->last_root_cmd = NULL;
    128                
    129                 irc_send_msg( irc->root, "PRIVMSG", irc->user->nick, text, NULL );
    130         }
    131        
    132         /*return( irc_msgfrom( irc, u->nick, text ) );*/
     116        /* Too similar to bee_irc_user_msg()... */
     117        if( iu->last_channel )
     118        {
     119                if( iu->last_channel->flags & IRC_CHANNEL_JOINED )
     120                        ic = iu->last_channel;
     121                else if( irc->default_channel->flags & IRC_CHANNEL_JOINED )
     122                        ic = irc->default_channel;
     123        }
     124       
     125        if( ic )
     126                dst = ic->name;
     127        else
     128                dst = irc->user->nick;
     129       
     130        irc_send_msg( irc->root, "PRIVMSG", dst, text, NULL );
    133131}
    134132
Note: See TracChangeset for help on using the changeset viewer.