From a98b95923b4cfc2b05bc570036f810d127aa6e90 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Sat, 11 May 2013 02:00:32 +0200 Subject: Get rid of this unnecessary buffer --- src/common/hexchat.h | 1 - src/common/proto-irc.c | 18 ++++++++++++++++-- src/common/servlist.c | 10 ---------- 3 files changed, 16 insertions(+), 13 deletions(-) (limited to 'src/common') diff --git a/src/common/hexchat.h b/src/common/hexchat.h index f3b9ce85..0a449bfa 100644 --- a/src/common/hexchat.h +++ b/src/common/hexchat.h @@ -527,7 +527,6 @@ typedef struct server char hostname[128]; /* real ip number */ char servername[128]; /* what the server says is its name */ char password[86]; - char sasluser[32]; /* this is just a buffer for network->user */ char nick[NICKLEN]; char linebuf[2048]; /* RFC says 512 chars including \r\n */ char *last_away_reason; diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index 53225a95..5ea2c75c 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -42,6 +42,7 @@ #include "util.h" #include "hexchatc.h" #include "url.h" +#include "servlist.h" static void @@ -1218,10 +1219,23 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[]) if (strstr (word_eol[5], "sasl") != 0) { serv->have_sasl = TRUE; - EMIT_SIGNAL (XP_TE_SASLAUTH, serv->server_session, sess->server->sasluser, NULL, NULL, NULL, 0); + EMIT_SIGNAL + ( + XP_TE_SASLAUTH, + serv->server_session, + (((ircnet *)sess->server->network)->user) ? (((ircnet *)sess->server->network)->user) : prefs.hex_irc_user_name, + NULL, + NULL, + NULL, + 0 + ); tcp_send_len (serv, "AUTHENTICATE PLAIN\r\n", 20); - pass = encode_sasl_pass (sess->server->sasluser, sess->server->password); + pass = encode_sasl_pass + ( + (((ircnet *)sess->server->network)->user) ? (((ircnet *)sess->server->network)->user) : prefs.hex_irc_user_name, + sess->server->password + ); tcp_sendf (sess->server, "AUTHENTICATE %s\r\n", pass); free (pass); } diff --git a/src/common/servlist.c b/src/common/servlist.c index d49b603e..9386bf16 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -628,22 +628,12 @@ servlist_connect (session *sess, ircnet *net, gboolean join) } serv->password[0] = 0; - serv->sasluser[0] = 0; if (net->pass) { safe_strcpy (serv->password, net->pass, sizeof (serv->password)); } - if (net->flags & FLAG_USE_GLOBAL || net->user == NULL) - { - strcpy (serv->sasluser, prefs.hex_irc_user_name); - } - else - { - safe_strcpy (serv->sasluser, net->user, sizeof (serv->sasluser)); - } - if (net->flags & FLAG_USE_GLOBAL) { strcpy (serv->nick, prefs.hex_irc_nick1); -- cgit 1.4.1