changeset 2231:8c4ff1a368bd

[gaim-migrate @ 2241] blue:~/gaim/app/src/protocols $ ./gtk icq: 0 irc: 0 jabber: 52 msn: 0 napster: 0 oscar: 7 toc: 17 yahoo: 0 zephyr: 1 committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 07 Sep 2001 08:09:22 +0000
parents cfc9abe45db2
children 14e8978f86bb
files src/conversation.c src/gaim.h src/perl.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 src/prpl.h src/server.c
diffstat 14 files changed, 75 insertions(+), 170 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Fri Sep 07 07:30:28 2001 +0000
+++ b/src/conversation.c	Fri Sep 07 08:09:22 2001 +0000
@@ -78,6 +78,9 @@
 static void update_icon(struct conversation *);
 static void remove_icon(struct conversation *);
 
+static void update_checkbox(struct conversation *);
+static void remove_checkbox(struct conversation *);
+
 /*------------------------------------------------------------------------*/
 /*  Helpers                                                               */
 /*------------------------------------------------------------------------*/
@@ -157,9 +160,8 @@
 	c->history = g_string_new("");
 	conversations = g_list_append(conversations, c);
 	show_conv(c);
-	if (c->gc && c->gc->prpl && c->gc->prpl->insert_convo)
-		(*c->gc->prpl->insert_convo)(c->gc, c);
 	update_icon(c);
+	update_checkbox(c);
 	plugin_event(event_new_conversation, name, 0, 0, 0);
 	return c;
 }
@@ -413,9 +415,8 @@
 		gtkspell_detach(GTK_TEXT(c->entry));
 
 	if (!c->is_chat) {
-		if (c->gc && c->gc->prpl && c->gc->prpl->remove_convo)
-			(*c->gc->prpl->remove_convo)(c->gc, c);
 		remove_icon(c);
+		remove_checkbox(c);
 		if (display_options & OPT_DISP_ONE_WINDOW) {
 			if (g_list_length(conversations) > 1) {
 				gtk_notebook_remove_page(GTK_NOTEBOOK(convo_notebook),
@@ -858,7 +859,10 @@
 		buffy = g_strdup(buf);
 		plugin_event(event_im_displayed_sent, c->gc, c->name, &buffy, 0);
 		if (buffy) {
-			err = serv_send_im(c->gc, c->name, buffy, 0);
+			int imflags = 0;
+			if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->check)))
+				imflags = IM_FLAG_CHECKBOX;
+			err = serv_send_im(c->gc, c->name, buffy, imflags);
 			g_free(buffy);
 		}
 
@@ -1783,16 +1787,12 @@
 	if (cnv->gc == c)
 		return;
 
-	if (cnv->gc && cnv->gc->prpl && cnv->gc->prpl->remove_convo)
-		(*cnv->gc->prpl->remove_convo)(cnv->gc, cnv);
-
 	cnv->gc = c;
 
 	update_buttons_by_protocol(cnv);
 
-	if (cnv->gc && cnv->gc->prpl && cnv->gc->prpl->insert_convo)
-		(*cnv->gc->prpl->insert_convo)(cnv->gc, cnv);
 	update_icon(cnv);
+	update_checkbox(cnv);
 }
 
 void update_convo_add_button(struct conversation *c)
@@ -1898,9 +1898,8 @@
 		C = (struct conversation *)c->data;
 		c = c->next;
 
-		if (C->gc && C->gc->prpl && C->gc->prpl->remove_convo)
-			(*C->gc->prpl->remove_convo)(C->gc, C);
 		remove_icon(C);
+		remove_checkbox(C);
 	}
 }
 
@@ -1909,9 +1908,6 @@
 	if (c->gc == gc)
 		return;
 
-	if (c->gc && g_slist_find(connections, c->gc) && c->gc->prpl && c->gc->prpl->remove_convo)
-		(*c->gc->prpl->remove_convo)(c->gc, c);
-
 	c->gc = gc;
 
 	if (gc)
@@ -1919,9 +1915,8 @@
 
 	update_buttons_by_protocol(c);
 
