From 1418579a815af27190b56ac3595ec8bae5b71647 Mon Sep 17 00:00:00 2001 From: Ritesh Khadgaray <khadgaray@gmail.com> Date: Wed, 13 Jan 2010 17:26:02 +0000 Subject: Bug 592491 - xchat-gnome crashed with SIGSEGV in handle_command( Probable fix. This should also fix rh bug 550662 - [abrt] crash detected in xchat-gnome-0.26.1-5.fc12 --- diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index f1ab1a8..a47f710 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -44,7 +44,7 @@ static void irc_login (server *serv, char *user, char *realname) { - if (serv->password[0]) + if (serv->password) tcp_sendf (serv, "PASS %s\r\n", serv->password); tcp_sendf (serv, @@ -87,7 +87,7 @@ irc_ns_ghost (server *serv, char *usname, char *pass) static void irc_join (server *serv, char *channel, char *key) { - if (key[0]) + if (key) tcp_sendf (serv, "JOIN %s %s\r\n", channel, key); else tcp_sendf (serv, "JOIN %s\r\n", channel); @@ -96,7 +96,7 @@ irc_join (server *serv, char *channel, char *key) static void irc_part (server *serv, char *channel, char *reason) { - if (reason[0]) + if (reason) tcp_sendf (serv, "PART %s :%s\r\n", channel, reason); else tcp_sendf (serv, "PART %s\r\n", channel); @@ -105,7 +105,7 @@ irc_part (server *serv, char *channel, char *reason) static void irc_quit (server *serv, char *reason) { - if (reason[0]) + if (reason) tcp_sendf (serv, "QUIT :%s\r\n", reason); else tcp_send_len (serv, "QUIT\r\n", 6); @@ -114,15 +114,16 @@ irc_quit (server *serv, char *reason) static void irc_set_back (server *serv) { - tcp_send_len (serv, "AWAY\r\n", 6); + tcp_send_len (serv, "BACK\r\n", 6); } static void irc_set_away (server *serv, char *reason) { - if (!reason[0]) - reason = " "; - tcp_sendf (serv, "AWAY :%s\r\n", reason); + if (reason) + tcp_sendf (serv, "AWAY :%s\r\n", reason); + else + tcp_send_len (serv, "AWAY", 6); } static void @@ -146,7 +147,7 @@ irc_cycle (server *serv, char *channel, char *key) static void irc_kick (server *serv, char *channel, char *nick, char *reason) { - if (reason[0]) + if (reason) tcp_sendf (serv, "KICK %s %s :%s\r\n", channel, nick, reason); else tcp_sendf (serv, "KICK %s %s\r\n", channel, nick); @@ -235,18 +236,16 @@ irc_notice (server *serv, char *channel, char *text) static void irc_topic (server *serv, char *channel, char *topic) { - if (!topic) - tcp_sendf (serv, "TOPIC %s :\r\n", channel); - else if (topic[0]) - tcp_sendf (serv, "TOPIC %s :%s\r\n", channel, topic); + if (topic) + tcp_sendf (serv, "TOPIC %s :%s\r\n", channel, topic); else - tcp_sendf (serv, "TOPIC %s\r\n", channel); + tcp_sendf (serv, "TOPIC %s :\r\n", channel); } static void irc_list_channels (server *serv, char *arg, int min_users) { - if (arg[0]) + if (arg) { tcp_sendf (serv, "LIST %s\r\n", arg); return; -- cgit v0.8.3.1