changeset 5136:381da05cb5ed

[gaim-migrate @ 5500] this started out as simply adding an option to right-click on a jabber buddy and re-request authorization. Then I ended up chasing the disgusting mess of const vs non-const parameters all over gaim. The end result is that you can now right-click on jabber buddies and re-request auth like you can for ICQ. Also, a lot more things are const that should be, I fixed a bug or two, and I cleaned up one of my least favorite functions in gaim (linkify_text). It is now decidedly less evil. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Tue, 15 Apr 2003 04:18:00 +0000
parents 102135caa225
children 014fb99b4b93
files src/conversation.c src/core.h src/dialogs.c src/gaim.h src/multi.h src/protocols/gg/gg.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/yahoo.c src/protocols/zephyr/Zinternal.c src/protocols/zephyr/zephyr.c src/protocols/zephyr/zephyr.h src/prpl.h src/server.c src/util.c src/util.h
diffstat 21 files changed, 169 insertions(+), 156 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/conversation.c	Tue Apr 15 04:18:00 2003 +0000
@@ -175,7 +175,7 @@
 	GaimConversationType type;
 	struct gaim_connection *gc;
 	struct gaim_conversation_ui_ops *ops;
-	char *buf, *buf2, *buffy;
+	char *buf, *buf2, *buffy = NULL;
 	gulong length = 0;
 	gboolean binary = FALSE;
 	int plugin_return;
@@ -212,12 +212,11 @@
 
 	buf2 = g_malloc(limit);
 