-	if (c->gc && c->gc->prpl && c->gc->prpl->insert_convo)
-		(*c->gc->prpl->insert_convo)(c->gc, c);
 	update_icon(c);
+	update_checkbox(c);
 }
 
 void update_buttons_by_protocol(struct conversation *c)
@@ -2344,17 +2339,15 @@
 
 			imhtml = c->text;
 			win = c->window;
-			if (c->gc && c->gc->prpl->remove_convo)
-				(*c->gc->prpl->remove_convo)(c->gc, c);
 			remove_icon(c);
+			remove_checkbox(c);
 			show_conv(c);
 			gtk_widget_destroy(c->text);
 			gtk_widget_reparent(imhtml, c->sw);
 			c->text = imhtml;
 			gtk_widget_destroy(win);
-			if (c->gc && c->gc->prpl->insert_convo)
-				(*c->gc->prpl->insert_convo)(c->gc, c);
 			update_icon(c);
+			update_checkbox(c);
 
 			x = x->next;
 		}
@@ -2367,16 +2360,14 @@
 			GtkWidget *imhtml;
 
 			imhtml = c->text;
-			if (c->gc && c->gc->prpl->remove_convo)
-				(*c->gc->prpl->remove_convo)(c->gc, c);
 			remove_icon(c);
+			remove_checkbox(c);
 			show_conv(c);
 			gtk_widget_destroy(c->text);
 			gtk_widget_reparent(imhtml, c->sw);
 			c->text = imhtml;
-			if (c->gc && c->gc->prpl->insert_convo)
-				(*c->gc->prpl->insert_convo)(c->gc, c);
 			update_icon(c);
+			update_checkbox(c);
 
 			x = x->next;
 		}
@@ -2602,11 +2593,11 @@
 	if (!c)
 		return;
 
+	remove_icon(c);
+
 	if (!c->gc)
 		return;
 
-	remove_icon(c);
-
 	data = get_icon_data(c->gc, normalize(c->name), &len);
 	if (!data)
 		return;
@@ -2661,3 +2652,28 @@
 	if (c->gc == gc)
 		update_icon(c);
 }
+
+static void remove_checkbox(struct conversation *c)
+{
+	if (c->check)
+		gtk_container_remove(GTK_CONTAINER(c->lbox), c->check);
+	c->check = NULL;
+}
+
+static void update_checkbox(struct conversation *c)
+{
+	if (!c)
+		return;
+
+	remove_checkbox(c);
+
+	if (!c->gc)
+		return;
+
+	if (!c->gc->prpl->checkbox)
+		return;
+
+	c->check = gtk_check_button_new_with_label(c->gc->prpl->checkbox);
+	gtk_box_pack_start(GTK_BOX(c->lbox), c->check, FALSE, FALSE, 5);
+	gtk_widget_show(c->check);
+}
--- a/src/gaim.h	Fri Sep 07 07:30:28 2001 +0000
+++ b/src/gaim.h	Fri Sep 07 08:09:22 2001 +0000
@@ -372,6 +372,7 @@
 	GtkWidget *sep1;
 	GtkWidget *sep2;
 	GtkWidget *menu;
+	GtkWidget *check;
 	gboolean unseen;
 
 #if USE_PIXBUF
@@ -658,6 +659,8 @@
 extern void serv_close(struct gaim_connection *);
 extern void serv_touch_idle(struct gaim_connection *);
 extern void serv_finish_login();
+#define IM_FLAG_AWAY     0x01
+#define IM_FLAG_CHECKBOX 0x02
 extern int  serv_send_im(struct gaim_connection *, char *, char *, int);
 extern void serv_get_info(struct gaim_connection *, char *);
 extern void serv_get_away_msg(struct gaim_connection *, char *);
--- a/src/perl.c	Fri Sep 07 07:30:28 2001 +0000
+++ b/src/perl.c	Fri Sep 07 08:09:22 2001 +0000
@@ -517,7 +517,7 @@
 	if (!c)
 		c = new_conversation(nick);
 	write_to_conv(c, what, WFLAG_SEND, NULL, time((time_t)NULL));
-	serv_send_im(c->gc, nick, what, atoi(isauto));
+	serv_send_im(c->gc, nick, what, atoi(isauto) ? IM_FLAG_AWAY : 0);
 }
 
 XS (XS_GAIM_print_to_chat)
