changeset 2303:f5bf315e6104

[gaim-migrate @ 2313] hi committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 17 Sep 2001 23:25:10 +0000
parents 722a912562a0
children 15fb364935ec
files src/conversation.c src/protocols/icq/gaim_icq.c src/protocols/irc/irc.c src/protocols/jabber/jabber.c src/protocols/msn/msn.c src/protocols/napster/napster.c src/protocols/oscar/oscar.c src/protocols/toc/toc.c src/protocols/yahoo/yay.c src/protocols/zephyr/zephyr.c
diffstat 10 files changed, 38 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Mon Sep 17 23:06:22 2001 +0000
+++ b/src/conversation.c	Mon Sep 17 23:25:10 2001 +0000
@@ -874,7 +874,7 @@
 		}
 
 
-		if (err >= 0) {
+		if (err > 0) {
 			write_to_conv(c, buf, WFLAG_SEND, NULL, time((time_t)NULL));
 
 			if (c->makesound && (sound_options & OPT_SOUND_SEND))
--- a/src/protocols/icq/gaim_icq.c	Mon Sep 17 23:06:22 2001 +0000
+++ b/src/protocols/icq/gaim_icq.c	Mon Sep 17 23:25:10 2001 +0000
@@ -334,7 +334,7 @@
 		icq_SendMessage(id->link, w, msg,
 				(flags & IM_FLAG_CHECKBOX) ? ICQ_SEND_THRUSERVER : ICQ_SEND_BESTWAY);
 	}
-	return 0;
+	return 1;
 }
 
 static void icq_keepalive(struct gaim_connection *gc) {
--- a/src/protocols/irc/irc.c	Mon Sep 17 23:06:22 2001 +0000
+++ b/src/protocols/irc/irc.c	Mon Sep 17 23:25:10 2001 +0000
@@ -1078,7 +1078,7 @@
 	}
 }
 
-static void handle_command(struct gaim_connection *gc, char *who, char *what)
+static int handle_command(struct gaim_connection *gc, char *who, char *what)
 {
 	char buf[IRC_BUF_LEN];
 	char pdibuf[IRC_BUF_LEN];
@@ -1097,7 +1097,7 @@
 		}
 		g_snprintf(buf, sizeof(buf), "PRIVMSG %s :%s\r\n", who, what);
 		irc_write(id->fd, buf, strlen(buf));
-		return;
+		return 1;
 	}
 
 	what++;
