Changeset e67e513 for irc_im.c


Ignore:
Timestamp:
2011-10-03T14:56:58Z (13 years ago)
Author:
unknown <pesco@…>
Branches:
master
Children:
409c2de
Parents:
3231485
Message:

rename irc_usermsg to irc_rootmsg.
add new irc_usermsg, irc_usernotice.
deliver user-specific messages from libotr as notices to that user.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_im.c

    r3231485 re67e513  
    193193}
    194194
    195 void bee_irc_msg_from_user( irc_user_t *iu, const char *msg, time_t sent_at )
    196 {
    197     irc_t *irc = iu->irc;
     195static void bee_irc_msg_from_user( irc_user_t *iu, const char *msg, time_t sent_at )
     196{
     197        irc_t *irc = iu->irc;
    198198        bee_t *bee = irc->b;
    199         irc_channel_t *ic = NULL;
    200         char *dst, *prefix = NULL;
     199        const char *dst;
     200        char *prefix = NULL;
    201201        char *wrapped, *ts = NULL;
    202202
     
    204204                ts = irc_format_timestamp( irc, sent_at );
    205205       
    206         /* Too similar to irc_usermsg()... */
    207         if( iu->last_channel )
    208         {
    209                 if( iu->last_channel->flags & IRC_CHANNEL_JOINED )
    210                         ic = iu->last_channel;
    211                 else
    212                         ic = irc_channel_with_user( irc, iu );
    213         }
    214        
    215         if( ic )
    216         {
    217                 dst = ic->name;
     206        dst = irc_user_msgdest(iu);
     207        if(dst != irc->user->nick) {
     208                /* if not messaging directly, call user by name */
    218209                prefix = g_strdup_printf( "%s%s%s", irc->user->nick, set_getstr( &bee->set, "to_char" ), ts ? : "" );
    219         }
    220         else
    221         {
    222                 dst = irc->user->nick;
     210        } else {
    223211                prefix = ts;
    224                 ts = NULL;
    225         }
    226        
     212                ts = NULL;      /* don't doulbe-free */
     213        }
     214
    227215        wrapped = word_wrap( msg, 425 );
    228216        irc_send_msg( iu, "PRIVMSG", dst, wrapped, prefix );
     
    1000988        else if( !acc->prpl->chat_join )
    1001989        {
    1002                 irc_usermsg( ic->irc, "Named chatrooms not supported on that account." );
     990                irc_rootmsg( ic->irc, "Named chatrooms not supported on that account." );
    1003991                return SET_INVALID;
    1004992        }
Note: See TracChangeset for help on using the changeset viewer.