changeset 3789:fb519383a058

[gaim-migrate @ 3929] IRC passwd patch from Chip. Fixed a compile warning in conversation.c. Nathan, tell me if this breaks anything ;-) committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Tue, 22 Oct 2002 23:31:49 +0000
parents 56e555b72873
children 12b29552f1d7
files ChangeLog src/conversation.c src/multi.c src/protocols/irc/irc.c src/prpl.h src/server.c
diffstat 6 files changed, 28 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Oct 22 23:18:45 2002 +0000
+++ b/ChangeLog	Tue Oct 22 23:31:49 2002 +0000
@@ -97,6 +97,7 @@
 	* Switch the .desktop file to the new KDE/GNOME common vfolder 
 	  format (Thanks Robert McQueen).
 	* Allow only people in buddy list privacy option added for AIM
+	* Optional password on IRC accounts (Thanks, Christian Hammond)
 
 version 0.59 (06/24/2002):
 	* Hungarian translation added (Thanks, Sutto Zoltan)
--- a/src/conversation.c	Tue Oct 22 23:18:45 2002 +0000
+++ b/src/conversation.c	Tue Oct 22 23:31:49 2002 +0000
@@ -2680,7 +2680,7 @@
 			style->fg[0].green = 0x9999;
 			style->fg[0].blue = 0x0000;
 		} else if(c->typing_state == TYPED) {
-			style->fg[0].red = 0xfffff;
+			style->fg[0].red = 0xffff;
 			style->fg[0].green = 0xbbbb;
 			style->fg[0].blue = 0x2222;
 		} else if(c->unseen == 2) {
--- a/src/multi.c	Tue Oct 22 23:18:45 2002 +0000
+++ b/src/multi.c	Tue Oct 22 23:31:49 2002 +0000
@@ -1066,7 +1066,8 @@
 	p = find_prpl(u->protocol);
 	if (!u->gc && p && p->login) {
 		struct prpl *p = find_prpl(u->protocol);
-		if (p && !(p->options & OPT_PROTO_NO_PASSWORD) && !u->password[0]) {
+		if (p && !(p->options & OPT_PROTO_NO_PASSWORD) &&
+			!(p->options & OPT_PROTO_PASSWORD_OPTIONAL) && !u->password[0]) {
 			do_pass_dlg(u);
 		} else {
 			serv_login(u);
--- a/src/protocols/irc/irc.c	Tue Oct 22 23:18:45 2002 +0000
+++ b/src/protocols/irc/irc.c	Tue Oct 22 23:31:49 2002 +0000
@@ -1669,6 +1669,17 @@
 	hostname[sizeof(hostname) - 1] = 0;
 	if (!*hostname)
 		g_snprintf(hostname, sizeof(hostname), "localhost");
+
+	if (*gc->user->password) {
+		g_snprintf(buf, sizeof(buf), "PASS %s\r\n", gc->user->password);
+
+		if (irc_write(idata->fd, buf, strlen(buf)) < 0) {
+			hide_login_progress(gc, "Write error");
+			signoff(gc);
+			return;
+		}
+	}
+
 	g_snprintf(buf, sizeof(buf), "USER %s %s %s :%s\r\n",
 		   g_get_user_name(), hostname, 
 		   gc->user->proto_opt[USEROPT_SERV], 
@@ -2670,7 +2681,7 @@
 {
 	struct proto_user_opt *puo;
 	ret->protocol = PROTO_IRC;
-	ret->options = OPT_PROTO_CHAT_TOPIC | OPT_PROTO_NO_PASSWORD;
+	ret->options = OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL;
 	ret->name = g_strdup("IRC");
 	ret->list_icon = irc_list_icon;
 	ret->login = irc_login;
--- a/src/prpl.h	Tue Oct 22 23:18:45 2002 +0000
+++ b/src/prpl.h	Tue Oct 22 23:31:49 2002 +0000
@@ -61,20 +61,22 @@
 /* #define OPT_PROTO_HTML            0x00000001 this should be per-connection */
 /* TOC/Oscar have signon time, and the server's time needs to be adjusted to match
  * your computer's time. We wouldn't need this if everyone used NTP. */
-#define OPT_PROTO_CORRECT_TIME    0x00000002
+#define OPT_PROTO_CORRECT_TIME      0x00000002
 /* Jabber lets you choose what name you want for chat. So it shouldn't be pulling
  * the alias for when you're in chat; it gets annoying. */
-#define OPT_PROTO_UNIQUE_CHATNAME 0x00000004
+#define OPT_PROTO_UNIQUE_CHATNAME   0x00000004
 /* IRC, Jabber let you have chat room topics */
-#define OPT_PROTO_CHAT_TOPIC      0x00000008
-/* IRC and Zephyr don't require passwords, so there's no need for a password prompt */
-#define OPT_PROTO_NO_PASSWORD     0x00000010
+#define OPT_PROTO_CHAT_TOPIC        0x00000008
+/* Zephyr doesn't require passwords, so there's no need for a password prompt */
+#define OPT_PROTO_NO_PASSWORD       0x00000010
 /* MSN and Yahoo notify you when you have new mail */
-#define OPT_PROTO_MAIL_CHECK      0x00000020
+#define OPT_PROTO_MAIL_CHECK        0x00000020
 /* Oscar and Jabber have buddy icons */
-#define OPT_PROTO_BUDDY_ICON      0x00000040
+#define OPT_PROTO_BUDDY_ICON        0x00000040
 /* Oscar lets you send images in direct IMs */
-#define OPT_PROTO_IM_IMAGE        0x00000080
+#define OPT_PROTO_IM_IMAGE          0x00000080
+/* Passwords in IRC are optional, and are needed for certain functionality. */
+#define OPT_PROTO_PASSWORD_OPTIONAL 0x00000100
 
 #define GAIM_AWAY_CUSTOM "Custom"
 
--- a/src/server.c	Tue Oct 22 23:18:45 2002 +0000
+++ b/src/server.c	Tue Oct 22 23:31:49 2002 +0000
@@ -60,7 +60,8 @@
 #endif
 
 	if (p->login) {
-		if (!strlen(user->password) && !(p->options & OPT_PROTO_NO_PASSWORD)) {
+		if (!strlen(user->password) && !(p->options & OPT_PROTO_NO_PASSWORD) &&
+			!(p->options & OPT_PROTO_PASSWORD_OPTIONAL)) {
 			do_error_dialog(_("Please enter your password"), NULL, GAIM_ERROR);
 			return;
 		}