changeset 10712:b41c48d890d8

[gaim-migrate @ 12306] sf patch #1153243, from Richard Laager Implement IRC Response #437, "Nick or channel is temporarily unavailable." committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 21 Mar 2005 03:37:59 +0000
parents 00483ba950bf
children 7d4ca0d36f25
files ChangeLog src/protocols/irc/irc.h src/protocols/irc/msgs.c src/protocols/irc/parse.c src/protocols/oscar/auth.c
diffstat 5 files changed, 27 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Mar 21 02:14:46 2005 +0000
+++ b/ChangeLog	Mon Mar 21 03:37:59 2005 +0000
@@ -28,6 +28,8 @@
 	* Log viewer aggregates logs from the same "Person," (contact, meta-
 	  contact, whatever) (Richard Laager)
 	* Message formatting persists between messages (Igor Belyi)
+	* Show an error message when temporarily unable to join an IRC channel
+	  or change your nick (Richard Laager)
 
 	Bug fixes:
 	* People using input methods can now use Enter again.
--- a/src/protocols/irc/irc.h	Mon Mar 21 02:14:46 2005 +0000
+++ b/src/protocols/irc/irc.h	Mon Mar 21 03:37:59 2005 +0000
@@ -133,6 +133,7 @@
 void irc_msg_quit(struct irc_conn *irc, const char *name, const char *from, char **args);
 void irc_msg_time(struct irc_conn *irc, const char *name, const char *from, char **args);
 void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, char **args);
+void irc_msg_unavailable(struct irc_conn *irc, const char *name, const char *from, char **args);
 void irc_msg_unknown(struct irc_conn *irc, const char *name, const char *from, char **args);
 void irc_msg_wallops(struct irc_conn *irc, const char *name, const char *from, char **args);
 void irc_msg_whois(struct irc_conn *irc, const char *name, const char *from, char **args);
--- a/src/protocols/irc/msgs.c	Mon Mar 21 02:14:46 2005 +0000
+++ b/src/protocols/irc/msgs.c	Mon Mar 21 03:37:59 2005 +0000
@@ -977,6 +977,16 @@
 	return;
 }
 
+void irc_msg_unavailable(struct irc_conn *irc, const char *name, const char *from, char **args)
+{
+	GaimConnection *gc = gaim_account_get_connection(irc->account);
+
+	if (!args || !args[1])
+		return;
+
+	gaim_notify_error(gc, NULL, _("Nick or channel is temporarily unavailable."), args[1]);
+}
+
 void irc_msg_wallops(struct irc_conn *irc, const char *name, const char *from, char **args)
 {
 	GaimConnection *gc = gaim_account_get_connection(irc->account);
--- a/src/protocols/irc/parse.c	Mon Mar 21 02:14:46 2005 +0000
+++ b/src/protocols/irc/parse.c	Mon Mar 21 03:37:59 2005 +0000
@@ -79,6 +79,7 @@
 	{ "422", "nv:", irc_msg_endmotd },	/* No MOTD available		*/
 	{ "432", "vn:", irc_msg_badnick },	/* Erroneous nickname		*/
 	{ "433", "vn:", irc_msg_nickused },	/* Nickname already in use	*/
+	{ "437", "nc:", irc_msg_unavailable },  /* Nick/channel is unavailable */
 	{ "438", "nn:", irc_msg_nochangenick },	/* Nick may not change		*/
 	{ "442", "nc:", irc_msg_notinchan },	/* Not in channel		*/
 	{ "473", "nc:", irc_msg_inviteonly },	/* Tried to join invite-only	*/
--- a/src/protocols/oscar/auth.c	Mon Mar 21 02:14:46 2005 +0000
+++ b/src/protocols/oscar/auth.c	Mon Mar 21 03:37:59 2005 +0000
@@ -236,7 +236,19 @@
 
 	aim_tlvlist_add_raw(&tl, 0x0001, strlen(sn), sn);
 
-	aim_encode_password_md5(password, key, digest);
+	/* Truncate ICQ passwords, if necessary */
+	if (isdigit(sn[0]) && (strlen(password) > MAXICQPASSLEN))
+	{
+		char truncated[MAXICQPASSLEN + 1];
+		strncpy(truncated, password, MAXICQPASSLEN);
+		truncated[MAXICQPASSLEN] = 0;
+		aim_encode_password_md5(truncated, key, digest);
+	}
+	else
+	{
+		aim_encode_password_md5(password, key, digest);
+	}
+
 	aim_tlvlist_add_raw(&tl, 0x0025, 16, digest);
 
 #ifndef USE_OLD_MD5