changeset 29428:cc1e35fa774d

Deprecate purple_request_field_list_add()
author Richard Laager <rlaager@wiktel.com>
date Sun, 16 Nov 2008 10:33:36 +0000
parents 50dbd779f1bb
children aa14863fc969
files finch/gntplugin.c finch/gntprefs.c finch/plugins/gnthistory.c libpurple/plugins/perl/common/Request.xs libpurple/protocols/gg/gg.c libpurple/protocols/gg/gg.h libpurple/protocols/jabber/xdata.c libpurple/protocols/sametime/sametime.c libpurple/protocols/silc/buddy.c libpurple/protocols/silc/chat.c libpurple/protocols/silc10/buddy.c libpurple/protocols/silc10/chat.c libpurple/request.c libpurple/request.h
diffstat 14 files changed, 31 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntplugin.c	Sun Nov 16 10:10:17 2008 +0000
+++ b/finch/gntplugin.c	Sun Nov 16 10:33:36 2008 +0000
@@ -496,7 +496,7 @@
 						break;
 				}
 				stringlist = g_list_prepend(stringlist, value);
-				purple_request_field_list_add(field, label, value);
+				purple_request_field_list_add_icon(field, label, NULL, value);
 				if (strcmp(value, current_value) == 0)
 					purple_request_field_list_add_selected(field, label);
 				list = list->next->next;
--- a/finch/gntprefs.c	Sun Nov 16 10:10:17 2008 +0000
+++ b/finch/gntprefs.c	Sun Nov 16 10:33:36 2008 +0000
@@ -170,7 +170,7 @@
 				default:
 					break;
 			}
-			purple_request_field_list_add(field, data, iter->data);
+			purple_request_field_list_add_icon(field, data, NULL, iter->data);
 			if (select)
 				purple_request_field_list_add_selected(field, data);
 		}
--- a/finch/plugins/gnthistory.c	Sun Nov 16 10:10:17 2008 +0000
+++ b/finch/plugins/gnthistory.c	Sun Nov 16 10:33:36 2008 +0000
@@ -154,7 +154,7 @@
 		while (list) {
 			const char *label = _(list->data);
 			list = g_list_delete_link(list, list);
-			purple_request_field_list_add(field, label, list->data);
+			purple_request_field_list_add_icon(field, label, NULL, list->data);
 			if (system && strcmp(system, list->data) == 0)
 				purple_request_field_list_add_selected(field, label);
 			list = g_list_delete_link(list, list);
--- a/libpurple/plugins/perl/common/Request.xs	Sun Nov 16 10:10:17 2008 +0000
+++ b/libpurple/plugins/perl/common/Request.xs	Sun Nov 16 10:33:36 2008 +0000
@@ -374,6 +374,13 @@
 	void * data
 
 void
+purple_request_field_list_add_icon(field, item, icon_path, data)
+	Purple::Request::Field field
+	const char *item
+	const char *icon_path
+	void * data
+
+void
 purple_request_field_list_add_selected(field, item)
 	Purple::Request::Field field
 	const char *item
--- a/libpurple/protocols/gg/gg.c	Sun Nov 16 10:10:17 2008 +0000
+++ b/libpurple/protocols/gg/gg.c	Sun Nov 16 10:33:36 2008 +0000
@@ -831,16 +831,16 @@
 /* static void ggp_callback_add_to_chat_ok(PurpleConnection *gc, PurpleRequestFields *fields) {{{ */
 static void ggp_callback_add_to_chat_ok(PurpleConnection *gc, PurpleRequestFields *fields)
 {
-	GGPInfo *info = gc->proto_data;
 	PurpleRequestField *field;
-	/* TODO: sel may be null. */
 	GList *sel;
 
 	field = purple_request_fields_get_field(fields, "name");
 	sel = purple_request_field_list_get_selected(field);
+	if (sel == NULL || sel->data == NULL)
+		return;
 
-	ggp_confer_participants_add_uin(gc, sel->data, info->tmp_buddy);
-	info->tmp_buddy = 0;
+	ggp_confer_participants_add_uin(gc, sel->data,
+		GPOINTER_TO_INT(purple_request_field_list_get_data(field, sel->data)));
 }
 /* }}} */
 
@@ -864,9 +864,6 @@
 	gc = purple_account_get_connection(purple_buddy_get_account(buddy));
 	info = gc->proto_data;
 
-	/* TODO: It tmp_buddy != 0 then stop! */
-	info->tmp_buddy = ggp_str_to_uin(purple_buddy_get_name(buddy));
-
 	fields = purple_request_fields_new();
 	group = purple_request_field_group_new(NULL);
 	purple_request_fields_add_group(fields, group);
@@ -874,8 +871,8 @@
 	field = purple_request_field_list_new("name", "Chat name");
 	for (l = info->chats; l != NULL; l = l->next) {
 		GGPChat *chat = l->data;
-		purple_request_field_list_add(field, g_strdup(chat->name),
-					    g_strdup(chat->name));
+		purple_request_field_list_add_icon(field, chat->name, NULL,
+			GINT_TO_POINTER(ggp_str_to_uin(purple_buddy_get_name(buddy))));
 	}
 	purple_request_field_group_add_field(group, field);
 
--- a/libpurple/protocols/gg/gg.h	Sun Nov 16 10:10:17 2008 +0000
+++ b/libpurple/protocols/gg/gg.h	Sun Nov 16 10:33:36 2008 +0000
@@ -62,7 +62,6 @@
 	GList *chats;
 	GGPSearches *searches;
 
-	uin_t tmp_buddy;
 	int chats_count;
 
 } GGPInfo;
