changeset 2791:8f6365332a05

[gaim-migrate @ 2804] i hate this shit. i should just stop hacking gaim. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 26 Nov 2001 20:39:54 +0000
parents 0148422dff4d
children 9123abd0db92
files src/dialogs.c src/gaim.h src/protocols/gg/gg.c src/protocols/icq/gaim_icq.c src/protocols/irc/irc.c src/protocols/jabber/jabber.c src/protocols/oscar/oscar.c src/protocols/toc/toc.c src/protocols/zephyr/zephyr.c
diffstat 9 files changed, 79 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/src/dialogs.c	Mon Nov 26 20:15:59 2001 +0000
+++ b/src/dialogs.c	Mon Nov 26 20:39:54 2001 +0000
@@ -1772,7 +1772,13 @@
 	return NULL;
 }
 
-void g_show_info_text(struct gaim_connection *gc, char *who, gboolean away, char *info, ...)
+/* if away is 0, show regardless and try to get away message
+ *            1, don't show if regular info isn't shown
+ *            2, show regardless but don't try to get away message
+ *
+ * i wish this were my client. if i were i wouldn't have to deal with this shit.
+ */
+void g_show_info_text(struct gaim_connection *gc, char *who, int away, char *info, ...)
 {
 	GtkWidget *ok;
 	GtkWidget *label;
@@ -1784,7 +1790,7 @@
 	va_list ap;
 
 	struct info_dlg *b = find_info_dlg(gc, who);
-	if (!b && away)
+	if (!b && (away == 1))
 		return;
 	if (!b) {
 		b = g_new0(struct info_dlg, 1);
--- a/src/gaim.h	Mon Nov 26 20:15:59 2001 +0000
+++ b/src/gaim.h	Mon Nov 26 20:39:54 2001 +0000
@@ -332,7 +332,7 @@
 extern struct conversation *find_conversation(char *);
 
 /* Functions in dialogs.c */
-extern void g_show_info_text(struct gaim_connection *, char *, gboolean, char *, ...);
+extern void g_show_info_text(struct gaim_connection *, char *, int, char *, ...);
 extern GtkWidget *do_error_dialog(char *, char *);
 extern void show_change_passwd(struct gaim_connection *);
 extern void show_set_dir(struct gaim_connection *);
--- a/src/protocols/gg/gg.c	Mon Nov 26 20:15:59 2001 +0000
+++ b/src/protocols/gg/gg.c	Mon Nov 26 20:39:54 2001 +0000
@@ -1,6 +1,6 @@
 /*
  * gaim - Gadu-Gadu Protocol Plugin
- * $Id: gg.c 2786 2001-11-20 01:01:22Z warmenhoven $
+ * $Id: gg.c 2804 2001-11-26 20:39:54Z warmenhoven $
  *
  * Copyright (C) 2001, Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
  * 
@@ -790,7 +790,7 @@
 
 	g_strfreev(webdata_tbl);
 
-	g_show_info_text(gc, NULL, FALSE, buf, NULL);
+	g_show_info_text(gc, NULL, 2, buf, NULL);
 
 	g_free(buf);
 }
--- a/src/protocols/icq/gaim_icq.c	Mon Nov 26 20:15:59 2001 +0000
+++ b/src/protocols/icq/gaim_icq.c	Mon Nov 26 20:39:54 2001 +0000
@@ -201,7 +201,7 @@
 		   nick,
 		   first, last,
 		   email);
-	g_show_info_text(gc, who, FALSE, buf, NULL);
+	g_show_info_text(gc, who, 2, buf, NULL);
 }
 
 static void icq_web_pager(icq_Link *link, unsigned char hour, unsigned char minute,
--- a/src/protocols/irc/irc.c	Mon Nov 26 20:15:59 2001 +0000
+++ b/src/protocols/irc/irc.c	Mon Nov 26 20:39:54 2001 +0000
@@ -639,7 +639,7 @@
 	case 318:
 		if (id->in_whois && id->whois_str) {
 			GString *str = decode_html(id->whois_str->str);
-			g_show_info_text(gc, NULL, FALSE, str->str, NULL);
+			g_show_info_text(gc, NULL, 2, str->str, NULL);
 			g_string_free(str, TRUE);
 			g_string_free(id->whois_str, TRUE);
 			id->whois_str = NULL;
--- a/src/protocols/jabber/jabber.c	Mon Nov 26 20:15:59 2001 +0000
+++ b/src/protocols/jabber/jabber.c	Mon Nov 26 20:39:54 2001 +0000
@@ -961,7 +961,7 @@
 	if (desc)
 		at += g_snprintf(buf + at, sizeof(buf) - at, "<HR>%s<br>\n", desc);
 
-	g_show_info_text(gc, buddy, FALSE, buf, NULL);
+	g_show_info_text(gc, buddy, 2, buf, NULL);
 	g_free(buddy);
 }
 
--- a/src/protocols/oscar/oscar.c	Mon Nov 26 20:15:59 2001 +0000
+++ b/src/protocols/oscar/oscar.c	Mon Nov 26 20:39:54 2001 +0000
@@ -99,6 +99,7 @@
 
 	gboolean killme;
 	gboolean icq;
+	GSList *evilhack;
 };
 
 struct chat_connection {
@@ -520,6 +521,10 @@
 		odata->hasicons = g_slist_remove(odata->hasicons, n);
 		g_free(n);
 	}
+	while (odata->evilhack) {
+		g_free(odata->evilhack->data);
+		odata->evilhack = g_slist_remove(odata->evilhack, odata->evilhack->data);
+	}
 	if (odata->create_name)
 		g_free(odata->create_name);
 	if (odata->email)
@@ -1555,9 +1560,12 @@
 	aim_userinfo_t *info;
 	char *prof_enc = NULL, *prof = NULL;
 	fu16_t infotype;
-	char buf[BUF_LONG];
+	char header[BUF_LONG];
 	char legend[BUF_LONG];
 	struct gaim_connection *gc = sess->aux_data;
+	struct oscar_data *od = gc->proto_data;
+	GSList *l = od->evilhack;
+	gboolean evilhack = FALSE;
 	gboolean away;
 	va_list ap;
 	char *asc;
@@ -1577,17 +1585,13 @@
 			"<IMG SRC=\"admin_icon.gif\"> : Administrator"));
 
 	away = infotype != AIM_GETINFO_GENERALINFO;
-	if (away && (!prof || !*prof)) {
-		g_show_info_text(gc, info->sn, away, legend, NULL);
-		return 1;
-	}
 
 	if (info->membersince)
 		asc = g_strdup_printf("Member Since : <B>%s</B><BR>\n",
 				asctime(localtime(&info->membersince)));
 	else
 		asc = g_strdup("");
-	g_snprintf(buf, sizeof buf,
+	g_snprintf(header, sizeof header,
 			_("Username : <B>%s</B>  %s <BR>\n"
 			"%s"
 			"Warning Level : <B>%d %%</B><BR>\n"
@@ -1600,15 +1604,37 @@
 			info->idletime);
 	g_free(asc);
 
-	g_show_info_text(gc, info->sn, away, away ? "<br><hr>" : buf,
-			 (prof && strlen(prof)) ?
-				away_subs(prof, gc->username)
-				:
-			 away ?
-				_("<i>User has no away message</i>") :
-				_("<i>No Information Provided</i>"),
-			 legend,
-			 NULL);
+	while (l) {
+		char *x = l->data;
+		if (!strcmp(x, normalize(info->sn))) {
+			evilhack = TRUE;
+			g_free(x);
+			od->evilhack = g_slist_remove(od->evilhack, x);
+			break;
+		}
+		l = l->next;
+	}
+
+	if (away) {
+		if (evilhack) {
+			g_show_info_text(gc, info->sn, 2,
+					 header,
+					 (prof && *prof) ? prof :
+						_("<i>User has no away message</i>"),
+					 legend, NULL);
+		} else {
+			g_show_info_text(gc, info->sn, 0,
+					 header,
+					 (prof && *prof) ? prof : NULL,
+					 NULL);
+		}
+	} else {
+		g_show_info_text(gc, info->sn, 1,
+				 "<BR><HR><BR>",
+				 (prof && *prof) ? prof : _("<i>No Information Provided</i>"),
+				 legend,
+				 NULL);
+	}
 
 	return 1;
 }
@@ -2266,17 +2292,18 @@
 	if (odata->icq)
 		aim_icq_getsimpleinfo(odata->sess, name);
 	else
+		/* people want the away message on the top, so we get the away message
+		 * first and then get the regular info, since it's too difficult to
+		 * insert in the middle. i hate people. */
+		aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_AWAYMESSAGE);
+}
+
+static void oscar_get_away(struct gaim_connection *g, char *name) {
+	struct oscar_data *odata = (struct oscar_data *)g->proto_data;
+	if (!odata->icq)
 		aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_GENERALINFO);
 }
 