--- a/src/protocols/icq/gaim_icq.c	Fri Sep 07 07:30:28 2001 +0000
+++ b/src/protocols/icq/gaim_icq.c	Fri Sep 07 08:09:22 2001 +0000
@@ -1,4 +1,3 @@
-#include <gtk/gtk.h>
 #include <string.h>
 #include <stdlib.h>
 #include "icq.h"   /* well, we're doing ICQ, right? */
@@ -19,7 +18,6 @@
 struct icq_data {
 	icq_Link *link;
 	int cur_status;
-	GSList *thru_serv;
 };
 
 static guint ack_timer = 0;
@@ -326,21 +324,15 @@
 	icq_Logout(id->link);
 	icq_Disconnect(id->link);
 	icq_ICQLINKDelete(id->link);
-	g_slist_free(id->thru_serv);
 	g_free(id);
 }
 
-static int icq_send_msg(struct gaim_connection *gc, char *who, char *msg, int away) {
-	if (!away && (strlen(msg) > 0)) {
+static int icq_send_msg(struct gaim_connection *gc, char *who, char *msg, int flags) {
+	if (!(flags & IM_FLAG_AWAY) && (strlen(msg) > 0)) {
 		struct icq_data *id = (struct icq_data *)gc->proto_data;
-		GSList *l = id->thru_serv;
 		long w = atol(who);
-		while (l) {
-			if (w == (long)l->data)
-				break;
-			l = l->next;
-		}
-		icq_SendMessage(id->link, w, msg, l ? ICQ_SEND_THRUSERVER : ICQ_SEND_BESTWAY);
+		icq_SendMessage(id->link, w, msg,
+				(flags & IM_FLAG_CHECKBOX) ? ICQ_SEND_THRUSERVER : ICQ_SEND_BESTWAY);
 	}
 	return 0;
 }
@@ -475,63 +467,16 @@
 	return m;
 }
 
-static void toggle_thru_serv(GtkToggleButton *button, struct conversation *c)
-{
-	struct gaim_connection *gc = gtk_object_get_user_data(GTK_OBJECT(button));
-	struct icq_data *id = gc->proto_data;
-	GSList *l = id->thru_serv;
-	long who = atol(c->name);
-
-	while (l) {
-		if (who == (long)l->data)
-			break;
-		l = l->next;
-	}
-	if (l)
-		id->thru_serv = g_slist_remove(id->thru_serv, (void *)who);
-	else
-		id->thru_serv = g_slist_append(id->thru_serv, (void *)who);
-}
-
-static void icq_insert_convo(struct gaim_connection *gc, struct conversation *c)
-{
-	GtkWidget *button;
-	struct icq_data *id = gc->proto_data;
-	GSList *l = id->thru_serv;
-	long who = atol(c->name);
-
-	button = gtk_check_button_new_with_label("Send message through server");
-	gtk_box_pack_start(GTK_BOX(c->lbox), button, FALSE, FALSE, 5);
-	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_thru_serv), c);
-	gtk_object_set_user_data(GTK_OBJECT(button), gc);
-	while (l) {
-		if (who == (long)l->data)
-			break;
-		l = l->next;
-	}
-	if (l)
-		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
-	gtk_widget_show(button);
-}
-
-static void icq_remove_convo(struct gaim_connection *gc, struct conversation *c)
-{
-	while (GTK_BOX(c->lbox)->children)
-		gtk_container_remove(GTK_CONTAINER(c->lbox),
-				     ((GtkBoxChild *)GTK_BOX(c->lbox)->children->data)->widget);
-}
-
 static struct prpl *my_protocol = NULL;
 
 void icq_init(struct prpl *ret) {
 	ret->protocol = PROTO_ICQ;
+	ret->checkbox = "Send message through server";
 	ret->name = icq_name;
 	ret->list_icon = icq_list_icon;
 	ret->away_states = icq_away_states;
 	ret->buddy_menu = icq_buddy_menu;
 	ret->user_opts = icq_user_opts;
-	ret->insert_convo = icq_insert_convo;
-	ret->remove_convo = icq_remove_convo;
 	ret->login = icq_login;
 	ret->close = icq_close;
 	ret->send_im = icq_send_msg;
--- a/src/protocols/irc/irc.c	Fri Sep 07 07:30:28 2001 +0000
+++ b/src/protocols/irc/irc.c	Fri Sep 07 08:09:22 2001 +0000
@@ -181,7 +181,7 @@
 }
 
 
