Changeset 7b59872


Ignore:
Timestamp:
2010-04-13T00:04:55Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
3a9b123
Parents:
89c11e7
Message:

Support for simple VERSION/PING CTCPs to root.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • irc.h

    r89c11e7 r7b59872  
    201201void irc_send_msg( irc_user_t *iu, const char *type, const char *dst, const char *msg, const char *prefix );
    202202void irc_send_msg_raw( irc_user_t *iu, const char *type, const char *dst, const char *msg );
     203void irc_send_msg_f( irc_user_t *iu, const char *type, const char *dst, const char *format, ... ) G_GNUC_PRINTF( 4, 5 );
    203204void irc_send_nick( irc_user_t *iu, const char *new );
    204205
  • irc_send.c

    r89c11e7 r7b59872  
    303303}
    304304
     305void irc_send_msg_f( irc_user_t *iu, const char *type, const char *dst, const char *format, ... )
     306{
     307        char text[IRC_MAX_LINE];
     308        va_list params;
     309       
     310        va_start( params, format );
     311        g_vsnprintf( text, IRC_MAX_LINE, format, params );
     312        va_end( params );
     313       
     314        irc_write( iu->irc, ":%s!%s@%s %s %s :%s",
     315                   iu->nick, iu->user, iu->host, type, dst, text );
     316}
     317
    305318void irc_send_nick( irc_user_t *iu, const char *new )
    306319{
  • irc_user.c

    r89c11e7 r7b59872  
    151151        if( g_strcasecmp( ctcp[0], "VERSION" ) == 0 )
    152152        {
     153                irc_send_msg_f( iu, "NOTICE", iu->irc->user->nick, "\001%s %s\001",
     154                                ctcp[0], "BitlBee " BITLBEE_VERSION " " ARCH "/" CPU );
     155        }
     156        else if( g_strcasecmp( ctcp[0], "PING" ) == 0 )
     157        {
     158                irc_send_msg_f( iu, "NOTICE", iu->irc->user->nick, "\001%s %s\001",
     159                                ctcp[0], ctcp[1] ? : "" );
    153160        }
    154161       
Note: See TracChangeset for help on using the changeset viewer.