summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2013-05-11 02:00:32 +0200
committerBerke Viktor <bviktor@hexchat.org>2013-05-11 02:00:32 +0200
commita98b95923b4cfc2b05bc570036f810d127aa6e90 (patch)
treea3ce20ad97646c6be03f80b40fc7cf9ad08b2ad0 /src/common
parentcf3d1ebb8b9177f5284c4afdeb02cbe820105175 (diff)
Get rid of this unnecessary buffer
Diffstat (limited to 'src/common')
-rw-r--r--src/common/hexchat.h1
-rw-r--r--src/common/proto-irc.c18
-rw-r--r--src/common/servlist.c10
3 files changed, 16 insertions, 13 deletions
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);