From 58adceb4e9819284cd6b95b7d6ab3b99741fc24f Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Sat, 3 Nov 2012 04:45:32 +0100 Subject: [PATCH] Provide text events for SASL auth, SASL responses and server capabilities --- src/common/proto-irc.c | 6 +++--- src/common/text.c | 16 ++++++++++++++++ src/common/textevents.in | 18 ++++++++++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index 6a3ee30e..2b83e992 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -886,8 +886,8 @@ process_numeric (session * sess, int n, case 905: /* failed SASL auth */ case 906: /* registration completes before SASL auth */ case 907: /* attempting to re-auth after a successful auth */ + EMIT_SIGNAL (XP_TE_SASLRESPONSE, serv->server_session, word[1], word[2], word[3], ++word_eol[4], 0); tcp_send_len (serv, "CAP END\r\n", 9); - PrintTextf (sess, "%s\n", ++word_eol[4]); break; default: @@ -1145,7 +1145,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[]) if (strncasecmp (word[5][0]==':' ? word[5] + 1 : word[5], "sasl", 12) == 0) { serv->have_sasl = TRUE; - PrintTextf (sess, "Authenticating via SASL as %s\n", sess->server->sasluser); + EMIT_SIGNAL (XP_TE_SASLAUTH, serv->server_session, sess->server->sasluser, NULL, NULL, NULL, 0); tcp_send_len (serv, "AUTHENTICATE PLAIN\r\n", 20); pass = encode_sasl_pass (sess->server->sasluser, sess->server->saslpassword); @@ -1155,7 +1155,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[]) } else if (strncasecmp (word[4], "LS", 2) == 0) { - PrintTextf (sess, "Capabilities supported by the server: %s\n", ++word_eol[5]); + EMIT_SIGNAL (XP_TE_SERVERCAP, serv->server_session, word[1], ++word_eol[5], NULL, NULL, 0); if (strstr (word_eol[5], "identify-msg") != 0) { tcp_send_len (serv, "CAP REQ :identify-msg\r\n", 23); diff --git a/src/common/text.c b/src/common/text.c index 01c59704..2e6cb86a 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -1411,6 +1411,22 @@ static char * const pevt_generic_channel_help[] = { N_("Channel Name"), }; +static char * const pevt_saslauth_help[] = { + N_("Username") +}; + +static char * const pevt_saslresponse_help[] = { + N_("Server Name"), + N_("Raw Numeric or Identifier"), + N_("Username"), + N_("Message") +}; + +static char * const pevt_servercap_help[] = { + N_("Server Name"), + N_("Server Capabilities") +}; + static char * const pevt_servertext_help[] = { N_("Text"), N_("Server Name"), diff --git a/src/common/textevents.in b/src/common/textevents.in index d6b8fbf9..04550596 100644 --- a/src/common/textevents.in +++ b/src/common/textevents.in @@ -646,6 +646,24 @@ pevt_resolvinguser_help %C24*%O$tLooking up IP number for %C18$1%O... 2 +SASL Authenticating +XP_TE_SASLAUTH +pevt_saslauth_help +%C23*%O$tAuthenticating via SASL as %C29$1%O +1 + +SASL Response +XP_TE_SASLRESPONSE +pevt_saslresponse_help +%C29*%O$t$4 +n4 + +Server Capabilities +XP_TE_SERVERCAP +pevt_servercap_help +%C23*%O$tCapabilities supported by the server: %C29$2%O +2 + Server Connected XP_TE_SERVERCONNECTED pevt_generic_none_help