-	if (gc->flags & OPT_CONN_HTML) {
-		if (convo_options & OPT_CONVO_SEND_LINKS)
-			linkify_text(buf);
-	}
-
-	buffy = g_strdup(buf);
+	if (gc->flags & OPT_CONN_HTML && convo_options & OPT_CONVO_SEND_LINKS)
+		buffy =linkify_text(buf);
+	else
+		buffy = g_strdup(buf);
+
 	plugin_return = plugin_event(
 			(type == GAIM_CONV_IM ? event_im_send : event_chat_send),
 			gc,
--- a/src/core.h	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/core.h	Tue Apr 15 04:18:00 2003 +0000
@@ -211,7 +211,7 @@
 
 /* Functions in server.c */
 extern void serv_got_update(struct gaim_connection *, char *, int, int, time_t, time_t, int);
-extern void serv_got_im(struct gaim_connection *, char *, char *, guint32, time_t, gint);
+extern void serv_got_im(struct gaim_connection *, const char *, const char *, guint32, time_t, gint);
 extern void serv_got_typing(struct gaim_connection *, char *, int, int);
 extern void serv_got_typing_stopped(struct gaim_connection *, char *);
 extern void serv_got_eviled(struct gaim_connection *, char *, int);
--- a/src/dialogs.c	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/dialogs.c	Tue Apr 15 04:18:00 2003 +0000
@@ -150,7 +150,7 @@
 
 static GSList *info_dlgs = NULL;
 
-static struct info_dlg *find_info_dlg(struct gaim_connection *gc, char *who)
+static struct info_dlg *find_info_dlg(struct gaim_connection *gc, const char *who)
 {
 	GSList *i = info_dlgs;
 	while (i) {
@@ -2012,7 +2012,7 @@
  *
  * 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, ...)
+void g_show_info_text(struct gaim_connection *gc, const char *who, int away, const char *info, ...)
 {
 	GtkWidget *ok;
 	GtkWidget *label;
--- a/src/gaim.h	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/gaim.h	Tue Apr 15 04:18:00 2003 +0000
@@ -349,7 +349,7 @@
 #endif
 
 /* Functions in dialogs.c */
-extern void g_show_info_text(struct gaim_connection *, char *, int, char *, ...);
+extern void g_show_info_text(struct gaim_connection *, const char *, int, const char *, ...);
 extern GtkWidget *do_error_dialog(const char *, const char *, int type);
 extern void show_change_passwd(struct gaim_connection *);
 extern void show_set_dir(struct gaim_connection *);
@@ -412,7 +412,7 @@
 extern void serv_chat_whisper(struct gaim_connection *, int, char *, char *);
 extern int  serv_chat_send(struct gaim_connection *, int, char *);
 extern void serv_got_popup(char *, char *, int, int);
-extern void serv_get_away(struct gaim_connection *, char *);
+extern void serv_get_away(struct gaim_connection *, const char *);
 extern void serv_alias_buddy(struct buddy *);
 extern void serv_move_buddy(struct buddy *, struct group *, struct group *);
 extern void serv_rename_group(struct gaim_connection *, struct group *, const char *);
--- a/src/multi.h	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/multi.h	Tue Apr 15 04:18:00 2003 +0000
@@ -94,7 +94,7 @@
 
 struct proto_buddy_menu {
 	char *label;
-	void (*callback)(struct gaim_connection *, char *);
+	void (*callback)(struct gaim_connection *, const char *);
 	struct gaim_connection *gc;
 };
 
--- a/src/protocols/gg/gg.c	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/protocols/gg/gg.c	Tue Apr 15 04:18:00 2003 +0000
@@ -1,6 +1,6 @@
 /*
  * gaim - Gadu-Gadu Protocol Plugin
- * $Id: gg.c 5419 2003-04-07 23:17:27Z faceprint $
+ * $Id: gg.c 5500 2003-04-15 04:18:00Z faceprint $
  *
  * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
  * 
@@ -265,7 +265,7 @@
 }
 
 /* Enhance these functions, more options and such stuff */
-static GList *agg_buddy_menu(struct gaim_connection *gc, char *who)
+static GList *agg_buddy_menu(struct gaim_connection *gc, const char *who)
 {
 	GList *m = NULL;
 	struct proto_buddy_menu *pbm;
@@ -582,7 +582,7 @@
 	g_free(gc->proto_data);
 }
 
-static int agg_send_im(struct gaim_connection *gc, char *who, char *msg, int len, int flags)
+static int agg_send_im(struct gaim_connection *gc, const char *who, const char *msg, int len, int flags)
 {
 	struct agg_data *gd = (struct agg_data *)gc->proto_data;
 	gchar *imsg;
@@ -1210,7 +1210,7 @@
 	return m;
 }
 
-static void agg_get_info(struct gaim_connection *gc, char *who)
+static void agg_get_info(struct gaim_connection *gc, const char *who)
 {
 	struct agg_http *srch = g_new0(struct agg_http, 1);
 	srch->gc = gc;
--- a/src/protocols/icq/gaim_icq.c	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/protocols/icq/gaim_icq.c	Tue Apr 15 04:18:00 2003 +0000
@@ -361,7 +361,7 @@
 	g_free(id);
 }
 
-static int icq_send_msg(struct gaim_connection *gc, char *who, char *msg, int len, int flags) {
+static int icq_send_msg(struct gaim_connection *gc, const char *who, const char *msg, int len, int flags) {
 	if (!(flags & IM_FLAG_AWAY) && (strlen(msg) > 0)) {
 		struct icq_data *id = (struct icq_data *)gc->proto_data;
 		long w = atol(who);
@@ -457,7 +457,7 @@
 	return icon_online_xpm;
 	}*/
 
-static void icq_get_info(struct gaim_connection *gc, char *who) {
+static void icq_get_info(struct gaim_connection *gc, const char *who) {
 	struct icq_data *id = (struct icq_data *)gc->proto_data;
 	icq_SendInfoReq(id->link, atol(who));
 }
--- a/src/protocols/irc/irc.c	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/protocols/irc/irc.c	Tue Apr 15 04:18:00 2003 +0000
@@ -112,16 +112,16 @@
 };
 
 /* Prototypes */
-static void irc_start_chat(struct gaim_connection *gc, char *who);
-static void irc_ctcp_clientinfo(struct gaim_connection *gc, char *who);
-static void irc_ctcp_userinfo(struct gaim_connection *gc, char *who);
-static void irc_ctcp_version(struct gaim_connection *gc, char *who);
-static void irc_ctcp_ping(struct gaim_connection *gc, char *who);
+static void irc_start_chat(struct gaim_connection *gc, const char *who);
+static void irc_ctcp_clientinfo(struct gaim_connection *gc, const char *who);
+static void irc_ctcp_userinfo(struct gaim_connection *gc, const char *who);
+static void irc_ctcp_version(struct gaim_connection *gc, const char *who);
+static void irc_ctcp_ping(struct gaim_connection *gc, const char *who);
 
-static void irc_send_privmsg(struct gaim_connection *gc, char *who, char *what, gboolean fragment);
+static void irc_send_privmsg(struct gaim_connection *gc, const char *who, const char *what, gboolean fragment);
 static void irc_send_notice(struct gaim_connection *gc, char *who, char *what);
 
-static char *irc_send_convert(struct gaim_connection *gc, char *string, int maxlen, int *done);
+static char *irc_send_convert(struct gaim_connection *gc, const char *string, int maxlen, int *done);
 static char *irc_recv_convert(struct gaim_connection *gc, char *string);
 static void irc_parse_notice(struct gaim_connection *gc, char *nick, char *ex,
                             char *word[], char *word_eol[]);
@@ -138,7 +138,7 @@
 GSList *dcc_chat_list = NULL;
 
 struct dcc_chat *
-find_dcc_chat (struct gaim_connection *gc, char *nick)
+find_dcc_chat (struct gaim_connection *gc, const char *nick)
 {
 	GSList *tmp;
 	struct dcc_chat *data;
@@ -166,10 +166,10 @@
 }
 
 static char *
-irc_send_convert(struct gaim_connection *gc, char *string, int maxlen, int *done)
+irc_send_convert(struct gaim_connection *gc, const char *string, int maxlen, int *done)
 {
 	char *converted = g_malloc(maxlen + 1);
-	gchar *inptr = string, *outptr = converted;
+	gchar *inptr = (gchar*)string, *outptr = converted;
 	int inleft = strlen(string), outleft = maxlen;
 	GIConv conv;
 	
@@ -204,7 +204,7 @@
 }
 
 static struct gaim_conversation *
-irc_find_chat(struct gaim_connection *gc, char *name)
+irc_find_chat(struct gaim_connection *gc, const char *name)
 {
 	GSList *bcs = gc->buddy_chats;
 
@@ -1116,7 +1116,7 @@
 }
 
 static gboolean 
-is_channel(struct gaim_connection *gc, char *name)
+is_channel(struct gaim_connection *gc, const char *name)
 {
 	struct irc_data *id = gc->proto_data;
 	if (strchr(id->chantypes, *name))
@@ -1918,7 +1918,7 @@
 }
 
 static void 
-set_mode_3(struct gaim_connection *gc, char *who, int sign, int mode,
+set_mode_3(struct gaim_connection *gc, const char *who, int sign, int mode,
 		       int start, int end, char *word[])
 {
 	struct irc_data *id = gc->proto_data;
@@ -1955,7 +1955,7 @@
 }
 
 static void 
-set_mode_6(struct gaim_connection *gc, char *who, int sign, int mode,
+set_mode_6(struct gaim_connection *gc, const char *who, int sign, int mode,
 		       int start, int end, char *word[])
 {
 	struct irc_data *id = gc->proto_data;
@@ -2012,7 +2012,7 @@
 }
 
 static void 
-set_mode(struct gaim_connection *gc, char *who, int sign, int mode, char *word[])
+set_mode(struct gaim_connection *gc, const char *who, int sign, int mode, char *word[])
 {
 	struct irc_data *id = gc->proto_data;
 	int i = 2;
@@ -2032,7 +2032,7 @@
 }
 
 static void 
-set_chan_mode(struct gaim_connection *gc, char *chan, char *mode_str)
+set_chan_mode(struct gaim_connection *gc, const char *chan, const char *mode_str)
 {
 	struct irc_data *id = gc->proto_data;
 	char buf[IRC_BUF_LEN];
@@ -2044,20 +2044,20 @@
 }
 
 static int 
-handle_command(struct gaim_connection *gc, char *who, char *what)
+handle_command(struct gaim_connection *gc, const char *who, const char *in_what)
 {
 	char buf[IRC_BUF_LEN];
 	char pdibuf[IRC_BUF_LEN];
 	char *word[PDIWORDS], *word_eol[PDIWORDS];
-	char *tmp = g_strdup(what);
+	char *tmp = g_strdup(in_what);
 	GString *str = encode_html(tmp);
 	char *intl;
 	int len;
 	struct dcc_chat *dccchat = find_dcc_chat(gc, who);
 	struct irc_data *id = gc->proto_data;
+	char *what = str->str;
 
 	g_free(tmp);
-	what = str->str;
 
 	if (*what != '/') {
 		if (dccchat) {
@@ -2130,8 +2130,7 @@
 	} else if (!g_ascii_strcasecmp(pdibuf, "DEVOICE")) {
 		set_mode(gc, who, '-', 'v', word);
 	} else if (!g_ascii_strcasecmp(pdibuf, "MODE")) {
-		char *chan = who;
-		set_chan_mode(gc, chan, word_eol[2]);
+		set_chan_mode(gc, who, word_eol[2]);
 	} else if (!g_ascii_strcasecmp(pdibuf, "QUOTE")) {
 		if (!*word_eol[2]) {
 			g_free(what);
@@ -2179,7 +2178,7 @@
 			g_snprintf(buf, sizeof(buf), "JOIN %s\r\n", word[2]);
 		irc_write(id->fd, buf, strlen(buf));
 	} else if (!g_ascii_strcasecmp(pdibuf, "PART")) {
-		char *chan = *word[2] ? word[2] : who;
+		const char *chan = *word[2] ? word[2] : who;
 		char *reason = word_eol[3];
 		struct gaim_conversation *c;
 		if (!is_channel(gc, chan)) {
@@ -2319,7 +2318,7 @@
 }
 
 static int 
-send_msg(struct gaim_connection *gc, char *who, char *what)
+send_msg(struct gaim_connection *gc, const char *who, const char *what)
 {
 	char *cr = strchr(what, '\n');
 	if (cr) {
@@ -2351,7 +2350,7 @@
 }
 
 static int 
-irc_send_im(struct gaim_connection *gc, char *who, char *what, int len, int flags)
+irc_send_im(struct gaim_connection *gc, const char *who, const char *what, int len, int flags)
 {
 	if (*who == '@' || *who == '%' || *who == '+')
 		return send_msg(gc, who + 1, what);
@@ -2651,7 +2650,7 @@
 #endif
 
 static void 
-irc_ctcp_clientinfo(struct gaim_connection *gc, char *who)
+irc_ctcp_clientinfo(struct gaim_connection *gc, const char *who)
 {
 	char buf[IRC_BUF_LEN];
 
@@ -2660,7 +2659,7 @@
 }
 
 static void 
-irc_ctcp_userinfo(struct gaim_connection *gc, char *who)
+irc_ctcp_userinfo(struct gaim_connection *gc, const char *who)
 {
 	char buf[IRC_BUF_LEN];
 
@@ -2669,7 +2668,7 @@
 }
 
 static void 
-irc_ctcp_version(struct gaim_connection *gc, char *who)
+irc_ctcp_version(struct gaim_connection *gc, const char *who)
 {
 	char buf[IRC_BUF_LEN];
 
@@ -2678,7 +2677,7 @@
 }
 
 static void 
-irc_ctcp_ping(struct gaim_connection *gc, char *who)
+irc_ctcp_ping(struct gaim_connection *gc, const char *who)
 {
 	char buf[IRC_BUF_LEN];
 
@@ -2716,7 +2715,7 @@
  * where <host> is a max of an (uncalculated) 63 chars.  Thanks to
  * trelane and #freenode for giving a hand here. */
 static void 
-irc_send_privmsg(struct gaim_connection *gc, char *who, char *what, gboolean fragment)
+irc_send_privmsg(struct gaim_connection *gc, const char *who, const char *what, gboolean fragment)
 {
 	char buf[IRC_BUF_LEN], *intl;
 	struct irc_data *id = gc->proto_data;
@@ -2738,7 +2737,7 @@
 }
 
 static void 
-irc_start_chat(struct gaim_connection *gc, char *who) {
+irc_start_chat(struct gaim_connection *gc, const char *who) {
 	struct dcc_chat *chat;
 	int len;
 	struct sockaddr_in addr;
@@ -2771,7 +2770,7 @@
 }
 
 static void 
-irc_get_info(struct gaim_connection *gc, char *who)
+irc_get_info(struct gaim_connection *gc, const char *who)
 {
 	struct irc_data *idata = gc->proto_data;
 	char buf[IRC_BUF_LEN];
@@ -2788,7 +2787,7 @@
 }
 
 static GList *
-irc_buddy_menu(struct gaim_connection *gc, char *who)
+irc_buddy_menu(struct gaim_connection *gc, const char *who)
 {
 	GList *m = NULL;
 	struct proto_buddy_menu *pbm;
--- a/src/protocols/jabber/jabber.c	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/protocols/jabber/jabber.c	Tue Apr 15 04:18:00 2003 +0000
@@ -1022,7 +1022,7 @@
 /*
  * Return pointer to jabber_buddy_data if buddy found.  Create if necessary.
  */
-static struct jabber_buddy_data* jabber_find_buddy(struct gaim_connection *gc, char *buddy, gboolean create)
+static struct jabber_buddy_data* jabber_find_buddy(struct gaim_connection *gc, const char *buddy, gboolean create)
 {
 	struct jabber_data *jd = gc->proto_data;
 	gpointer val;
@@ -1052,7 +1052,7 @@
  * default being the highest priority one.
  */
 
-static jab_res_info jabber_find_resource(struct gaim_connection *gc, char *who)
+static jab_res_info jabber_find_resource(struct gaim_connection *gc, const char *who)
 {
 	GSList *resources;
 	struct jabber_buddy_data *jbd = jabber_find_buddy(gc, who, FALSE);
@@ -1212,7 +1212,7 @@
 	}
 }
 
-static char *jabber_get_convo_thread(gjconn gjc, char *name)
+static char *jabber_get_convo_thread(gjconn gjc, const char *name)
 {
 	char *ct = NULL;
 	jab_res_info jri = jabber_find_resource(GJ_GC(gjc), name);
@@ -2443,7 +2443,7 @@
 	g_free(xhtml);
 }
 
-static int jabber_send_im(struct gaim_connection *gc, char *who, char *message, int len, int flags)
+static int jabber_send_im(struct gaim_connection *gc, const char *who, const char *message, int len, int flags)
 {
 	xmlnode x, y;
 	char *thread_id = NULL;
@@ -2686,7 +2686,7 @@
 /*
  * Unsubscribe a buddy from our presence
  */
-static void jabber_unsubscribe_buddy_from_us(struct gaim_connection *gc, char *name)
+static void jabber_unsubscribe_buddy_from_us(struct gaim_connection *gc, const char *name)
 {
 	gjconn gjc = ((struct jabber_data *)gc->proto_data)->gjc;
 	char *realwho;
@@ -2703,7 +2703,7 @@
 /*
  * Common code for setting ourselves invisible/visible to buddy
  */
-static void jabber_invisible_to_buddy_common(struct gaim_connection *gc, char *name, gboolean invisible)
+static void jabber_invisible_to_buddy_common(struct gaim_connection *gc, const char *name, gboolean invisible)
 {
 	gjconn gjc = ((struct jabber_data *)gc->proto_data)->gjc;
 	char *realwho;
@@ -2735,7 +2735,7 @@
 /*
  * Make ourselves temporarily invisible to a buddy
  */
-static void jabber_invisible_to_buddy(struct gaim_connection *gc, char *name)
+static void jabber_invisible_to_buddy(struct gaim_connection *gc, const char *name)
 {
 	jabber_invisible_to_buddy_common(gc, name, TRUE);
 }
@@ -2743,7 +2743,7 @@
 /*
  * Make ourselves visible to a buddy
  */
-static void jabber_visible_to_buddy(struct gaim_connection *gc, char *name)
+static void jabber_visible_to_buddy(struct gaim_connection *gc, const char *name)
 {
 	jabber_invisible_to_buddy_common(gc, name, FALSE);
 }
@@ -3103,7 +3103,7 @@
 	}
 }
 
-static void jabber_get_info(struct gaim_connection *gc, char *who) {
+static void jabber_get_info(struct gaim_connection *gc, const char *who) {
 	xmlnode x;
 	char *id;
 	char *realwho;
@@ -3128,7 +3128,7 @@
 	xmlnode_free(x);
 }
 
-static void jabber_get_error_msg(struct gaim_connection *gc, char *who) {
+static void jabber_get_error_msg(struct gaim_connection *gc, const char *who) {
 	struct jabber_data *jd = gc->proto_data;
 	gjconn gjc = jd->gjc;
 	gchar **str_arr = (gchar **) g_new(gpointer, 3);
@@ -3156,7 +3156,7 @@
 	g_free(final);
 }
 
-static void jabber_get_away_msg(struct gaim_connection *gc, char *who) {
+static void jabber_get_away_msg(struct gaim_connection *gc, const char *who) {
 	struct jabber_data *jd = gc->proto_data;
 	gjconn gjc = jd->gjc;
 	int num_resources;
@@ -3261,7 +3261,8 @@
 			g_free(stripped);
 			g_free(text);
 		}
-	} else if(jbd && (jbd->subscription & JABBER_SUB_PENDING ||
+	} else if(jbd && !GAIM_BUDDY_IS_ONLINE(b) &&
+			(jbd->subscription & JABBER_SUB_PENDING ||
 				!(jbd->subscription & JABBER_SUB_TO))) {
 		ret = g_strdup(_("<b>Status:</b> Not Authorized"));
 	}
@@ -3282,14 +3283,15 @@
 		}
 		ret = g_markup_escape_text(stripped, strlen(stripped));
 		g_free(stripped);
-	} else if(jbd && (jbd->subscription & JABBER_SUB_PENDING ||
+	} else if(jbd && !GAIM_BUDDY_IS_ONLINE(b) &&
+			(jbd->subscription & JABBER_SUB_PENDING ||
 				!(jbd->subscription & JABBER_SUB_TO))) {
 		ret = g_strdup(_("Not Authorized"));
 	}
 	return ret;
 }
 
-static GList *jabber_buddy_menu(struct gaim_connection *gc, char *who) {
+static GList *jabber_buddy_menu(struct gaim_connection *gc, const char *who) {
 	GList *m = NULL;
 	struct proto_buddy_menu *pbm;
 	struct buddy *b = gaim_find_buddy(gc->account, who);
@@ -3330,6 +3332,15 @@
 		pbm->callback = jabber_unsubscribe_buddy_from_us;
 		pbm->gc = gc;
 		m = g_list_append(m, pbm);
+
+		if(jbd && !GAIM_BUDDY_IS_ONLINE(b) &&
+				!(jbd->subscription & JABBER_SUB_TO)) {
+			pbm = g_new0(struct proto_buddy_menu, 1);
+			pbm->label = _("Re-request authorization");
+			pbm->callback = jabber_add_buddy;
+			pbm->gc = gc;
+			m = g_list_append(m, pbm);
+		}
 	}
 
 	return m;
--- a/src/protocols/msn/msn.c	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/protocols/msn/msn.c	Tue Apr 15 04:18:00 2003 +0000
@@ -1416,7 +1416,7 @@
 }
 #endif
 
-static int msn_send_im(struct gaim_connection *gc, char *who, char *message, int len, int flags)
+static int msn_send_im(struct gaim_connection *gc, const char *who, const char *message, int len, int flags)
 {
 	struct msn_data *md = gc->proto_data;
 	struct msn_switchboard *ms = msn_find_switch(gc, who);
@@ -1649,7 +1649,7 @@
 	return NULL;
 }
 
-static GList *msn_buddy_menu(struct gaim_connection *gc, char *who)
+static GList *msn_buddy_menu(struct gaim_connection *gc, const char *who)
 {
 	GList *m = NULL;
 #if 0
--- a/src/protocols/napster/napster.c	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/protocols/napster/napster.c	Tue Apr 15 04:18:00 2003 +0000
@@ -87,7 +87,7 @@
 	write(ndata->fd, message, size);
 }
 
-static int nap_send_im(struct gaim_connection *gc, char *who, char *message, int len, int flags)
+static int nap_send_im(struct gaim_connection *gc, const char *who, const char *message, int len, int flags)
 {
 	gchar buf[NAP_BUF_LEN];
 
--- a/src/protocols/oscar/oscar.c	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Tue Apr 15 04:18:00 2003 +0000
@@ -1064,7 +1064,7 @@
 	return NULL;
 }
 
-static void oscar_ask_sendfile(struct gaim_connection *gc, char *destsn) {
+static void oscar_ask_sendfile(struct gaim_connection *gc, const char *destsn) {
 	struct oscar_data *od = (struct oscar_data *)gc->proto_data;
 
 	/* You want to send a file to someone else, you're so generous */
@@ -2443,7 +2443,7 @@
 	gaim_free_name_data(data);
 }
 
-static void gaim_auth_sendrequest(struct gaim_connection *gc, char *name) {
+static void gaim_auth_sendrequest(struct gaim_connection *gc, const char *name) {
 	struct name_data *data = g_new(struct name_data, 1);
 	struct buddy *buddy;
 	gchar *dialog_msg, *nombre;
@@ -4157,9 +4157,9 @@
 	}
 	return 0;
 }
-static void oscar_ask_direct_im(struct gaim_connection *gc, char *name);
-
-static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, int len, int imflags) {
+static void oscar_ask_direct_im(struct gaim_connection *gc, const char *name);
+
+static int oscar_send_im(struct gaim_connection *gc, const char *name, const char *message, int len, int imflags) {
 	struct oscar_data *od = (struct oscar_data *)gc->proto_data;
 	struct direct_im *dim = find_direct_im(od, name);
 	int ret = 0;
@@ -4282,7 +4282,7 @@
 	return ret;
 }
 
-static void oscar_get_info(struct gaim_connection *g, char *name) {
+static void oscar_get_info(struct gaim_connection *g, const char *name) {
 	struct oscar_data *od = (struct oscar_data *)g->proto_data;
 	if (od->icq)
 		aim_icq_getallinfo(od->sess, name);
@@ -4293,7 +4293,7 @@
 		aim_getinfo(od->sess, od->conn, name, AIM_GETINFO_AWAYMESSAGE);
 }
 
-static void oscar_get_away(struct gaim_connection *g, char *who) {
+static void oscar_get_away(struct gaim_connection *g, const char *who) {
 	struct oscar_data *od = (struct oscar_data *)g->proto_data;
 	if (od->icq) {
 		struct buddy *budlight = gaim_find_buddy(g->account, who);
@@ -5425,6 +5425,7 @@
 };
 
 static void oscar_cancel_direct_im(struct ask_do_dir_im *data) {
+	g_free(data->who);
 	g_free(data);
 }
 
@@ -5434,6 +5435,7 @@
 	struct direct_im *dim;
 
 	if (!g_slist_find(connections, gc)) {
+		g_free(data->who);
 		g_free(data);
 		return;
 	}
@@ -5449,6 +5451,7 @@
 			debug_printf("Gave up on old direct IM, trying again\n");
 		} else {
 			do_error_dialog("DirectIM already open.", NULL, GAIM_ERROR);
+			g_free(data->who);
 			g_free(data);
 			return;
 		}
@@ -5469,13 +5472,14 @@
 		g_free(dim);
 	}
 
+	g_free(data->who);
 	g_free(data);
 }
 
-static void oscar_ask_direct_im(struct gaim_connection *gc, gchar *who) {
+static void oscar_ask_direct_im(struct gaim_connection *gc, const char *who) {
 	char buf[BUF_LONG];
 	struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1);
-	data->who = who;
+	data->who = g_strdup(who);
 	data->gc = gc;
 	g_snprintf(buf, sizeof(buf),  _("You have selected to open a Direct IM connection with %s."), who);
 	do_ask_dialog(buf, _("Because this reveals your IP address, it may be considered a privacy risk.  Do you wish to continue?"), data, _("Connect"), oscar_direct_im, _("Cancel"), oscar_cancel_direct_im, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE);
@@ -5608,7 +5612,7 @@
 	return m;
 }
 
-static GList *oscar_buddy_menu(struct gaim_connection *gc, char *who) {
+static GList *oscar_buddy_menu(struct gaim_connection *gc, const char *who) {
 	struct oscar_data *od = gc->proto_data;
 	GList *m = NULL;
 	struct proto_buddy_menu *pbm;
--- a/src/protocols/toc/toc.c	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/protocols/toc/toc.c	Tue Apr 15 04:18:00 2003 +0000
@@ -1014,7 +1014,7 @@
 	}
 }
 
-static int toc_send_im(struct gaim_connection *gc, char *name, char *message, int len, int flags)
+static int toc_send_im(struct gaim_connection *gc, const char *name, const char *message, int len, int flags)
 {
 	char buf[BUF_LEN * 2];
 	char *tmp = g_malloc(strlen(message) * 4 + 1); /* 4 because \n gets replaced with <BR> */
@@ -1042,14 +1042,14 @@
 	g_free(buf);
 }
 
-static void toc_get_info(struct gaim_connection *g, char *name)
+static void toc_get_info(struct gaim_connection *g, const char *name)
 {
 	char buf[BUF_LEN * 2];
 	g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name));
 	sflap_send(g, buf, -1, TYPE_DATA);
 }
 
-static void toc_get_dir(struct gaim_connection *g, char *name)
+static void toc_get_dir(struct gaim_connection *g, const char *name)
 {
 	char buf[BUF_LEN * 2];
 	g_snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name));
@@ -1307,7 +1307,7 @@
 	*ne = emblems[3];
 }
 
-static GList *toc_buddy_menu(struct gaim_connection *gc, char *who)
+static GList *toc_buddy_menu(struct gaim_connection *gc, const char *who)
 {
 	GList *m = NULL;
 	struct proto_buddy_menu *pbm;
--- a/src/protocols/yahoo/yahoo.c	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/protocols/yahoo/yahoo.c	Tue Apr 15 04:18:00 2003 +0000
@@ -1067,7 +1067,7 @@
 	}
 }
 
-static void yahoo_game(struct gaim_connection *gc, char *name) {
+static void yahoo_game(struct gaim_connection *gc, const char *name) {
 	struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
 	char *game = g_hash_table_lookup(yd->games, name);
 	char *t;
@@ -1123,7 +1123,7 @@
 	return NULL;
 }
 
-static GList *yahoo_buddy_menu(struct gaim_connection *gc, char *who)
+static GList *yahoo_buddy_menu(struct gaim_connection *gc, const char *who)
 {
 	GList *m = NULL;
 	struct proto_buddy_menu *pbm;
@@ -1190,7 +1190,7 @@
 	return m;
 }
 
-static int yahoo_send_im(struct gaim_connection *gc, char *who, char *what, int len, int flags)
+static int yahoo_send_im(struct gaim_connection *gc, const char *who, const char *what, int len, int flags)
 {
 	struct yahoo_data *yd = gc->proto_data;
 	struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0);
--- a/src/protocols/zephyr/Zinternal.c	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/protocols/zephyr/Zinternal.c	Tue Apr 15 04:18:00 2003 +0000
@@ -4,7 +4,7 @@
  *	Created by:	Robert French
  *
  *	$Source$
- *	$Author: warmenhoven $
+ *	$Author: faceprint $
  *
  *	Copyright (c) 1987,1988,1991 by the Massachusetts Institute of
  *	Technology.
@@ -20,7 +20,7 @@
 
 #ifndef lint
 static const char rcsid_Zinternal_c[] =
-  "$Id: Zinternal.c 2432 2001-10-03 19:38:28Z warmenhoven $";
+  "$Id: Zinternal.c 5500 2003-04-15 04:18:00Z faceprint $";
 static const char copyright[] =
   "Copyright (c) 1987,1988,1991 by the Massachusetts Institute of Technology.";
 #endif
@@ -58,7 +58,7 @@
 
 #define min(a,b) ((a)<(b)?(a):(b))
 
-static int Z_AddField __P((char **ptr, char *field, char *end));
+static int Z_AddField __P((char **ptr, const char *field, char *end));
 static int find_or_insert_uid __P((ZUnique_Id_t *uid, ZNotice_Kind_t kind));
 
 /* Find or insert uid in the old uids buffer.  The buffer is a sorted
@@ -754,8 +754,7 @@
 }
 
 static int
-Z_AddField(ptr, field, end)
-    char **ptr, *field, *end;
+Z_AddField(char **ptr, const char *field, char *end)
 {
     register int len;
 
--- a/src/protocols/zephyr/zephyr.c	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/protocols/zephyr/zephyr.c	Tue Apr 15 04:18:00 2003 +0000
@@ -779,7 +779,7 @@
 	return 0;
 }
 
-static int zephyr_send_im(struct gaim_connection *gc, char *who, char *im, int len, int flags) {
+static int zephyr_send_im(struct gaim_connection *gc, const char *who, const char *im, int len, int flags) {
 	ZNotice_t notice;
 	char *buf;
 	const char *sig;
@@ -808,7 +808,6 @@
 		"From: @bold($1) <$sender>\n\n$2";
 	notice.z_message_len = strlen(im) + strlen(sig) + 4;
 	notice.z_message = buf;
-	ZSendNotice(&notice, ZAUTH);
 	g_free(buf);
 	return 1;
 }
@@ -824,7 +823,7 @@
 	return buf;
 }
 
-static void zephyr_zloc(struct gaim_connection *gc, char *who)
+static void zephyr_zloc(struct gaim_connection *gc, const char *who)
 {
 	ZAsyncLocateData_t ald;
 	
@@ -836,7 +835,7 @@
 					g_strdup(zephyr_normalize(who)));
 }
 
-static GList *zephyr_buddy_menu(struct gaim_connection *gc, char *who)
+static GList *zephyr_buddy_menu(struct gaim_connection *gc, const char *who)
 {
 	GList *m = NULL;
 	struct proto_buddy_menu *pbm;
--- a/src/protocols/zephyr/zephyr.h	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/protocols/zephyr/zephyr.h	Tue Apr 15 04:18:00 2003 +0000
@@ -4,8 +4,8 @@
  *	Created by:	Robert French
  *
  *	$Source$
- *	$Author: warmenhoven $
- *	$Id: zephyr.h 2432 2001-10-03 19:38:28Z warmenhoven $
+ *	$Author: faceprint $
+ *	$Id: zephyr.h 5500 2003-04-15 04:18:00Z faceprint $
  *
  *	Copyright (c) 1987,1988,1991 by the Massachusetts Institute of
  *	Technology. For copying and distribution information, see the
@@ -92,7 +92,7 @@
     char		*z_class_inst;
     char		*z_opcode;
     char		*z_sender;
-    char		*z_recipient;
+    const char		*z_recipient;
     char		*z_default_format;
     char		*z_multinotice;
     ZUnique_Id_t	z_multiuid;
--- a/src/prpl.h	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/prpl.h	Tue Apr 15 04:18:00 2003 +0000
@@ -208,7 +208,7 @@
 	GList *user_splits;
 	/* user_opts is a GList* of g_malloc'd struct proto_user_opts */
 	GList *user_opts;
-	GList *(* buddy_menu)(struct gaim_connection *, char *);
+	GList *(* buddy_menu)(struct gaim_connection *, const char *);
 	GList *(* chat_info)(struct gaim_connection *);
 
 	/* All the server-related functions */
@@ -222,13 +222,13 @@
 	 */
 	void (* login)		(struct gaim_account *);
 	void (* close)		(struct gaim_connection *);
-	int  (* send_im)	(struct gaim_connection *, char *who, char *message,
+	int  (* send_im)	(struct gaim_connection *, const char *who, const char *message,
 						 int len, int away);
 	void (* set_info)	(struct gaim_connection *, char *info);
 	int  (* send_typing)    (struct gaim_connection *, char *name, int typing);
-	void (* get_info)	(struct gaim_connection *, char *who);
+	void (* get_info)	(struct gaim_connection *, const char *who);
 	void (* set_away)	(struct gaim_connection *, char *state, char *message);
-	void (* get_away)       (struct gaim_connection *, char *who);
+	void (* get_away)       (struct gaim_connection *, const char *who);
 	void (* set_dir)	(struct gaim_connection *, const char *first,
 							   const char *middle,
 							   const char *last,
@@ -237,7 +237,7 @@
 							   const char *state,
 							   const char *country,
 							   int web);
-	void (* get_dir)	(struct gaim_connection *, char *who);
+	void (* get_dir)	(struct gaim_connection *, const char *who);
 	void (* dir_search)	(struct gaim_connection *, const char *first,
 							   const char *middle,
 							   const char *last,
--- a/src/server.c	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/server.c	Tue Apr 15 04:18:00 2003 +0000
@@ -204,7 +204,7 @@
 		g->prpl->get_info(g, name);
 }
 
-void serv_get_away(struct gaim_connection *g, char *name)
+void serv_get_away(struct gaim_connection *g, const char *name)
 {
 	if (g && g->prpl && g->prpl->get_away)
 		g->prpl->get_away(g, name);
@@ -557,7 +557,7 @@
  * woo. i'm actually going to comment this function. isn't that fun. make
  * sure to follow along, kids
  */
-void serv_got_im(struct gaim_connection *gc, char *name, char *message,
+void serv_got_im(struct gaim_connection *gc, const char *who, const char *msg,
 				 guint32 flags, time_t mtime, gint len)
 {
 	char *buffy;
@@ -567,6 +567,8 @@
 
 	struct gaim_conversation *cnv;
 
+	char *message, *name;
+
 	/*
 	 * Pay no attention to the man behind the curtain.
 	 *
@@ -579,13 +581,13 @@
 	 */
 
 	if (flags & IM_FLAG_GAIMUSER)
-		debug_printf("%s is a gaim user.\n", name);
+		debug_printf("%s is a gaim user.\n", who);
 
 	/*
 	 * We should update the conversation window buttons and menu,
 	 * if it exists.
 	 */
-	cnv = gaim_find_conversation_with_account(name, gc->account);
+	cnv = gaim_find_conversation_with_account(who, gc->account);
 
 	/*
 	 * Plugin stuff. we pass a char ** but we don't want to pass what's
@@ -595,9 +597,9 @@
 	 * I really don't want you to be dealing with it.
 	 */
 	if (len < 0) {
-		buffy = g_malloc(MAX(strlen(message) + 1, BUF_LONG));
-		strcpy(buffy, message);
-		angel = g_strdup(name);
+		buffy = g_malloc(MAX(strlen(msg) + 1, BUF_LONG));
+		strcpy(buffy, msg);
+		angel = g_strdup(who);
 		plugin_return = plugin_event(event_im_recv, gc, &angel, &buffy, &flags);
 
 		if (!buffy || !angel || plugin_return) {
@@ -610,8 +612,8 @@
 		name = angel;
 		message = buffy;
 	} else {
-		name = g_strdup(name);
-		message = g_memdup(message, len);
+		name = g_strdup(who);
+		message = g_memdup(msg, len);
 	}
 
 #if 0
@@ -638,8 +640,11 @@
 	 * If you can't figure this out, stop reading right now.
 	 * "We're not worthy! We're not worthy!"
 	 */
-	if ((len < 0) && (convo_options & OPT_CONVO_SEND_LINKS))
-		linkify_text(message);
+	if ((len < 0) && (convo_options & OPT_CONVO_SEND_LINKS)) {
+		buffy = linkify_text(message);
+		g_free(message);
+		message = buffy;
+	}
 
 	/*
 	 * Um. When we call gaim_conversation_write with the message we received,
@@ -687,7 +692,7 @@
 			gchar path[10];
 
 			qm = g_new0(struct queued_message, 1);
-				g_snprintf(qm->name, sizeof(qm->name), "%s", name);
+			g_snprintf(qm->name, sizeof(qm->name), "%s", name);
 			qm->message = g_memdup(message, len == -1 ? strlen(message) + 1 : len);
 			qm->account = gc->account;
 			qm->tm = mtime;
@@ -1188,11 +1193,15 @@
 	who = angel;
 	message = buffy;
 
+
+
 	buf = g_malloc(MAX(strlen(message) * 2, 8192));
 	strcpy(buf, message);
 
 	if (convo_options & OPT_CONVO_SEND_LINKS)
-		linkify_text(buf);
+		buf = linkify_text(message);
+	else
+		buf = g_strdup(message);
 
 	if (whisper)
 		w = WFLAG_WHISPER;
--- a/src/util.c	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/util.c	Tue Apr 15 04:18:00 2003 +0000
@@ -137,17 +137,15 @@
 	return ret;
 }
 
-gint linkify_text(char *text)
+char *linkify_text(const char *text)
 {
-	char *c, *t, *q = NULL;
-	char *cpy = g_malloc(strlen(text) * 3 + 1);
+	const char *c, *t, *q = NULL;
+	char *tmp;
 	char url_buf[BUF_LEN * 4];
-	int cnt = 0;
+	GString *ret = g_string_new("");
 	/* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
 
-	strncpy(cpy, text, strlen(text));
-	cpy[strlen(text)] = 0;
-	c = cpy;
+	c = text;
 	while (*c) {
 		if(!q && (*c == '\"' || *c == '\'')) {
 			q = c;
@@ -159,12 +157,13 @@
 				if (!g_ascii_strncasecmp(c, "/A>", 3)) {
 					break;
 				}
-				text[cnt++] = *c;
+				ret = g_string_append_c(ret, *c);
 				c++;
 				if (!(*c))
 					break;
 			}
-		} else if ((*c=='h') && (!g_ascii_strncasecmp(c, "http://", 7) || (!g_ascii_strncasecmp(c, "https://", 8)))) {
+		} else if ((*c=='h') && (!g_ascii_strncasecmp(c, "http://", 7) ||
+					(!g_ascii_strncasecmp(c, "https://", 8)))) {
 			t = c;
 			while (1) {
 				if (badchar(*t)) {
@@ -178,8 +177,8 @@
 						t--;
 					strncpy(url_buf, c, t - c);
 					url_buf[t - c] = 0;
-					cnt += g_snprintf(&text[cnt], 1024, "<A HREF=\"%s\">%s</A>",
-							  url_buf, url_buf);
+					g_string_append_printf(ret, "<A HREF=\"%s\">%s</A>",
+							url_buf, url_buf);
 					c = t;
 					break;
 				}
@@ -206,9 +205,9 @@
 							t--;
 						strncpy(url_buf, c, t - c);
 						url_buf[t - c] = 0;
-						cnt += g_snprintf(&text[cnt], 1024,
-								 "<A HREF=\"http://%s\">%s</A>", url_buf,
-								 url_buf);
+						g_string_append_printf(ret,
+								"<A HREF=\"http://%s\">%s</A>", url_buf,
+								url_buf);
 						c = t;
 						break;
 					}
@@ -225,8 +224,8 @@
 						t--;
 					strncpy(url_buf, c, t - c);
 					url_buf[t - c] = 0;
-					cnt += g_snprintf(&text[cnt], 1024, "<A HREF=\"%s\">%s</A>",
-							  url_buf, url_buf);
+					g_string_append_printf(ret, "<A HREF=\"%s\">%s</A>",
+							url_buf, url_buf);
 					c = t;
 					break;
 				}
@@ -247,9 +246,9 @@
 							t--;
 						strncpy(url_buf, c, t - c);
 						url_buf[t - c] = 0;
-						cnt += g_snprintf(&text[cnt], 1024,
-								  "<A HREF=\"ftp://%s\">%s</A>", url_buf,
-								  url_buf);
+						g_string_append_printf(ret,
+								"<A HREF=\"ftp://%s\">%s</A>", url_buf,
+								url_buf);
 						c = t;
 						break;
 					}
@@ -266,7 +265,7 @@
 						t--;
 					strncpy(url_buf, c, t - c);
 					url_buf[t - c] = 0;
-					cnt += g_snprintf(&text[cnt], 1024, "<A HREF=\"%s\">%s</A>",
+					g_string_append_printf(ret, "<A HREF=\"%s\">%s</A>",
 							  url_buf, url_buf);
 					c = t;
 					break;
@@ -276,7 +275,7 @@
 				t++;
 
 			}
-		} else if (c != cpy && (*c == '@')) {
+		} else if (c != text && (*c == '@')) {
 			char *tmp;
 			int flag;
 			int len = 0;
@@ -291,7 +290,7 @@
 			t = c;
 			while (flag) {
 				if (badchar(*t)) {
-					cnt -= (len - 1);
+					ret = g_string_truncate(ret, ret->len - (len - 1));
 					break;
 				} else {
 					len++;
@@ -303,8 +302,8 @@
 					url_buf[len] = 0;
 					g_free(tmp);
 					t--;
-					if (t < cpy) {
-						cnt = 0;
+					if (t < text) {
+						ret = g_string_assign(ret, "");
 						break;
 					}
 				}
@@ -319,12 +318,8 @@
 					for (d = url_buf + strlen(url_buf) - 1; *d == '.'; d--, t--)
 						*d = '\0';
 
-					cnt += g_snprintf(&text[cnt], 1024,
-							  "<A HREF=\"mailto:%s\">%s</A>", url_buf,
-							  url_buf);
-					text[cnt] = 0;
-
-
+					g_string_append_printf(ret, "<A HREF=\"mailto:%s\">%s</A>",
+							url_buf, url_buf);
 					c = t;
 
 					break;
@@ -341,13 +336,13 @@
 		if (*c == 0)
 			break;
 
-		text[cnt++] = *c;
+		ret = g_string_append_c(ret, *c);
 		c++;
 
 	}
-	text[cnt] = 0;
-	g_free(cpy);
-	return cnt;
+	tmp = ret->str;
+	g_string_free(ret, FALSE);
+	return tmp;
 }
 
 
@@ -892,7 +887,7 @@
 	g_free(text2);
 }
 
-char *add_cr(char *text)
+char *add_cr(const char *text)
 {
 	char *ret = NULL;
 	int count = 0, i, j;
--- a/src/util.h	Tue Apr 15 03:45:31 2003 +0000
+++ b/src/util.h	Tue Apr 15 04:18:00 2003 +0000
@@ -106,13 +106,11 @@
 /**
  * Adds the necessary HTML code to turn URIs into HTML links in a string.
  *
- * The string passed must be able to store at least BUF_LEN * 2 bytes.
+ * @param str The string to linkify.
  *
- * @param str The string to linkify.
- * 
- * @return The length of the new string.
+ * @return The linkified text.
  */
-gint linkify_text(char *str);
+char *linkify_text(const char *str);
 
 /**
  * Converts seconds into a human-readable form.
@@ -247,7 +245,7 @@
  *
  * @return The string with carriage returns.
  */
-char *add_cr(char *);
+char *add_cr(const char *);
 
 /**
  * Strips all linefeeds from a string.