diff options
| -rw-r--r-- | irc.h | 1 | ||||
| -rw-r--r-- | irc_send.c | 13 | ||||
| -rw-r--r-- | irc_user.c | 7 | 
3 files changed, 21 insertions, 0 deletions
| @@ -200,6 +200,7 @@ void irc_send_whois( irc_user_t *iu );  void irc_send_who( irc_t *irc, GSList *l, const char *channel );  void irc_send_msg( irc_user_t *iu, const char *type, const char *dst, const char *msg, const char *prefix );  void irc_send_msg_raw( irc_user_t *iu, const char *type, const char *dst, const char *msg ); +void irc_send_msg_f( irc_user_t *iu, const char *type, const char *dst, const char *format, ... ) G_GNUC_PRINTF( 4, 5 );  void irc_send_nick( irc_user_t *iu, const char *new );  /* irc_user.c */ @@ -302,6 +302,19 @@ void irc_send_msg_raw( irc_user_t *iu, const char *type, const char *dst, const  	           iu->nick, iu->user, iu->host, type, dst, msg );  } +void irc_send_msg_f( irc_user_t *iu, const char *type, const char *dst, const char *format, ... ) +{ +	char text[IRC_MAX_LINE]; +	va_list params; +	 +	va_start( params, format ); +	g_vsnprintf( text, IRC_MAX_LINE, format, params ); +	va_end( params ); +	 +	irc_write( iu->irc, ":%s!%s@%s %s %s :%s", +	           iu->nick, iu->user, iu->host, type, dst, text ); +} +  void irc_send_nick( irc_user_t *iu, const char *new )  {  	irc_write( iu->irc, ":%s!%s@%s NICK %s", @@ -150,6 +150,13 @@ static gboolean root_ctcp( irc_user_t *iu, char * const *ctcp )  {  	if( g_strcasecmp( ctcp[0], "VERSION" ) == 0 )  	{ +		irc_send_msg_f( iu, "NOTICE", iu->irc->user->nick, "\001%s %s\001", +		                ctcp[0], "BitlBee " BITLBEE_VERSION " " ARCH "/" CPU ); +	} +	else if( g_strcasecmp( ctcp[0], "PING" ) == 0 ) +	{ +		irc_send_msg_f( iu, "NOTICE", iu->irc->user->nick, "\001%s %s\001", +		                ctcp[0], ctcp[1] ? : "" );  	}  	return TRUE; | 