-static int irc_send_im(struct gaim_connection *gc, char *who, char *message, int away)
+static int irc_send_im(struct gaim_connection *gc, char *who, char *message, int flags)
 {
 
 	struct irc_data *idata = (struct irc_data *)gc->proto_data;
--- a/src/protocols/jabber/jabber.c	Fri Sep 07 07:30:28 2001 +0000
+++ b/src/protocols/jabber/jabber.c	Fri Sep 07 08:09:22 2001 +0000
@@ -1222,7 +1222,7 @@
 	gc->proto_data = NULL;
 }
 
-static int jabber_send_im(struct gaim_connection *gc, char *who, char *message, int away)
+static int jabber_send_im(struct gaim_connection *gc, char *who, char *message, int flags)
 {
 	xmlnode x, y;
 	char *realwho;
--- a/src/protocols/msn/msn.c	Fri Sep 07 07:30:28 2001 +0000
+++ b/src/protocols/msn/msn.c	Fri Sep 07 08:09:22 2001 +0000
@@ -1173,7 +1173,7 @@
 	g_free(md);
 }
 
-static int msn_send_im(struct gaim_connection *gc, char *who, char *message, int away)
+static int msn_send_im(struct gaim_connection *gc, char *who, char *message, int flags)
 {
 	struct msn_data *md = gc->proto_data;
 	struct msn_switchboard *ms = msn_find_switch(gc, who);
@@ -1204,7 +1204,7 @@
 		ms->fd = -1;
 	} else
 		/* in msn you can't send messages to yourself, so we'll fake like we received it ;) */
-		serv_got_im(gc, who, message, away, time(NULL));
+		serv_got_im(gc, who, message, flags & IM_FLAG_AWAY, time(NULL));
 	return 0;
 }
 
--- a/src/protocols/napster/napster.c	Fri Sep 07 07:30:28 2001 +0000
+++ b/src/protocols/napster/napster.c	Fri Sep 07 08:09:22 2001 +0000
@@ -77,7 +77,7 @@
 	write(ndata->fd, message, size);
 }
 
-static int nap_send_im(struct gaim_connection *gc, char *who, char *message, int away)
+static int nap_send_im(struct gaim_connection *gc, char *who, char *message, int flags)
 {
 	gchar buf[NAP_BUF_LEN];
 
--- a/src/protocols/oscar/oscar.c	Fri Sep 07 07:30:28 2001 +0000
+++ b/src/protocols/oscar/oscar.c	Fri Sep 07 08:09:22 2001 +0000
@@ -2049,13 +2049,13 @@
 	return "Oscar";
 }
 
-static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, int away) {
+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);
 	if (dim) {
 		return aim_send_im_direct(odata->sess, dim->conn, message);
 	} else {
-		if (away)
+		if (imflags & IM_FLAG_AWAY)
 			return aim_send_im(odata->sess, odata->conn, name, AIM_IMFLAGS_AWAY, message);
 		else {
 			struct aim_sendimext_args args;
--- a/src/protocols/toc/toc.c	Fri Sep 07 07:30:28 2001 +0000
+++ b/src/protocols/toc/toc.c	Fri Sep 07 08:09:22 2001 +0000
@@ -738,7 +738,7 @@
 	return "TOC";
 }
 
-static int toc_send_im(struct gaim_connection *gc, char *name, char *message, int away)
+static int toc_send_im(struct gaim_connection *gc, char *name, char *message, int flags)
 {
 	char buf[BUF_LEN * 2];
 	char *tmp = g_malloc(strlen(message) * 2);
@@ -750,7 +750,7 @@
 		return -E2BIG;
 	}
 	g_snprintf(buf, MSG_LEN - 8, "toc_send_im %s \"%s\"%s", normalize(name),
-		   tmp, ((away) ? " auto" : ""));
+		   tmp, ((flags & IM_FLAG_AWAY) ? " auto" : ""));
 	sflap_send(gc, buf, -1, TYPE_DATA);
 	
 	g_free(tmp);
