facebook: fixed missing chat component facebook

Sun, 05 Jul 2015 18:05:01 -0400

author
James Geboski <jgeboski@gmail.com>
date
Sun, 05 Jul 2015 18:05:01 -0400
branch
facebook
changeset 37286
6e3ee8e18697
parent 37285
2a5decfdeb7b
child 37287
358b11b0a793

facebook: fixed missing chat component

libpurple/protocols/facebook/facebook.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/facebook/facebook.c	Sun Jul 05 15:58:47 2015 -0400
+++ b/libpurple/protocols/facebook/facebook.c	Sun Jul 05 18:05:01 2015 -0400
@@ -584,6 +584,32 @@
 	return 0;
 }
 
+static GList *
+fb_chat_info()
+{
+	GList *pces = NULL;
+	PurpleProtocolChatEntry *pce;
+
+	pce = g_new0(PurpleProtocolChatEntry, 1);
+	pce->label = _("Chat _Name:");
+	pce->identifier = "name";
+	pce->required = TRUE;
+	pces = g_list_prepend(pces, pce);
+
+	return g_list_reverse(pces);
+}
+
+static GHashTable *
+fb_chat_info_defaults(PurpleConnection *gc, const gchar *name)
+{
+	GHashTable *data;
+
+	data = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
+	g_hash_table_insert(data, "name", g_strdup(name));
+
+	return data;
+}
+
 static void
 fb_chat_join(PurpleConnection *gc, GHashTable *data)
 {
@@ -602,6 +628,17 @@
 	fb_api_thread_info(api, tid);
 }
 
+static gchar *
+fb_chat_get_name(GHashTable *data)
+{
+	const gchar *name;
+
+	name = g_hash_table_lookup(data, "name");
+	g_return_val_if_fail(name != NULL, NULL);
+
+	return g_strdup(name);
+}
+
 static void
 fb_chat_invite(PurpleConnection *gc, gint id, const gchar *msg,
                const gchar *who)
@@ -853,10 +890,13 @@
 static void
 facebook_protocol_chat_iface_init(PurpleProtocolChatIface *iface)
 {
-	iface->join      = fb_chat_join;
-	iface->invite    = fb_chat_invite;
-	iface->send      = fb_chat_send;
-	iface->set_topic = fb_chat_set_topic;
+	iface->info          = fb_chat_info;
+	iface->info_defaults = fb_chat_info_defaults;
+	iface->join          = fb_chat_join;
+	iface->get_name      = fb_chat_get_name;
+	iface->invite        = fb_chat_invite;
+	iface->send          = fb_chat_send;
+	iface->set_topic     = fb_chat_set_topic;
 }
 
 static void

mercurial