@@ -1108,12 +1108,12 @@
 		irc_write(id->fd, buf, strlen(buf));
 	} else if (!g_strcasecmp(pdibuf, "TOPIC")) {
 		if (!*word_eol[2])
-			return;
+			return -EINVAL;
 		g_snprintf(buf, sizeof(buf), "TOPIC %s :%s\r\n", who, word_eol[2]);
 		irc_write(id->fd, buf, strlen(buf));
 	} else if (!g_strcasecmp(pdibuf, "NICK")) {
 		if (!*word_eol[2])
-			return;
+			return -EINVAL;
 		g_snprintf(buf, sizeof(buf), "NICK %s\r\n", word_eol[2]);
 		irc_write(id->fd, buf, strlen(buf));
 	} else if (!g_strcasecmp(pdibuf, "OP")) {
@@ -1126,24 +1126,24 @@
 		set_mode(gc, who, '-', 'v', word);
 	} else if (!g_strcasecmp(pdibuf, "QUOTE")) {
 		if (!*word_eol[2])
-			return;
+			return -EINVAL;
 		g_snprintf(buf, sizeof(buf), "%s\r\n", word_eol[2]);
 		irc_write(id->fd, buf, strlen(buf));
 	} else if (!g_strcasecmp(pdibuf, "SAY")) {
 		if (!*word_eol[2])
-			return;
+			return -EINVAL;
 		g_snprintf(buf, sizeof(buf), "PRIVMSG %s :%s\r\n", who, word_eol[2]);
 		irc_write(id->fd, buf, strlen(buf));
 	} else if (!g_strcasecmp(pdibuf, "MSG")) {
 		if (!*word[2])
-			return;
+			return -EINVAL;
 		if (!*word_eol[3])
-			return;
+			return -EINVAL;
 		g_snprintf(buf, sizeof(buf), "PRIVMSG %s :%s\r\n", word[2], word_eol[3]);
 		irc_write(id->fd, buf, strlen(buf));
 	} else if (!g_strcasecmp(pdibuf, "KICK")) {
 		if (!*word[2])
-			return;
+			return -EINVAL;
 		if (*word_eol[3])
 			g_snprintf(buf, sizeof(buf), "KICK %s %s :%s\r\n", who, word[2], word_eol[3]);
 		else
@@ -1153,7 +1153,7 @@
 	} else if (!g_strcasecmp(pdibuf, "KICKBAN")) {
 	} else if (!g_strcasecmp(pdibuf, "JOIN")) {
 		if (!*word[2])
-			return;
+			return -EINVAL;
 		if (*word[3])
 			g_snprintf(buf, sizeof(buf), "JOIN %s %s\r\n", word[2], word[3]);
 		else
@@ -1164,7 +1164,7 @@
 		char *reason = word_eol[3];
 		struct conversation *c;
 		if (!is_channel(gc, chan))
-			return;
+			return -EINVAL;
 		c = irc_find_chat(gc, chan);
 		g_snprintf(buf, sizeof(buf), "PART %s%s%s\r\n", chan,
 				*reason ? " :" : "",
@@ -1184,23 +1184,25 @@
 			c = find_conversation(who);
 		}
 		if (!c)
-			return;
+			return -EINVAL;
 		write_to_conv(c, "<B>Currently supported commands:<BR>"
 				 "JOIN PART TOPIC<BR>"
 				 "OP DEOP VOICE DEVOICE KICK<BR>"
 				 "NICK ME MSG QUOTE SAY</B><BR>",
 				 WFLAG_SYSTEM, NULL, time(NULL));
 	}
+	return 0;
 }
 
-static void send_msg(struct gaim_connection *gc, char *who, char *what)
+static int send_msg(struct gaim_connection *gc, char *who, char *what)
 {
 	char *cr = strchr(what, '\n');
 	if (cr) {
+		int ret = 0;
 		while (TRUE) {
 			if (cr)
 				*cr = 0;
-			handle_command(gc, who, what);
+			ret = handle_command(gc, who, what);
 			if (!cr)
 				break;
 			what = cr + 1;
@@ -1209,17 +1211,16 @@
 			*cr = '\n';
 			cr = strchr(what, '\n');
 		}
+		return ret;
 	} else
-		handle_command(gc, who, what);
+		return handle_command(gc, who, what);
 }
 
 static int irc_send_im(struct gaim_connection *gc, char *who, char *what, int flags)
 {
 	if (*who == '@' || *who == '+')
-		send_msg(gc, who + 1, what);
-	else
-		send_msg(gc, who, what);
-	return 0;
+		return send_msg(gc, who + 1, what);
+	return send_msg(gc, who, what);
 }
 
 /* IRC doesn't have a buddy list, but we can still figure out who's online with ISON */
@@ -1275,8 +1276,8 @@
 	struct conversation *c = irc_find_chat_by_id(gc, id);
 	if (!c)
 		return -EINVAL;
-	send_msg(gc, c->name, what);
-	serv_got_chat_in(gc, c->id, gc->displayname, 0, what, time(NULL));
+	if (send_msg(gc, c->name, what) > 0)
+		serv_got_chat_in(gc, c->id, gc->displayname, 0, what, time(NULL));
 	return 0;
 }
 
--- a/src/protocols/jabber/jabber.c	Mon Sep 17 23:06:22 2001 +0000
+++ b/src/protocols/jabber/jabber.c	Mon Sep 17 23:25:10 2001 +0000
@@ -1254,7 +1254,7 @@
 
 	gjab_send(((struct jabber_data *)gc->proto_data)->jc, x);
 	xmlnode_free(x);
-	return 0;
+	return 1;
 }
 
 static void jabber_add_buddy(struct gaim_connection *gc, char *name)
