/pidgin/main: 3d01f136f220: Fix xmpp MUC commands for other xmpp...

Tomasz Wasilczyk twasilczyk at pidgin.im
Fri Feb 14 06:14:35 EST 2014


Changeset: 3d01f136f2208cbaa0baa119bd59bde9f3778e05
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-02-14 12:13 +0100
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/3d01f136f220

Description:

Fix xmpp MUC commands for other xmpp-based protocols

diffstat:

 libpurple/protocols/jabber/jabber.c |  132 ++++++++++++++++-------------------
 1 files changed, 62 insertions(+), 70 deletions(-)

diffs (192 lines):

diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c
--- a/libpurple/protocols/jabber/jabber.c
+++ b/libpurple/protocols/jabber/jabber.c
@@ -3613,126 +3613,118 @@ jabber_cmd_mood(PurpleConversation *conv
 	}
 }
 
-static void jabber_register_commands(PurplePlugin *plugin)
+static void
+jabber_register_commands(PurplePlugin *plugin)
 {
 	GSList *commands = NULL;
 	PurpleCmdId id;
+	const gchar *plid = purple_plugin_get_id(plugin);
+
 	id = purple_cmd_register("config", "", PURPLE_CMD_P_PRPL,
-	                  PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
-	                  "prpl-jabber", jabber_cmd_chat_config,
-	                  _("config:  Configure a chat room."), NULL);
+		PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, plid,
+		jabber_cmd_chat_config, _("config:  Configure a chat room."),
+		NULL);
 	commands = g_slist_prepend(commands, GUINT_TO_POINTER(id));
 
 	id = purple_cmd_register("configure", "", PURPLE_CMD_P_PRPL,
-	                  PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
-	                  "prpl-jabber", jabber_cmd_chat_config,
-	                  _("configure:  Configure a chat room."), NULL);
+		PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, plid,
+		jabber_cmd_chat_config, _("configure:  Configure a chat room."),
+		NULL);
 	commands = g_slist_prepend(commands, GUINT_TO_POINTER(id));
 
 	id = purple_cmd_register("nick", "s", PURPLE_CMD_P_PRPL,
-	                  PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
-	                  "prpl-jabber", jabber_cmd_chat_nick,
-	                  _("nick <new nickname>:  Change your nickname."),
-	                  NULL);
+		PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, plid,
+		jabber_cmd_chat_nick, _("nick <new nickname>:  "
+		"Change your nickname."), NULL);
 	commands = g_slist_prepend(commands, GUINT_TO_POINTER(id));
 
 	id = purple_cmd_register("part", "s", PURPLE_CMD_P_PRPL,
-	                  PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
-	                  PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber",
-	                  jabber_cmd_chat_part, _("part [message]:  Leave the room."),
-	                  NULL);
+		PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
+		PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, plid, jabber_cmd_chat_part,
+		_("part [message]:  Leave the room."), NULL);
 	commands = g_slist_prepend(commands, GUINT_TO_POINTER(id));
 
 	id = purple_cmd_register("register", "", PURPLE_CMD_P_PRPL,
-	                  PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
-	                  "prpl-jabber", jabber_cmd_chat_register,
-	                  _("register:  Register with a chat room."), NULL);
+		PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, plid,
+		jabber_cmd_chat_register,
+		_("register:  Register with a chat room."), NULL);
 	commands = g_slist_prepend(commands, GUINT_TO_POINTER(id));
 
 	/* XXX: there needs to be a core /topic cmd, methinks */
 	id = purple_cmd_register("topic", "s", PURPLE_CMD_P_PRPL,
-	                  PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
-	                  PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber",
-	                  jabber_cmd_chat_topic,
-	                  _("topic [new topic]:  View or change the topic."),
-	                  NULL);
+		PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
+		PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, plid, jabber_cmd_chat_topic,
+		_("topic [new topic]:  View or change the topic."), NULL);
 	commands = g_slist_prepend(commands, GUINT_TO_POINTER(id));
 
 	id = purple_cmd_register("ban", "ws", PURPLE_CMD_P_PRPL,
-	                  PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
-	                  PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber",
-	                  jabber_cmd_chat_ban,
-	                  _("ban <user> [reason]:  Ban a user from the room."),
-	                  NULL);
+		PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
+		PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, plid, jabber_cmd_chat_ban,
+		_("ban <user> [reason]:  Ban a user from the room."),
+		NULL);
 	commands = g_slist_prepend(commands, GUINT_TO_POINTER(id));
 
 	id = purple_cmd_register("affiliate", "ws", PURPLE_CMD_P_PRPL,
-	                  PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
-	                  PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber",
-	                  jabber_cmd_chat_affiliate,
-	                  _("affiliate <owner|admin|member|outcast|none> [nick1] [nick2] ...: Get the users with an affiliation or set users' affiliation with the room."),
-	                  NULL);
+		PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
+		PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, plid,
+		jabber_cmd_chat_affiliate, _("affiliate "
+		"<owner|admin|member|outcast|none> [nick1] [nick2] ...: "
+		"Get the users with an affiliation or set users' affiliation "
+		"with the room."), NULL);
 	commands = g_slist_prepend(commands, GUINT_TO_POINTER(id));
 
 	id = purple_cmd_register("role", "ws", PURPLE_CMD_P_PRPL,
-	                  PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
-	                  PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber",
-	                  jabber_cmd_chat_role,
-	                  _("role <moderator|participant|visitor|none> [nick1] [nick2] ...: Get the users with a role or set users' role with the room."),
-	                  NULL);
+		PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
+		PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, plid, jabber_cmd_chat_role,
+		_("role <moderator|participant|visitor|none> [nick1] "
+		"[nick2] ...: Get the users with a role or set users' role "
+		"with the room."), NULL);
 	commands = g_slist_prepend(commands, GUINT_TO_POINTER(id));
 
 	id = purple_cmd_register("invite", "ws", PURPLE_CMD_P_PRPL,
-	                  PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
-	                  PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber",
-	                  jabber_cmd_chat_invite,
-	                  _("invite <user> [message]:  Invite a user to the room."),
-	                  NULL);
+		PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
+		PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, plid, jabber_cmd_chat_invite,
+		_("invite <user> [message]:  Invite a user to the room."),
+		NULL);
 	commands = g_slist_prepend(commands, GUINT_TO_POINTER(id));
 
 	id = purple_cmd_register("join", "ws", PURPLE_CMD_P_PRPL,
-	                  PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
-	                  PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber",
-	                  jabber_cmd_chat_join,
-	                  _("join: <room[@server]> [password]:  Join a chat."),
-	                  NULL);
+		PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
+		PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, plid, jabber_cmd_chat_join,
+		_("join: <room[@server]> [password]:  Join a chat."),
+		NULL);
 	commands = g_slist_prepend(commands, GUINT_TO_POINTER(id));
 
 	id = purple_cmd_register("kick", "ws", PURPLE_CMD_P_PRPL,
-	                  PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
-	                  PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber",
-	                  jabber_cmd_chat_kick,
-	                  _("kick <user> [reason]:  Kick a user from the room."),
-	                  NULL);
+		PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
+		PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, plid, jabber_cmd_chat_kick,
+		_("kick <user> [reason]:  Kick a user from the room."),
+		NULL);
 	commands = g_slist_prepend(commands, GUINT_TO_POINTER(id));
 
 	id = purple_cmd_register("msg", "ws", PURPLE_CMD_P_PRPL,
-	                  PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
-	                  "prpl-jabber", jabber_cmd_chat_msg,
-	                  _("msg <user> <message>:  Send a private message to another user."),
-	                  NULL);
+		PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, plid,
+		jabber_cmd_chat_msg, _("msg <user> <message>:  "
+		"Send a private message to another user."), NULL);
 	commands = g_slist_prepend(commands, GUINT_TO_POINTER(id));
 
 	id = purple_cmd_register("ping", "w", PURPLE_CMD_P_PRPL,
-					  PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM |
-					  PURPLE_CMD_FLAG_PRPL_ONLY,
-					  "prpl-jabber", jabber_cmd_ping,
-					  _("ping <jid>:	Ping a user/component/server."),
-					  NULL);
+		PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM |
+		PURPLE_CMD_FLAG_PRPL_ONLY, plid, jabber_cmd_ping,
+		_("ping <jid>:  Ping a user/component/server."), NULL);
 	commands = g_slist_prepend(commands, GUINT_TO_POINTER(id));
 
 	id = purple_cmd_register("buzz", "w", PURPLE_CMD_P_PRPL,
-					  PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY |
-					  PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS,
-					  "prpl-jabber", jabber_cmd_buzz,
-					  _("buzz: Buzz a user to get their attention"), NULL);
+		PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY |
+		PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, plid, jabber_cmd_buzz,
+		_("buzz: Buzz a user to get their attention"), NULL);
 	commands = g_slist_prepend(commands, 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 <mood> [text]: Set current user mood"), NULL);
+		PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM |
+		PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS,
+		plid, jabber_cmd_mood,
+		_("mood <mood> [text]: Set current user mood"), NULL);
 	commands = g_slist_prepend(commands, GUINT_TO_POINTER(id));
 
 	g_hash_table_insert(jabber_cmds, plugin, commands);



More information about the Commits mailing list