--- a/src/protocols/yahoo/yay.c	Fri Sep 07 07:30:28 2001 +0000
+++ b/src/protocols/yahoo/yay.c	Fri Sep 07 08:09:22 2001 +0000
@@ -26,7 +26,6 @@
 
 
 #include <netdb.h>
-#include <gtk/gtk.h>
 #include <unistd.h>
 #include <errno.h>
 #include <netinet/in.h>
@@ -74,7 +73,6 @@
 	char *active_id;
 	GList *conns;
 	gboolean logged_in;
-	GSList *offline;
 };
 
 static char *yahoo_name() {
@@ -390,10 +388,6 @@
 
 static void yahoo_close(struct gaim_connection *gc) {
 	struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
-	while (yd->offline) {
-		g_free(yd->offline->data);
-		yd->offline = g_slist_remove(yd->offline, yd->offline->data);
-	}
 	g_hash_table_foreach_remove(yd->hash, yahoo_destroy_hash, NULL);
 	g_hash_table_destroy(yd->hash);
 	yahoo_disconnect(yd->sess);
@@ -401,19 +395,12 @@
 	g_free(yd);
 }
 
-static int yahoo_send_im(struct gaim_connection *gc, char *who, char *message, int away) {
+static int yahoo_send_im(struct gaim_connection *gc, char *who, char *message, int flags) {
 	struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
-	GSList *l = yd->offline;
-
-	if (away || !strlen(message)) return 0;
 
-	while (l) {
-		if (!strcmp(who, l->data))
-			break;
-		l = l->next;
-	}
+	if ((flags & IM_FLAG_AWAY)|| !strlen(message)) return 0;
 
-	if (l)
+	if (flags & IM_FLAG_CHECKBOX)
 		yahoo_send_message(yd->sess, yd->active_id, who, message);
 	else
 		yahoo_send_message_offline(yd->sess, yd->active_id, who, message);
@@ -693,58 +680,13 @@
 	return m;
 }
 
-static void toggle_offline(GtkToggleButton *button, struct conversation *c)
-{
-	struct gaim_connection *gc = gtk_object_get_user_data(GTK_OBJECT(button));
-	struct yahoo_data *yd = gc->proto_data;
-	GSList *l = yd->offline;
-
-	while (l) {
-		if (!strcmp(c->name, l->data))
-			break;
-		l = l->next;
-	}
-	if (l) {
-		g_free(l->data);
-		yd->offline = g_slist_remove(yd->offline, l->data);
-	} else
-		yd->offline = g_slist_append(yd->offline, g_strdup(c->name));
-}
-
-static void yahoo_insert_convo(struct gaim_connection *gc, struct conversation *c)
-{
-	GtkWidget *button;
-	struct yahoo_data *yd = gc->proto_data;
-	GSList *l = yd->offline;
-	struct buddy *b = find_buddy(gc, c->name);
-
-	button = gtk_check_button_new_with_label("Send offline message");
-	gtk_box_pack_start(GTK_BOX(c->lbox), button, FALSE, FALSE, 5);
-	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_offline), c);
-	gtk_object_set_user_data(GTK_OBJECT(button), gc);
-	while (l) {
-		if (!strcmp(c->name, l->data))
-			break;
-		l = l->next;
-	}
-	if (l || (b && !b->present))
-		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
-	gtk_widget_show(button);
-}
-
-static void yahoo_remove_convo(struct gaim_connection *gc, struct conversation *c)
-{
-	while (GTK_BOX(c->lbox)->children)
-		gtk_container_remove(GTK_CONTAINER(c->lbox),
-				     ((GtkBoxChild *)GTK_BOX(c->lbox)->children->data)->widget);
-}
-
 static struct prpl *my_protocol = NULL;
 
 void yahoo_init(struct prpl *ret) {
 	/* the NULL's aren't required but they're nice to have */
 	ret->protocol = PROTO_YAHOO;
 	ret->options = OPT_PROTO_MAIL_CHECK;
+	ret->checkbox = _("Send offline message");
 	ret->name = yahoo_name;
 	ret->list_icon = yahoo_list_icon;
 	ret->away_states = yahoo_away_states;
@@ -752,8 +694,6 @@
 	ret->do_action = yahoo_do_action;
 	ret->buddy_menu = yahoo_buddy_menu;
 	ret->user_opts = yahoo_user_opts;
-	ret->insert_convo = yahoo_insert_convo;
-	ret->remove_convo = yahoo_remove_convo;
 	ret->login = yahoo_login;
 	ret->close = yahoo_close;
 	ret->send_im = yahoo_send_im;
--- a/src/protocols/zephyr/zephyr.c	Fri Sep 07 07:30:28 2001 +0000
+++ b/src/protocols/zephyr/zephyr.c	Fri Sep 07 08:09:22 2001 +0000
@@ -720,12 +720,12 @@
 	return 0;
 }
 
