pidgin: 758002db: jabber: Added a /mood command make up fo..
malu at pidgin.im
malu at pidgin.im
Sun Mar 7 14:50:56 EST 2010
-----------------------------------------------------------------
Revision: 758002db4911cba4399db3131f17cff39238db06
Ancestor: e72dcf8b5e06438b5ceb002c28f687eea2b1e973
Author: malu at pidgin.im
Date: 2010-03-07T19:45:12
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/758002db4911cba4399db3131f17cff39238db06
Modified files:
libpurple/protocols/jabber/jabber.c
ChangeLog:
jabber: Added a /mood command make up for the lost PurplePluginAction to
set moods (for UIs that doesn't yet implement the new general mood setting API)
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c d4bb24d65359ecebcba97019904431fb4ab83d3b
+++ libpurple/protocols/jabber/jabber.c 052b99b5abf4056778ebd7ce87c29087ff4af95f
@@ -3315,6 +3315,29 @@ gboolean jabber_can_receive_file(PurpleC
}
}
+static void
+jabber_cmd_mood(PurpleConversation *conv,
+ const char *cmd, char **args, char **error, void *data)
+{
+ JabberStream *js = conv->account->gc->proto_data;
+
+ if (js->pep) {
+ /* if no argument was given, unset mood */
+ if (!args | !args[0]) {
+ jabber_mood_set(js, NULL, NULL);
+ } else if (!args[1]) {
+ jabber_mood_set(js, args[0], NULL);
+ } else {
+ jabber_mood_set(js, args[0], args[1]);
+ }
+ } else {
+ /* account does not support PEP, can't set a mood */
+ purple_conversation_write(conv, NULL,
+ _("Account does not support PEP, can't set mood"),
+ PURPLE_MESSAGE_ERROR, time(NULL));
+ }
+}
+
void jabber_register_commands(void)
{
PurpleCmdId id;
@@ -3428,6 +3451,13 @@ void jabber_register_commands(void)
"prpl-jabber", jabber_cmd_buzz,
_("buzz: Buzz a user to get their attention"), NULL);
jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id));
+
+ id = purple_cmd_register("mood", "ws", PURPLE_CMD_P_PRPL,
+ PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM |
+ PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS,
+ "prpl-jabber", jabber_cmd_mood,
+ _("mood: Set current user mood"), NULL);
+ jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id));
}
void jabber_unregister_commands(void)
More information about the Commits
mailing list