--- a/libpurple/protocols/jabber/xdata.c	Sun Nov 16 10:10:17 2008 +0000
+++ b/libpurple/protocols/jabber/xdata.c	Sun Nov 16 10:33:36 2008 +0000
@@ -302,7 +302,7 @@
 
 				data->values = g_slist_prepend(data->values, value);
 
-				purple_request_field_list_add(field, lbl, value);
+				purple_request_field_list_add_icon(field, lbl, NULL, value);
 				if(g_list_find_custom(selected, value, (GCompareFunc)strcmp))
 					purple_request_field_list_add_selected(field, lbl);
 			}
--- a/libpurple/protocols/sametime/sametime.c	Sun Nov 16 10:10:17 2008 +0000
+++ b/libpurple/protocols/sametime/sametime.c	Sun Nov 16 10:33:36 2008 +0000
@@ -3505,10 +3505,10 @@
   purple_request_field_list_set_multi_select(f, FALSE);
   for(; confs; confs = confs->next) {
     struct mwConference *c = confs->data;
-    purple_request_field_list_add(f, mwConference_getTitle(c), c);
+    purple_request_field_list_add_icon(f, mwConference_getTitle(c), NULL, c);
   }
-  purple_request_field_list_add(f, _("Create New Conference..."),
-			      GINT_TO_POINTER(0x01));
+  purple_request_field_list_add_icon(f, _("Create New Conference..."),
+			      NULL, GINT_TO_POINTER(0x01));
   purple_request_field_group_add_field(g, f);
   
   f = purple_request_field_string_new(CHAT_KEY_INVITE, "Message", NULL, FALSE);
@@ -5434,7 +5434,7 @@
     res->id = g_strdup(match->id);
     res->name = g_strdup(match->name);
 
-    purple_request_field_list_add(f, res->name, res);
+    purple_request_field_list_add_icon(f, res->name, NULL, res);
   }
 
   purple_request_field_group_add_field(g, f);
--- a/libpurple/protocols/silc/buddy.c	Sun Nov 16 10:10:17 2008 +0000
+++ b/libpurple/protocols/silc/buddy.c	Sun Nov 16 10:33:36 2008 +0000
@@ -1178,7 +1178,7 @@
 			   client_entry->username, *client_entry->hostname ?
 			   client_entry->hostname : "",
 			   fingerprint ? tmp2 : "");
-		purple_request_field_list_add(f, tmp, client_entry);
+		purple_request_field_list_add_icon(f, tmp, NULL, client_entry);
 		silc_free(fingerprint);
 	}
 
--- a/libpurple/protocols/silc/chat.c	Sun Nov 16 10:10:17 2008 +0000
+++ b/libpurple/protocols/silc/chat.c	Sun Nov 16 10:33:36 2008 +0000
@@ -472,7 +472,7 @@
 		g_snprintf(tmp2, sizeof(tmp2), "%s\n  %s\n  %s",
 			   ident->realname ? ident->realname : ident->username ?
 			   ident->username : "", fingerprint, babbleprint);
-		purple_request_field_list_add(f, tmp2, public_key);
+		purple_request_field_list_add_icon(f, tmp2, NULL, public_key);
 
 		silc_free(fingerprint);
 		silc_free(babbleprint);
--- a/libpurple/protocols/silc10/buddy.c	Sun Nov 16 10:10:17 2008 +0000
+++ b/libpurple/protocols/silc10/buddy.c	Sun Nov 16 10:33:36 2008 +0000
@@ -1176,7 +1176,7 @@
 			   clients[i]->username, clients[i]->hostname ?
 			   clients[i]->hostname : "",
 			   fingerprint ? tmp2 : "");
-		purple_request_field_list_add(f, tmp, clients[i]);
+		purple_request_field_list_add_icon(f, tmp, NULL, clients[i]);
 		silc_free(fingerprint);
 	}
 
--- a/libpurple/protocols/silc10/chat.c	Sun Nov 16 10:10:17 2008 +0000
+++ b/libpurple/protocols/silc10/chat.c	Sun Nov 16 10:33:36 2008 +0000
@@ -449,7 +449,7 @@
 		g_snprintf(tmp2, sizeof(tmp2), "%s\n  %s\n  %s",
 			   ident->realname ? ident->realname : ident->username ?
 			   ident->username : "", fingerprint, babbleprint);
-		purple_request_field_list_add(f, tmp2, pubkey);
+		purple_request_field_list_add_icon(f, tmp2, NULL, pubkey);
 
 		silc_free(fingerprint);
 		silc_free(babbleprint);
--- a/libpurple/request.c	Sun Nov 16 10:10:17 2008 +0000
+++ b/libpurple/request.c	Sun Nov 16 10:33:36 2008 +0000
@@ -23,6 +23,8 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  */
+#define _PURPLE_REQUEST_C_
+
 #include "internal.h"
 
 #include "notify.h"
--- a/libpurple/request.h	Sun Nov 16 10:10:17 2008 +0000
+++ b/libpurple/request.h	Sun Nov 16 10:33:36 2008 +0000
@@ -908,6 +908,7 @@
 void *purple_request_field_list_get_data(const PurpleRequestField *field,
 									   const char *text);
 
+#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_REQUEST_C_)
 /**
  * Adds an item to a list field.
  *
@@ -919,13 +920,14 @@
  */
 void purple_request_field_list_add(PurpleRequestField *field,
 								 const char *item, void *data);
+#endif
 
 /**
- * Adds an item with icon to a list field.
+ * Adds an item to a list field.
  *
  * @param field The list field.
  * @param item  The list item.
- * @param icon_path The path to icon file.
+ * @param icon_path The path to icon file, or @c NULL for no icon.
  * @param data  The associated data.
  */
 void purple_request_field_list_add_icon(PurpleRequestField *field,