-static int zephyr_send_im(struct gaim_connection *gc, char *who, char *im, int away) {
+static int zephyr_send_im(struct gaim_connection *gc, char *who, char *im, int flags) {
 	ZNotice_t notice;
 	char *buf;
 	const char *sig;
 
-	if (away)
+	if (flags & IM_FLAG_AWAY)
 		sig = "Automated reply:";
 	else {
 		sig = ZGetVariable("zwrite-signature");
--- a/src/prpl.h	Fri Sep 07 07:30:28 2001 +0000
+++ b/src/prpl.h	Fri Sep 07 08:09:22 2001 +0000
@@ -73,6 +73,9 @@
 	int options;
 	char *(* name)();
 
+	/* for ICQ and Yahoo, who have off/on per-conversation options */
+	char *checkbox;
+
 	/* returns the XPM associated with the given user class */
 	char **(* list_icon)(int);
 	GList *(* away_states)();
@@ -91,8 +94,6 @@
 	 * their UIs all that often anyway. */
 	void (* draw_new_user)(GtkWidget *);
 	void (* do_new_user)();
-	void (* insert_convo)(struct gaim_connection *, struct conversation *);
-	void (* remove_convo)(struct gaim_connection *, struct conversation *);
 
 	/* all the server-related functions */
 	void (* login)		(struct aim_user *);
--- a/src/server.c	Fri Sep 07 07:30:28 2001 +0000
+++ b/src/server.c	Fri Sep 07 08:09:22 2001 +0000
@@ -120,13 +120,13 @@
 
 
 
-int serv_send_im(struct gaim_connection *gc, char *name, char *message, int away)
+int serv_send_im(struct gaim_connection *gc, char *name, char *message, int flags)
 {
 	int val = -EINVAL;
 	if (gc->prpl && gc->prpl->send_im)
-		val = (*gc->prpl->send_im)(gc, name, message, away);
+		val = (*gc->prpl->send_im)(gc, name, message, flags);
 
-	if (!away)
+	if (!(flags & IM_FLAG_AWAY))
 		serv_touch_idle(gc);
 
 	return val;
@@ -428,7 +428,7 @@
 	if ((general_options & OPT_GEN_TIK_HACK) && gc->away && strlen(gc->away) &&
 	    !strcmp(message, ">>>Automated Message: Getting Away Message<<<")) {
 		char *tmpmsg = stylize(awaymessage->message, MSG_LEN);
-		serv_send_im(gc, name, tmpmsg, 1);
+		serv_send_im(gc, name, tmpmsg, IM_FLAG_AWAY);
 		g_free(tmpmsg);
 		g_free(name);
 		g_free(message);
@@ -549,7 +549,7 @@
 
 		/* apply default fonts and colors */
 		tmpmsg = stylize(gc->away, MSG_LEN);
-		serv_send_im(gc, name, away_subs(tmpmsg, alias), 1);
+		serv_send_im(gc, name, away_subs(tmpmsg, alias), IM_FLAG_AWAY);
 		if (!cnv && clistqueue && (general_options & OPT_GEN_QUEUE_WHEN_AWAY)) {
 			struct queued_message *qm;
 			qm = g_new0(struct queued_message, 1);