--- a/src/protocols/msn/msn.c	Mon Sep 17 23:06:22 2001 +0000
+++ b/src/protocols/msn/msn.c	Mon Sep 17 23:25:10 2001 +0000
@@ -1202,7 +1202,7 @@
 		if (msn_write(md->fd, buf, strlen(buf)) < 0) {
 			hide_login_progress(gc, "Write error");
 			signoff(gc);
-			return 0;
+			return 1;
 		}
 
 		ms = g_new0(struct msn_switchboard, 1);
@@ -1214,7 +1214,7 @@
 	} else
 		/* in msn you can't send messages to yourself, so we'll fake like we received it ;) */
 		serv_got_im(gc, who, message, flags | IM_FLAG_GAIMUSER, time(NULL));
-	return 0;
+	return 1;
 }
 
 static int msn_chat_send(struct gaim_connection *gc, int id, char *message)
--- a/src/protocols/napster/napster.c	Mon Sep 17 23:06:22 2001 +0000
+++ b/src/protocols/napster/napster.c	Mon Sep 17 23:25:10 2001 +0000
@@ -84,7 +84,7 @@
 	g_snprintf(buf, NAP_BUF_LEN, "%s %s", who, message);
 	nap_write_packet(gc, 0xCD, buf);
 
-	return 0;
+	return 1;
 }
 
 static struct nap_channel *find_channel_by_name(struct gaim_connection *gc, char *name)
--- a/src/protocols/oscar/oscar.c	Mon Sep 17 23:06:22 2001 +0000
+++ b/src/protocols/oscar/oscar.c	Mon Sep 17 23:25:10 2001 +0000
@@ -2073,11 +2073,12 @@
 static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, int imflags) {
 	struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
 	struct direct_im *dim = find_direct_im(odata, name);
+	int ret = 0;
 	if (dim) {
-		return aim_send_im_direct(odata->sess, dim->conn, message);
+		ret = aim_send_im_direct(odata->sess, dim->conn, message);
 	} else {
 		if (imflags & IM_FLAG_AWAY)
-			return aim_send_im(odata->sess, odata->conn, name, AIM_IMFLAGS_AWAY, message);
+			ret = aim_send_im(odata->sess, odata->conn, name, AIM_IMFLAGS_AWAY, message);
 		else {
 			struct aim_sendimext_args args;
 			GSList *h = odata->hasicons;
@@ -2123,9 +2124,12 @@
 			args.msg    = message;
 			args.msglen = strlen(message);
 
-			return aim_send_im_ext(odata->sess, odata->conn, &args);
+			ret = aim_send_im_ext(odata->sess, odata->conn, &args);
 		}
 	}
+	if (ret >= 0)
+		return 1;
+	return ret;
 }
 
 static void oscar_get_info(struct gaim_connection *g, char *name) {
--- a/src/protocols/toc/toc.c	Mon Sep 17 23:06:22 2001 +0000
+++ b/src/protocols/toc/toc.c	Mon Sep 17 23:25:10 2001 +0000
@@ -755,7 +755,7 @@
 	sflap_send(gc, buf, -1, TYPE_DATA);
 	
 	g_free(tmp);
-	return 0;
+	return 1;
 }
 
 static void toc_set_config(struct gaim_connection *gc)
--- a/src/protocols/yahoo/yay.c	Mon Sep 17 23:06:22 2001 +0000
+++ b/src/protocols/yahoo/yay.c	Mon Sep 17 23:25:10 2001 +0000
@@ -402,7 +402,7 @@
 		yahoo_send_message(yd->sess, yd->active_id, who, message);
 	else
 		yahoo_send_message_offline(yd->sess, yd->active_id, who, message);
-	return 0;
+	return 1;
 }
 
 static void yahoo_set_away(struct gaim_connection *gc, char *state, char *msg) {
--- a/src/protocols/zephyr/zephyr.c	Mon Sep 17 23:06:22 2001 +0000
+++ b/src/protocols/zephyr/zephyr.c	Mon Sep 17 23:25:10 2001 +0000
@@ -751,7 +751,7 @@
 	notice.z_message = buf;
 	ZSendNotice(&notice, ZAUTH);
 	g_free(buf);
-	return 0;
+	return 1;
 }
 
 static char *zephyr_normalize(const char *orig)