-/*
-static void oscar_get_away_msg(struct gaim_connection *g, char *name) {
-	struct oscar_data *odata = (struct oscar_data *)g->proto_data;
-	if (!odata->icq)
-		aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_AWAYMESSAGE);
-}
-*/
-
 static void oscar_set_dir(struct gaim_connection *g, char *first, char *middle, char *last,
 			  char *maiden, char *city, char *state, char *country, int web) {
 	/* FIXME : some of these things are wrong, but i'm lazy */
@@ -2692,6 +2719,12 @@
 	do_ask_dialog(buf, data, oscar_direct_im, oscar_cancel_direct_im);
 }
 
+static void oscar_get_away_msg(struct gaim_connection *gc, char *who) {
+	struct oscar_data *od = gc->proto_data;
+	od->evilhack = g_slist_append(od->evilhack, g_strdup(normalize(who)));
+	oscar_get_info(gc, who);
+}
+
 static GList *oscar_buddy_menu(struct gaim_connection *gc, char *who) {
 	GList *m = NULL;
 	struct proto_buddy_menu *pbm;
@@ -2703,6 +2736,12 @@
 	pbm->gc = gc;
 	m = g_list_append(m, pbm);
 
+	pbm = g_new0(struct proto_buddy_menu, 1);
+	pbm->label = _("Get Away Msg");
+	pbm->callback = oscar_get_away_msg;
+	pbm->gc = gc;
+	m = g_list_append(m, pbm);
+
 	if (strcmp(n, normalize(who))) {
 		pbm = g_new0(struct proto_buddy_menu, 1);
 		pbm->label = _("Direct IM");
@@ -2915,7 +2954,7 @@
 	ret->set_info = oscar_set_info;
 	ret->get_info = oscar_get_info;
 	ret->set_away = oscar_set_away;
-	ret->get_away = NULL;
+	ret->get_away = oscar_get_away;
 	ret->set_dir = oscar_set_dir;
 	ret->get_dir = NULL; /* Oscar really doesn't have this */
 	ret->dir_search = oscar_dir_search;
--- a/src/protocols/toc/toc.c	Mon Nov 26 20:15:59 2001 +0000
+++ b/src/protocols/toc/toc.c	Mon Nov 26 20:39:54 2001 +0000
@@ -382,7 +382,7 @@
 	if (!url_text)
 		return;
 
-	g_show_info_text(NULL, NULL, FALSE, url_text, NULL);
+	g_show_info_text(NULL, NULL, 2, url_text, NULL);
 }
 
 static char *show_error_message()
--- a/src/protocols/zephyr/zephyr.c	Mon Nov 26 20:15:59 2001 +0000
+++ b/src/protocols/zephyr/zephyr.c	Mon Nov 26 20:39:54 2001 +0000
@@ -349,7 +349,7 @@
 					g_string_sprintfa(str, "<br>At %s since %s", locs.host,
 									locs.time);
 				}
-				g_show_info_text(NULL, NULL, FALSE, str->str, NULL);
+				g_show_info_text(NULL, NULL, 2, str->str, NULL);
 				g_string_free(str, TRUE);
 			} else
 				serv_got_update(zgc, b->name, nlocs, 0, 0, 0, 0, 0);