Get rid of this unnecessary buffer

This commit is contained in:
Berke Viktor 2013-05-11 02:00:32 +02:00
parent cf3d1ebb8b
commit a98b95923b
3 changed files with 16 additions and 13 deletions

View File

@ -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;

View File

@ -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);
}

View File

@ -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);