aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--irc.h1
-rw-r--r--irc_send.c13
-rw-r--r--irc_user.c7
3 files changed, 21 insertions, 0 deletions
diff --git a/irc.h b/irc.h
index 450d3259..8caf17fa 100644
--- a/irc.h
+++ b/irc.h
@@ -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 */
diff --git a/irc_send.c b/irc_send.c
index ce4c86fe..57d15ade 100644
--- a/irc_send.c
+++ b/irc_send.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",
diff --git a/irc_user.c b/irc_user.c
index cf1d1e3e..7b2d4be1 100644
--- a/irc_user.c
+++ b/irc_user.c
@@ -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;