Mercurial > pidgin.yaz
changeset 29951:80724c326423
merge of '25d4fad7d77b9c892b18504c1bdc49e0ecf41a0f'
and '758002db4911cba4399db3131f17cff39238db06'
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Sun, 07 Mar 2010 19:56:38 +0000 |
parents | 54975f0cbc37 (current diff) 2f73b0a78f4f (diff) |
children | b71821db0516 0b4ae43d7f1a |
files | |
diffstat | 1 files changed, 30 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c Sun Mar 07 18:47:09 2010 +0000 +++ b/libpurple/protocols/jabber/jabber.c Sun Mar 07 19:56:38 2010 +0000 @@ -3315,6 +3315,29 @@ } } +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 @@ "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)