diff libpurple/protocols/silc/ops.c @ 32724:44fc11beefab

propagate from branch 'im.pidgin.pidgin.2.x.y' (head b9c74c3f836a7a1a64710fc8244c9ec1f3f21b97) to branch 'im.pidgin.pidgin' (head fcd1b3766ec3998ed589bfddde2bffefd9d99e65)
author Mark Doliner <mark@kingant.net>
date Wed, 05 Oct 2011 07:33:20 +0000
parents d9d33a4b5632 3899615cef8a
children
line wrap: on
line diff
--- a/libpurple/protocols/silc/ops.c	Tue Oct 04 18:34:45 2011 +0000
+++ b/libpurple/protocols/silc/ops.c	Wed Oct 05 07:33:20 2011 +0000
@@ -72,7 +72,7 @@
 		gc = client->application;
 
 	if (gc != NULL)
-		purple_connection_error_reason(gc, reason, tmp);
+		purple_connection_error(gc, reason, tmp);
 	else
 		purple_notify_error(NULL, _("Error"), _("Error occurred"), tmp);
 }
@@ -88,7 +88,7 @@
 			gboolean recursive)
 {
 	PurpleConnection *gc = client->application;
-	SilcPurple sg = gc->proto_data;
+	SilcPurple sg = purple_connection_get_protocol_data(gc);
 	const char *type;
 	const unsigned char *data;
 	SilcUInt32 data_len;
@@ -264,7 +264,7 @@
 		     SilcUInt32 message_len)
 {
 	PurpleConnection *gc = client->application;
-	SilcPurple sg = gc->proto_data;
+	SilcPurple sg = purple_connection_get_protocol_data(gc);
 	PurpleConversation *convo = NULL;
 	char *msg, *tmp;
 
@@ -354,7 +354,7 @@
 		     SilcUInt32 message_len)
 {
 	PurpleConnection *gc = client->application;
-	SilcPurple sg = gc->proto_data;
+	SilcPurple sg = purple_connection_get_protocol_data(gc);
 	PurpleConversation *convo = NULL;
 	char *msg, *tmp;
 
@@ -438,7 +438,7 @@
 {
 	va_list va;
 	PurpleConnection *gc = client->application;
-	SilcPurple sg = gc->proto_data;
+	SilcPurple sg = purple_connection_get_protocol_data(gc);
 	PurpleAccount *account = purple_connection_get_account(gc);
 	PurpleConversation *convo;
 	SilcClientEntry client_entry, client_entry2;
@@ -948,7 +948,7 @@
 	     SilcUInt32 argc, unsigned char **argv)
 {
 	PurpleConnection *gc = client->application;
-	SilcPurple sg = gc->proto_data;
+	SilcPurple sg = purple_connection_get_protocol_data(gc);
 
 	switch (command) {
 
@@ -1085,7 +1085,7 @@
 		   SilcStatus error, va_list ap)
 {
 	PurpleConnection *gc = client->application;
-	SilcPurple sg = gc->proto_data;
+	SilcPurple sg = purple_connection_get_protocol_data(gc);
 	PurpleConversation *convo;
 
 	switch (command) {
@@ -1169,7 +1169,7 @@
 			SilcUInt32 idle, *user_modes;
 			SilcDList channels;
 			SilcClientEntry client_entry;
-			char tmp[1024], *tmp2;
+			char tmp[1024];
 			char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr;
 			PurpleNotifyUserInfo *user_info;
 
@@ -1191,71 +1191,80 @@
 			user_modes = va_arg(ap, SilcUInt32 *);
 
 			user_info = purple_notify_user_info_new();
-			tmp2 = g_markup_escape_text(client_entry->nickname, -1);
-			purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp2);
-			g_free(tmp2);
+			purple_notify_user_info_add_pair_plaintext(user_info, _("Nickname"), client_entry->nickname);
 			if (client_entry->realname) {
-				tmp2 = g_markup_escape_text(client_entry->realname, -1);
-				purple_notify_user_info_add_pair(user_info, _("Real Name"), tmp2);
-				g_free(tmp2);
+				purple_notify_user_info_add_pair_plaintext(user_info, _("Real Name"), client_entry->realname);
 			}
-			tmp2 = g_markup_escape_text(client_entry->username, -1);
 			if (*client_entry->hostname) {
-				gchar *tmp3;
-				tmp3 = g_strdup_printf("%s@%s", tmp2, client_entry->hostname);
-				purple_notify_user_info_add_pair(user_info, _("Username"), tmp3);
-				g_free(tmp3);
+				gchar *tmp2;
+				tmp2 = g_strdup_printf("%s@%s", client_entry->username, client_entry->hostname);
+				purple_notify_user_info_add_pair_plaintext(user_info, _("Username"), tmp2);
+				g_free(tmp2);
 			} else
-				purple_notify_user_info_add_pair(user_info, _("Username"), tmp2);
-			g_free(tmp2);
+				purple_notify_user_info_add_pair_plaintext(user_info, _("Username"), client_entry->username);
 
 			if (client_entry->mode) {
 				memset(tmp, 0, sizeof(tmp));
 				silcpurple_get_umode_string(client_entry->mode,
 							    tmp, sizeof(tmp) - strlen(tmp));
-				purple_notify_user_info_add_pair(user_info, _("User Modes"), tmp);
+				/* TODO: Check whether it's correct to call add_pair_html,
+				         or if we should be using add_pair_plaintext */
+				purple_notify_user_info_add_pair_html(user_info, _("User Modes"), tmp);
 			}
 
 			silcpurple_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr);
 			if (moodstr) {
-				purple_notify_user_info_add_pair(user_info, _("Mood"), moodstr);
+				/* TODO: Check whether it's correct to call add_pair_html,
+				         or if we should be using add_pair_plaintext */
+				purple_notify_user_info_add_pair_html(user_info, _("Mood"), moodstr);
 				g_free(moodstr);
 			}
 
 			if (statusstr) {
-				tmp2 = g_markup_escape_text(statusstr, -1);
-				purple_notify_user_info_add_pair(user_info, _("Status Text"), tmp2);
+				purple_notify_user_info_add_pair_plaintext(user_info, _("Status Text"), statusstr);
 				g_free(statusstr);
-				g_free(tmp2);
 			}
 
 			if (contactstr) {
-				purple_notify_user_info_add_pair(user_info, _("Preferred Contact"), contactstr);
+				/* TODO: Check whether it's correct to call add_pair_html,
+				         or if we should be using add_pair_plaintext */
+				purple_notify_user_info_add_pair_html(user_info, _("Preferred Contact"), contactstr);
 				g_free(contactstr);
 			}
 
 			if (langstr) {
-				purple_notify_user_info_add_pair(user_info, _("Preferred Language"), langstr);
+				/* TODO: Check whether it's correct to call add_pair_html,
+				         or if we should be using add_pair_plaintext */
+				purple_notify_user_info_add_pair_html(user_info, _("Preferred Language"), langstr);
 				g_free(langstr);
 			}
 
 			if (devicestr) {
-				purple_notify_user_info_add_pair(user_info, _("Device"), devicestr);
+				/* TODO: Check whether it's correct to call add_pair_html,
+				         or if we should be using add_pair_plaintext */
+				purple_notify_user_info_add_pair_html(user_info, _("Device"), devicestr);
 				g_free(devicestr);
 			}
 
 			if (tzstr) {
-				purple_notify_user_info_add_pair(user_info, _("Timezone"), tzstr);
+				/* TODO: Check whether it's correct to call add_pair_html,
+				         or if we should be using add_pair_plaintext */
+				purple_notify_user_info_add_pair_html(user_info, _("Timezone"), tzstr);
 				g_free(tzstr);
 			}
 
 			if (geostr) {
-				purple_notify_user_info_add_pair(user_info, _("Geolocation"), geostr);
+				/* TODO: Check whether it's correct to call add_pair_html,
+				         or if we should be using add_pair_plaintext */
+				purple_notify_user_info_add_pair_html(user_info, _("Geolocation"), geostr);
 				g_free(geostr);
 			}
 
-			if (*client_entry->server)
-				purple_notify_user_info_add_pair(user_info, _("Server"), client_entry->server);
+			if (*client_entry->server) {
+				/* TODO: Check whether it's correct to call add_pair_html,
+				         or if we should be using add_pair_plaintext */
+				purple_notify_user_info_add_pair_html(user_info, _("Server"), client_entry->server);
+			}
 
 			if (channels && user_modes) {
 				SilcChannelPayload entry;
@@ -1273,9 +1282,7 @@
 					silc_strncat(tmp, sizeof(tmp) - 1, "  ", 1);
 					silc_free(m);
 				}
-				tmp2 = g_markup_escape_text(tmp, -1);
-				purple_notify_user_info_add_pair(user_info, _("Currently on"), tmp2);
-				g_free(tmp2);
+				purple_notify_user_info_add_pair_plaintext(user_info, _("Currently on"), tmp);
 			}
 
 			if (client_entry->public_key) {
@@ -1286,8 +1293,8 @@
 				if (pk) {
 					fingerprint = silc_hash_fingerprint(NULL, pk, pk_len);
 					babbleprint = silc_hash_babbleprint(NULL, pk, pk_len);
-					purple_notify_user_info_add_pair(user_info, _("Public Key Fingerprint"), fingerprint);
-					purple_notify_user_info_add_pair(user_info, _("Public Key Babbleprint"), babbleprint);
+					purple_notify_user_info_add_pair_plaintext(user_info, _("Public Key Fingerprint"), fingerprint);
+					purple_notify_user_info_add_pair_plaintext(user_info, _("Public Key Babbleprint"), babbleprint);
 					silc_free(fingerprint);
 					silc_free(babbleprint);
 					silc_free(pk);
@@ -1311,7 +1318,7 @@
 	case SILC_COMMAND_WHOWAS:
 		{
 			SilcClientEntry client_entry;
-			char *nickname, *realname, *username, *tmp;
+			char *nickname, *realname, *username;
 			PurpleNotifyUserInfo *user_info;
 
 			if (status != SILC_STATUS_OK) {
@@ -1329,27 +1336,23 @@
 				break;
 
 			user_info = purple_notify_user_info_new();
-			tmp = g_markup_escape_text(nickname, -1);
-			purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp);
-			g_free(tmp);
-			if (realname) {
-				tmp = g_markup_escape_text(realname, -1);
-				purple_notify_user_info_add_pair(user_info, _("Real Name"), tmp);
-				g_free(tmp);
-			}
+			purple_notify_user_info_add_pair_plaintext(user_info, _("Nickname"), nickname);
+			if (realname)
+				purple_notify_user_info_add_pair_plaintext(user_info, _("Real Name"), realname);
 			if (username) {
-				tmp = g_markup_escape_text(username, -1);
 				if (client_entry && *client_entry->hostname) {
-					gchar *tmp3;
-					tmp3 = g_strdup_printf("%s@%s", tmp, client_entry->hostname);
-					purple_notify_user_info_add_pair(user_info, _("Username"), tmp3);
-					g_free(tmp3);
+					gchar *tmp;
+					tmp = g_strdup_printf("%s@%s", username, client_entry->hostname);
+					purple_notify_user_info_add_pair_plaintext(user_info, _("Username"), tmp);
+					g_free(tmp);
 				} else
-					purple_notify_user_info_add_pair(user_info, _("Username"), tmp);
-				g_free(tmp);
+					purple_notify_user_info_add_pair_plaintext(user_info, _("Username"), username);
 			}
-			if (client_entry && *client_entry->server)
-				purple_notify_user_info_add_pair(user_info, _("Server"), client_entry->server);
+			if (client_entry && *client_entry->server) {
+				/* TODO: Check whether it's correct to call add_pair_html,
+				         or if we should be using add_pair_plaintext */
+				purple_notify_user_info_add_pair_html(user_info, _("Server"), client_entry->server);
+			}
 
 
 			if (client_entry && client_entry->public_key) {
@@ -1360,8 +1363,8 @@
 				if (pk) {
 					fingerprint = silc_hash_fingerprint(NULL, pk, pk_len);
 					babbleprint = silc_hash_babbleprint(NULL, pk, pk_len);
-					purple_notify_user_info_add_pair(user_info, _("Public Key Fingerprint"), fingerprint);
-					purple_notify_user_info_add_pair(user_info, _("Public Key Babbleprint"), babbleprint);
+					purple_notify_user_info_add_pair_plaintext(user_info, _("Public Key Fingerprint"), fingerprint);
+					purple_notify_user_info_add_pair_plaintext(user_info, _("Public Key Babbleprint"), babbleprint);
 					silc_free(fingerprint);
 					silc_free(babbleprint);
 					silc_free(pk);
@@ -1728,7 +1731,7 @@
 		     SilcGetAuthMeth completion, void *context)
 {
 	PurpleConnection *gc = client->application;
-	SilcPurple sg = gc->proto_data;
+	SilcPurple sg = purple_connection_get_protocol_data(gc);
 	SilcPurpleAskPassphrase internal;
 	const char *password;
 
@@ -1779,7 +1782,7 @@
 		       SilcVerifyPublicKey completion, void *context)
 {
 	PurpleConnection *gc = client->application;
-	SilcPurple sg = gc->proto_data;
+	SilcPurple sg = purple_connection_get_protocol_data(gc);
 
 	if (!sg->conn && (conn_type == SILC_CONN_SERVER ||
 			  conn_type == SILC_CONN_ROUTER)) {