changeset 17848:5fc8a8a25008

Implemented a mood menu action (non-functional right now for some reason)
author Andreas Monitzer <pidgin@monitzer.com>
date Wed, 13 Jun 2007 16:03:11 +0000
parents 267f614152c4
children e49b259fc7dd
files libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/pep.c libpurple/protocols/jabber/pep.h libpurple/protocols/jabber/usermood.c libpurple/protocols/jabber/usermood.h
diffstat 5 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Tue Jun 12 23:43:06 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Wed Jun 13 16:03:11 2007 +0000
@@ -1443,6 +1443,8 @@
 
 GList *jabber_actions(PurplePlugin *plugin, gpointer context)
 {
+	PurpleConnection *gc = (PurpleConnection *) context;
+	JabberStream *js = gc->proto_data;
 	GList *m = NULL;
 	PurplePluginAction *act;
 
@@ -1459,6 +1461,9 @@
 	act = purple_plugin_action_new(_("Search for Users..."),
 								 jabber_user_search_begin);
 	m = g_list_append(m, act);
+	
+	if(js->pep)
+		jabber_pep_init_actions(&m);
 
 	return m;
 }
--- a/libpurple/protocols/jabber/pep.c	Tue Jun 12 23:43:06 2007 +0000
+++ b/libpurple/protocols/jabber/pep.c	Wed Jun 13 16:03:11 2007 +0000
@@ -34,6 +34,11 @@
 	}
 }
 
+void jabber_pep_init_actions(GList **m) {
+	/* register the PEP-specific actions */
+	jabber_mood_init_action(m);
+}
+
 void jabber_pep_register_handler(const char *shortname, const char *xmlns, JabberPEPHandler handlerfunc) {
 	gchar *notifyns = g_strdup_printf("%s+notify", xmlns);
 	jabber_add_feature(shortname, notifyns);
--- a/libpurple/protocols/jabber/pep.h	Tue Jun 12 23:43:06 2007 +0000
+++ b/libpurple/protocols/jabber/pep.h	Wed Jun 13 16:03:11 2007 +0000
@@ -28,6 +28,8 @@
 
 void jabber_pep_init(void);
 
+void jabber_pep_init_actions(GList **m);
+
 /*
  * Callback for receiving PEP events.
  *
--- a/libpurple/protocols/jabber/usermood.c	Tue Jun 12 23:43:06 2007 +0000
+++ b/libpurple/protocols/jabber/usermood.c	Wed Jun 13 16:03:11 2007 +0000
@@ -138,6 +138,15 @@
 	jabber_pep_register_handler("moodn", "http://jabber.org/protocol/mood", jabber_mood_cb);
 }
 
+static void do_mood_set_mood(PurplePluginAction *action) {
+	
+}
+
+void jabber_mood_init_action(GList **m) {
+	PurplePluginAction *act = purple_plugin_action_new(_("Set Mood..."), do_mood_set_mood);
+	*m = g_list_append(*m, act);
+}
+
 void jabber_set_mood(JabberStream *js, const char *mood, const char *text) {
 	xmlnode *publish, *moodnode;
 	
--- a/libpurple/protocols/jabber/usermood.h	Tue Jun 12 23:43:06 2007 +0000
+++ b/libpurple/protocols/jabber/usermood.h	Wed Jun 13 16:03:11 2007 +0000
@@ -28,6 +28,8 @@
 
 void jabber_mood_init(void);
 
+void jabber_mood_init_action(GList **m);
+
 void jabber_set_mood(JabberStream *js,
 		     const char *mood, /* must be one of the valid strings defined in the XEP */
 		     const char *text /* might be NULL */);