Mercurial > pidgin.yaz
changeset 17572:2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
author | Andreas Monitzer <pidgin@monitzer.com> |
---|---|
date | Tue, 12 Jun 2007 01:25:46 +0000 |
parents | 2f23a77eaa04 |
children | 2f067d8fb19a |
files | libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/jabber.h libpurple/protocols/jabber/message.c libpurple/protocols/jabber/message.h libpurple/protocols/jabber/pep.c libpurple/protocols/jabber/pep.h libpurple/protocols/jabber/usermood.c libpurple/protocols/jabber/usermood.h |
diffstat | 8 files changed, 393 insertions(+), 393 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c Tue Jun 12 00:37:50 2007 +0000 +++ b/libpurple/protocols/jabber/jabber.c Tue Jun 12 01:25:46 2007 +0000 @@ -10,12 +10,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "internal.h" @@ -66,7 +66,7 @@ char *open_stream; open_stream = g_strdup_printf("<stream:stream to='%s' " - "xmlns='jabber:client' " + "xmlns='jabber:client' " "xmlns:stream='http://etherx.jabber.org/streams' " "version='1.0'>", js->user->domain); @@ -951,14 +951,14 @@ if(!js->gsc) { if (connect_server[0]) { jabber_login_connect(js, js->user->domain, server, - purple_account_get_int(account, - "port", 5222)); + purple_account_get_int(account, + "port", 5222)); } else { js->srv_query_data = purple_srv_resolve("xmpp-client", - "tcp", - js->user->domain, - srv_resolved_cb, - js); + "tcp", + js->user->domain, + srv_resolved_cb, + js); } } } @@ -1095,29 +1095,29 @@ } void jabber_add_feature(const char *shortname, const char *namespace) { - JabberFeature *feat = g_new0(JabberFeature,1); - feat->shortname = g_strdup(shortname); - feat->namespace = g_strdup(namespace); - - /* try to remove just in case it already exists in the list */ - jabber_remove_feature(shortname); - - jabber_features = g_list_append(jabber_features, feat); + JabberFeature *feat = g_new0(JabberFeature,1); + feat->shortname = g_strdup(shortname); + feat->namespace = g_strdup(namespace); + + /* try to remove just in case it already exists in the list */ + jabber_remove_feature(shortname); + + jabber_features = g_list_append(jabber_features, feat); } void jabber_remove_feature(const char *shortname) { - GList *feature; - for(feature = jabber_features; feature; feature = feature->next) { - JabberFeature *feat = (JabberFeature*)feature->data; - if(!strcmp(feat->shortname, shortname)) { - g_free(feat->shortname); - g_free(feat->namespace); - - g_free(feature->data); - feature = g_list_delete_link(feature, feature); - break; - } - } + GList *feature; + for(feature = jabber_features; feature; feature = feature->next) { + JabberFeature *feat = (JabberFeature*)feature->data; + if(!strcmp(feat->shortname, shortname)) { + g_free(feat->shortname); + g_free(feat->namespace); + + g_free(feature->data); + feature = g_list_delete_link(feature, feature); + break; + } + } } const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b) @@ -1271,8 +1271,8 @@ NULL, TRUE, TRUE, FALSE, "priority", _("Priority"), priority_value, "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - "mood", _("Mood"), purple_value_new(PURPLE_TYPE_INT), - "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), + "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), + "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), NULL); types = g_list_append(types, type); @@ -1283,8 +1283,8 @@ _("Chatty"), TRUE, TRUE, FALSE, "priority", _("Priority"), priority_value, "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - "mood", _("Mood"), purple_value_new(PURPLE_TYPE_INT), - "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), + "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), + "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), NULL); types = g_list_append(types, type); @@ -1295,8 +1295,8 @@ NULL, TRUE, TRUE, FALSE, "priority", _("Priority"), priority_value, "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - "mood", _("Mood"), purple_value_new(PURPLE_TYPE_INT), - "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), + "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), + "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), NULL); types = g_list_append(types, type); @@ -1307,8 +1307,8 @@ NULL, TRUE, TRUE, FALSE, "priority", _("Priority"), priority_value, "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - "mood", _("Mood"), purple_value_new(PURPLE_TYPE_INT), - "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), + "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), + "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), NULL); types = g_list_append(types, type); @@ -1319,8 +1319,8 @@ _("Do Not Disturb"), TRUE, TRUE, FALSE, "priority", _("Priority"), priority_value, "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - "mood", _("Mood"), purple_value_new(PURPLE_TYPE_INT), - "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), + "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), + "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), NULL); types = g_list_append(types, type); @@ -1429,17 +1429,17 @@ PurplePluginAction *act; act = purple_plugin_action_new(_("Set User Info..."), - jabber_setup_set_info); + jabber_setup_set_info); m = g_list_append(m, act); /* if (js->protocol_options & CHANGE_PASSWORD) { */ act = purple_plugin_action_new(_("Change Password..."), - jabber_password_change); + jabber_password_change); m = g_list_append(m, act); /* } */ act = purple_plugin_action_new(_("Search for Users..."), - jabber_user_search_begin); + jabber_user_search_begin); m = g_list_append(m, act); return m; @@ -1720,10 +1720,10 @@ return PURPLE_CMD_RET_FAILED; if (strcmp(args[1], "owner") != 0 && - strcmp(args[1], "admin") != 0 && - strcmp(args[1], "member") != 0 && - strcmp(args[1], "outcast") != 0 && - strcmp(args[1], "none") != 0) { + strcmp(args[1], "admin") != 0 && + strcmp(args[1], "member") != 0 && + strcmp(args[1], "outcast") != 0 && + strcmp(args[1], "none") != 0) { *error = g_strdup_printf(_("Unknown affiliation: \"%s\""), args[1]); return PURPLE_CMD_RET_FAILED; } @@ -1745,9 +1745,9 @@ return PURPLE_CMD_RET_FAILED; if (strcmp(args[1], "moderator") != 0 && - strcmp(args[1], "participant") != 0 && - strcmp(args[1], "visitor") != 0 && - strcmp(args[1], "none") != 0) { + strcmp(args[1], "participant") != 0 && + strcmp(args[1], "visitor") != 0 && + strcmp(args[1], "none") != 0) { *error = g_strdup_printf(_("Unknown role: \"%s\""), args[1]); return PURPLE_CMD_RET_FAILED; } @@ -1756,7 +1756,7 @@ if (!jabber_chat_role_user(chat, args[0], args[1])) { *error = g_strdup_printf(_("Unable to set role \"%s\" for user: %s"), - args[1], args[0]); + args[1], args[0]); return PURPLE_CMD_RET_FAILED; } @@ -1851,86 +1851,86 @@ void jabber_register_commands(void) { 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, + "prpl-jabber", jabber_cmd_chat_config, + _("config: Configure a chat room."), NULL); 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, + "prpl-jabber", jabber_cmd_chat_config, + _("configure: Configure a chat room."), NULL); 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, + "prpl-jabber", jabber_cmd_chat_nick, + _("nick <new nickname>: Change your nickname."), + NULL); 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 [room]: Leave the room."), - NULL); + PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | + PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", + jabber_cmd_chat_part, _("part [room]: Leave the room."), + NULL); 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, + "prpl-jabber", jabber_cmd_chat_register, + _("register: Register with a chat room."), NULL); /* XXX: there needs to be a core /topic cmd, methinks */ 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, "prpl-jabber", + jabber_cmd_chat_topic, + _("topic [new topic]: View or change the topic."), + NULL); 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> [room]: Ban a user from the room."), - NULL); + PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | + PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", + jabber_cmd_chat_ban, + _("ban <user> [room]: Ban a user from the room."), + NULL); 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 <user> <owner|admin|member|outcast|none>: Set a user's affiliation with the room."), - NULL); + PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | + PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", + jabber_cmd_chat_affiliate, + _("affiliate <user> <owner|admin|member|outcast|none>: Set a user's affiliation with the room."), + NULL); 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 <user> <moderator|participant|visitor|none>: Set a user's role in the room."), - NULL); + PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | + PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", + jabber_cmd_chat_role, + _("role <user> <moderator|participant|visitor|none>: Set a user's role in the room."), + NULL); 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, "prpl-jabber", + jabber_cmd_chat_invite, + _("invite <user> [message]: Invite a user to the room."), + NULL); 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]: Join a chat on this server."), - NULL); + PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | + PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", + jabber_cmd_chat_join, + _("join: <room> [server]: Join a chat on this server."), + NULL); 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> [room]: Kick a user from the room."), - NULL); + PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | + PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", + jabber_cmd_chat_kick, + _("kick <user> [room]: Kick a user from the room."), + NULL); 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, + "prpl-jabber", jabber_cmd_chat_msg, + _("msg <user> <message>: Send a private message to another user."), + NULL); 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, + "prpl-jabber", jabber_cmd_ping, + _("ping <jid>: Ping a user/component/server."), + NULL); } void jabber_init_plugin(PurplePlugin *plugin) { - my_protocol = plugin; + my_protocol = plugin; }
--- a/libpurple/protocols/jabber/jabber.h Tue Jun 12 00:37:50 2007 +0000 +++ b/libpurple/protocols/jabber/jabber.h Tue Jun 12 01:25:46 2007 +0000 @@ -12,12 +12,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _PURPLE_JABBER_H_ #define _PURPLE_JABBER_H_ @@ -40,26 +40,26 @@ #define CAPS0115_NODE "http://pidgin.im/caps" typedef enum { - JABBER_CAP_NONE = 0, - JABBER_CAP_XHTML = 1 << 0, - JABBER_CAP_COMPOSING = 1 << 1, - JABBER_CAP_SI = 1 << 2, - JABBER_CAP_SI_FILE_XFER = 1 << 3, - JABBER_CAP_BYTESTREAMS = 1 << 4, - JABBER_CAP_IBB = 1 << 5, - JABBER_CAP_CHAT_STATES = 1 << 6, - JABBER_CAP_IQ_SEARCH = 1 << 7, - JABBER_CAP_IQ_REGISTER = 1 << 8, + JABBER_CAP_NONE = 0, + JABBER_CAP_XHTML = 1 << 0, + JABBER_CAP_COMPOSING = 1 << 1, + JABBER_CAP_SI = 1 << 2, + JABBER_CAP_SI_FILE_XFER = 1 << 3, + JABBER_CAP_BYTESTREAMS = 1 << 4, + JABBER_CAP_IBB = 1 << 5, + JABBER_CAP_CHAT_STATES = 1 << 6, + JABBER_CAP_IQ_SEARCH = 1 << 7, + JABBER_CAP_IQ_REGISTER = 1 << 8, /* Google Talk extensions: * http://code.google.com/apis/talk/jep_extensions/extensions.html */ - JABBER_CAP_GMAIL_NOTIFY = 1 << 9, + JABBER_CAP_GMAIL_NOTIFY = 1 << 9, JABBER_CAP_GOOGLE_ROSTER = 1 << 10, - JABBER_CAP_PING = 1 << 11, + JABBER_CAP_PING = 1 << 11, - JABBER_CAP_RETRIEVED = 1 << 31 + JABBER_CAP_RETRIEVED = 1 << 31 } JabberCapabilities; typedef enum { @@ -148,10 +148,10 @@ int sasl_maxbuf; GString *sasl_mechs; #endif - char *serverFQDN; - - /* does the local server support PEP? */ - gboolean pep; + char *serverFQDN; + + /* does the local server support PEP? */ + gboolean pep; } JabberStream; void jabber_process_packet(JabberStream *js, xmlnode *packet); @@ -191,8 +191,8 @@ typedef struct _JabberFeature { - gchar *shortname; - gchar *namespace; + gchar *shortname; + gchar *namespace; } JabberFeature; /* what kind of additional features as returned from disco#info are supported? */
--- a/libpurple/protocols/jabber/message.c Tue Jun 12 00:37:50 2007 +0000 +++ b/libpurple/protocols/jabber/message.c Tue Jun 12 01:25:46 2007 +0000 @@ -10,12 +10,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "internal.h" @@ -62,7 +62,7 @@ if(jabber_find_unnormalized_conv(jm->from, jm->js->gc->account)) { from = g_strdup(jm->from); - } else if(jid->node) { + } else if(jid->node) { if(jid->resource) { PurpleConversation *conv; @@ -100,13 +100,13 @@ escaped = g_markup_escape_text(who, -1); g_snprintf(buf, sizeof(buf), - _("%s has left the conversation."), escaped); + _("%s has left the conversation."), escaped); /* At some point when we restructure PurpleConversation, * this should be able to be implemented by removing the * user from the conversation like we do with chats now. */ purple_conversation_write(conv, "", buf, - PURPLE_MESSAGE_SYSTEM, time(NULL)); + PURPLE_MESSAGE_SYSTEM, time(NULL)); } } serv_got_typing_stopped(jm->js->gc, from); @@ -306,12 +306,12 @@ jm->from = g_strdup(xmlnode_get_attrib(packet, "from")); jm->to = g_strdup(xmlnode_get_attrib(packet, "to")); - jm->id = g_strdup(xmlnode_get_attrib(packet, "id")); + jm->id = g_strdup(xmlnode_get_attrib(packet, "id")); for(child = packet->child; child; child = child->next) { - const char *xmlns = xmlnode_get_namespace(child); - if(!xmlns) - xmlns = ""; + const char *xmlns = xmlnode_get_namespace(child); + if(!xmlns) + xmlns = ""; if(child->type != XMLNODE_TYPE_TAG) continue; @@ -331,8 +331,8 @@ if(!jm->xhtml && xmlnode_get_child(child, "body")) { char *c; jm->xhtml = xmlnode_to_str(child, NULL); - /* Convert all newlines to whitespace. Technically, even regular, non-XML HTML is supposed to ignore newlines, but Pidgin has, as convention - * treated \n as a newline for compatibility with other protocols + /* Convert all newlines to whitespace. Technically, even regular, non-XML HTML is supposed to ignore newlines, but Pidgin has, as convention + * treated \n as a newline for compatibility with other protocols */ for (c = jm->xhtml; *c != '\0'; c++) { if (*c == '\n') @@ -355,10 +355,10 @@ jm->chat_state = JM_STATE_GONE; jm->typing_style |= JM_TS_JEP_0085; } else if(!strcmp(child->name, "event") && !strcmp(xmlns,"http://jabber.org/protocol/pubsub#event")) { - xmlnode *items; - jm->type = JABBER_MESSAGE_EVENT; - for(items = child->child; items; items = items->next) - jm->eventitems = g_list_append(jm->eventitems, items); + xmlnode *items; + jm->type = JABBER_MESSAGE_EVENT; + for(items = child->child; items; items = items->next) + jm->eventitems = g_list_append(jm->eventitems, items); } else if(!strcmp(child->name, "error")) { const char *code = xmlnode_get_attrib(child, "code"); char *code_txt = NULL; @@ -433,9 +433,9 @@ case JABBER_MESSAGE_GROUPCHAT_INVITE: handle_groupchat_invite(jm); break; - case JABBER_MESSAGE_EVENT: - jabber_handle_event(jm); - break; + case JABBER_MESSAGE_EVENT: + jabber_handle_event(jm); + break; case JABBER_MESSAGE_ERROR: handle_error(jm); break; @@ -472,7 +472,7 @@ type = "error"; break; case JABBER_MESSAGE_OTHER: - default: + default: type = NULL; break; }
--- a/libpurple/protocols/jabber/message.h Tue Jun 12 00:37:50 2007 +0000 +++ b/libpurple/protocols/jabber/message.h Tue Jun 12 01:25:46 2007 +0000 @@ -12,12 +12,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _PURPLE_JABBER_MESSAGE_H_ #define _PURPLE_JABBER_MESSAGE_H_ @@ -35,7 +35,7 @@ JABBER_MESSAGE_HEADLINE, JABBER_MESSAGE_ERROR, JABBER_MESSAGE_GROUPCHAT_INVITE, - JABBER_MESSAGE_EVENT, + JABBER_MESSAGE_EVENT, JABBER_MESSAGE_OTHER } type; time_t sent; @@ -62,7 +62,7 @@ JM_STATE_GONE } chat_state; GList *etc; - GList *eventitems; + GList *eventitems; } JabberMessage; void jabber_message_free(JabberMessage *jm);
--- a/libpurple/protocols/jabber/pep.c Tue Jun 12 00:37:50 2007 +0000 +++ b/libpurple/protocols/jabber/pep.c Tue Jun 12 01:25:46 2007 +0000 @@ -10,12 +10,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ @@ -26,53 +26,53 @@ static GHashTable *pep_handlers = NULL; void jabber_pep_init(void) { - if(!pep_handlers) { - pep_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - - /* register PEP handlers */ - jabber_mood_init(); - } + if(!pep_handlers) { + pep_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); + + /* register PEP handlers */ + jabber_mood_init(); + } } 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); - g_free(notifyns); + gchar *notifyns = g_strdup_printf("%s+notify", xmlns); + jabber_add_feature(shortname, notifyns); + g_free(notifyns); g_hash_table_replace(pep_handlers, g_strdup(xmlns), handlerfunc); } void jabber_handle_event(JabberMessage *jm) { - /* this may be called even when the own server doesn't support pep! */ - JabberPEPHandler *jph; - GList *itemslist; - char *jid = jabber_get_bare_jid(jm->from); - - for(itemslist = jm->eventitems; itemslist; itemslist = itemslist->next) { - xmlnode *items = (xmlnode*)itemslist->data; - const char *xmlns = xmlnode_get_namespace(items); - - if((jph = g_hash_table_lookup(pep_handlers, xmlns))) - jph(jm->js, jid, items); - } - - /* discard items we don't have a handler for */ - g_free(jid); + /* this may be called even when the own server doesn't support pep! */ + JabberPEPHandler *jph; + GList *itemslist; + char *jid = jabber_get_bare_jid(jm->from); + + for(itemslist = jm->eventitems; itemslist; itemslist = itemslist->next) { + xmlnode *items = (xmlnode*)itemslist->data; + const char *xmlns = xmlnode_get_namespace(items); + + if((jph = g_hash_table_lookup(pep_handlers, xmlns))) + jph(jm->js, jid, items); + } + + /* discard items we don't have a handler for */ + g_free(jid); } void jabber_pep_publish(JabberStream *js, xmlnode *publish) { - JabberIq *iq; - - if(js->pep != TRUE) /* ignore when there's no PEP support on the server */ - return; - - iq = jabber_iq_new(js, JABBER_IQ_SET); - - xmlnode *pubsub = xmlnode_new("pubsub"); - xmlnode_set_namespace(pubsub, "http://jabber.org/protocol/pubsub"); - - xmlnode_insert_child(pubsub, publish); - - xmlnode_insert_child(iq->node, pubsub); - - jabber_iq_send(iq); + JabberIq *iq; + + if(js->pep != TRUE) /* ignore when there's no PEP support on the server */ + return; + + iq = jabber_iq_new(js, JABBER_IQ_SET); + + xmlnode *pubsub = xmlnode_new("pubsub"); + xmlnode_set_namespace(pubsub, "http://jabber.org/protocol/pubsub"); + + xmlnode_insert_child(pubsub, publish); + + xmlnode_insert_child(iq->node, pubsub); + + jabber_iq_send(iq); }
--- a/libpurple/protocols/jabber/pep.h Tue Jun 12 00:37:50 2007 +0000 +++ b/libpurple/protocols/jabber/pep.h Tue Jun 12 01:25:46 2007 +0000 @@ -10,12 +10,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ @@ -31,8 +31,8 @@ /* * Callback for receiving PEP events. * - * @parameter js The JabberStream this item was received on - * @parameter items The <items/>-tag with the <item/>-children + * @parameter js The JabberStream this item was received on + * @parameter items The <items/>-tag with the <item/>-children */ typedef void (JabberPEPHandler)(JabberStream *js, const char *from, xmlnode *items); @@ -40,9 +40,9 @@ * Registers a callback for PEP events. Also automatically announces this receiving capability via disco#info. * Don't forget to use jabber_add_feature when supporting the sending of PEP events of this type. * - * @parameter shortname A short name for this feature for XEP-0115. It has no semantic meaning, it just has to be unique. - * @parameter xmlns The namespace for this event - * @parameter handlerfunc The callback to be used when receiving an event with this namespace + * @parameter shortname A short name for this feature for XEP-0115. It has no semantic meaning, it just has to be unique. + * @parameter xmlns The namespace for this event + * @parameter handlerfunc The callback to be used when receiving an event with this namespace */ void jabber_pep_register_handler(const char *shortname, const char *xmlns, JabberPEPHandler handlerfunc); @@ -51,8 +51,8 @@ /* * Publishes PEP item(s) * - * @parameter js The JabberStream associated with the connection this event should be published - * @parameter publish The publish node. This could be for example <publish node='http://jabber.org/protocol/tune'/> with an <item/> as subnode + * @parameter js The JabberStream associated with the connection this event should be published + * @parameter publish The publish node. This could be for example <publish node='http://jabber.org/protocol/tune'/> with an <item/> as subnode */ void jabber_pep_publish(JabberStream *js, xmlnode *publish);
--- a/libpurple/protocols/jabber/usermood.c Tue Jun 12 00:37:50 2007 +0000 +++ b/libpurple/protocols/jabber/usermood.c Tue Jun 12 01:25:46 2007 +0000 @@ -10,12 +10,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ @@ -25,135 +25,135 @@ #include <string.h> static char *moodstrings[] = { - "unknown", - "afraid", - "amazed", - "angry", - "annoyed", - "anxious", - "aroused", - "ashamed", - "bored", - "brave", - "calm", - "cold", - "confused", - "contented", - "cranky", - "curious", - "depressed", - "disappointed", - "disgusted", - "distracted", - "embarrassed", - "excited", - "flirtatious", - "frustrated", - "grumpy", - "guilty", - "happy", - "hot", - "humbled", - "humiliated", - "hungry", - "hurt", - "impressed", - "in_awe", - "in_love", - "indignant", - "interested", - "intoxicated", - "invincible", - "jealous", - "lonely", - "mean", - "moody", - "nervous", - "neutral", - "offended", - "playful", - "proud", - "relieved", - "remorseful", - "restless", - "sad", - "sarcastic", - "serious", - "shocked", - "shy", - "sick", - "sleepy", - "stressed", - "surprised", - "thirsty", - "worried", - NULL + "unknown", + "afraid", + "amazed", + "angry", + "annoyed", + "anxious", + "aroused", + "ashamed", + "bored", + "brave", + "calm", + "cold", + "confused", + "contented", + "cranky", + "curious", + "depressed", + "disappointed", + "disgusted", + "distracted", + "embarrassed", + "excited", + "flirtatious", + "frustrated", + "grumpy", + "guilty", + "happy", + "hot", + "humbled", + "humiliated", + "hungry", + "hurt", + "impressed", + "in_awe", + "in_love", + "indignant", + "interested", + "intoxicated", + "invincible", + "jealous", + "lonely", + "mean", + "moody", + "nervous", + "neutral", + "offended", + "playful", + "proud", + "relieved", + "remorseful", + "restless", + "sad", + "sarcastic", + "serious", + "shocked", + "shy", + "sick", + "sleepy", + "stressed", + "surprised", + "thirsty", + "worried", + NULL }; static void jabber_mood_cb(JabberStream *js, const char *from, xmlnode *items) { - /* it doesn't make sense to have more than one item here, so let's just pick the first one */ - xmlnode *item = xmlnode_get_child(items, "item"); - JabberMood newmood = UNKNOWN; - char *moodtext = NULL; - JabberBuddy *buddy = jabber_buddy_find(js, from, FALSE); - xmlnode *moodinfo, *mood; - /* ignore the mood of people not on our buddy list */ - if (!buddy || !item) - return; - - mood = xmlnode_get_child_with_namespace(item, "mood", "http://jabber.org/protocol/mood"); - if (!mood) - return; - for (moodinfo = mood->child; moodinfo != mood->lastchild; moodinfo = moodinfo->next) { - if (moodinfo->type == XMLNODE_TYPE_TAG) { - if (!strcmp(moodinfo->name, "text")) { - if (!moodtext) /* only pick the first one */ - moodtext = xmlnode_get_data(moodinfo); - } else { - int i; - for (i = 1; moodstrings[i]; ++i) { - if (!strcmp(moodinfo->name, moodstrings[i])) { - newmood = (JabberMood)i; - break; - } - } - } - if (newmood != UNKNOWN && moodtext != NULL) - break; - } - } - if (newmood != UNKNOWN) { - JabberBuddyResource *resource = jabber_buddy_find_resource(buddy, NULL); - const char *status_id = jabber_buddy_state_get_status_id(resource->state); - - purple_prpl_got_user_status(js->gc->account, from, status_id, "mood", newmood, "moodtext", moodtext?moodtext:"", NULL); - } - if (moodtext) - g_free(moodtext); + /* it doesn't make sense to have more than one item here, so let's just pick the first one */ + xmlnode *item = xmlnode_get_child(items, "item"); + JabberMood newmood = UNKNOWN; + char *moodtext = NULL; + JabberBuddy *buddy = jabber_buddy_find(js, from, FALSE); + xmlnode *moodinfo, *mood; + /* ignore the mood of people not on our buddy list */ + if (!buddy || !item) + return; + + mood = xmlnode_get_child_with_namespace(item, "mood", "http://jabber.org/protocol/mood"); + if (!mood) + return; + for (moodinfo = mood->child; moodinfo != mood->lastchild; moodinfo = moodinfo->next) { + if (moodinfo->type == XMLNODE_TYPE_TAG) { + if (!strcmp(moodinfo->name, "text")) { + if (!moodtext) /* only pick the first one */ + moodtext = xmlnode_get_data(moodinfo); + } else { + int i; + for (i = 1; moodstrings[i]; ++i) { + if (!strcmp(moodinfo->name, moodstrings[i])) { + newmood = (JabberMood)i; + break; + } + } + } + if (newmood != UNKNOWN && moodtext != NULL) + break; + } + } + if (newmood != UNKNOWN) { + JabberBuddyResource *resource = jabber_buddy_find_resource(buddy, NULL); + const char *status_id = jabber_buddy_state_get_status_id(resource->state); + + purple_prpl_got_user_status(js->gc->account, from, status_id, "mood", newmood, "moodtext", moodtext?moodtext:"", NULL); + } + if (moodtext) + g_free(moodtext); } void jabber_mood_init(void) { - jabber_add_feature("mood", "http://jabber.org/protocol/mood"); - jabber_pep_register_handler("moodn", "http://jabber.org/protocol/mood", jabber_mood_cb); + jabber_add_feature("mood", "http://jabber.org/protocol/mood"); + jabber_pep_register_handler("moodn", "http://jabber.org/protocol/mood", jabber_mood_cb); } void jabber_set_mood(JabberStream *js, JabberMood mood, const char *text) { - xmlnode *publish, *moodnode; - if (mood == UNKNOWN) - return; - - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/mood"); - moodnode = xmlnode_new_child(xmlnode_new_child(publish, "item"), "mood"); - xmlnode_set_namespace(moodnode, "http://jabber.org/protocol/mood"); - xmlnode_new_child(moodnode, moodstrings[mood]); + xmlnode *publish, *moodnode; + if (mood == UNKNOWN) + return; + + publish = xmlnode_new("publish"); + xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/mood"); + moodnode = xmlnode_new_child(xmlnode_new_child(publish, "item"), "mood"); + xmlnode_set_namespace(moodnode, "http://jabber.org/protocol/mood"); + xmlnode_new_child(moodnode, moodstrings[mood]); - if (text) { - xmlnode *textnode = xmlnode_new_child(moodnode, "text"); - xmlnode_insert_data(textnode, text, -1); - } - - jabber_pep_publish(js, publish); - - xmlnode_free(publish); + if (text) { + xmlnode *textnode = xmlnode_new_child(moodnode, "text"); + xmlnode_insert_data(textnode, text, -1); + } + + jabber_pep_publish(js, publish); + + xmlnode_free(publish); }
--- a/libpurple/protocols/jabber/usermood.h Tue Jun 12 00:37:50 2007 +0000 +++ b/libpurple/protocols/jabber/usermood.h Tue Jun 12 01:25:46 2007 +0000 @@ -10,12 +10,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ @@ -27,68 +27,68 @@ /* Implementation of XEP-0107 */ typedef enum _JabberMood { /* wtf */ - UNKNOWN = 0, - AFRAID, - AMAZED, - ANGRY, - ANNOYED, - ANXIOUS, - AROUSED, - ASHAMED, - BORED, - BRAVE, - CALM, - COLD, - CONFUSED, - CONTENTED, - CRANKY, - CURIOUS, - DEPRESSED, - DISAPPOINTED, - DISGUSTED, - DISTRACTED, - EMBARRASSED, - EXCITED, - FLIRTATIOUS, - FRUSTRATED, - GRUMPY, - GUILTY, - HAPPY, - HOT, - HUMBLED, - HUMILIATED, - HUNGRY, - HURT, - IMPRESSED, - IN_AWE, - IN_LOVE, - INDIGNANT, - INTERESTED, - INTOXICATED, - INVINCIBLE, - JEALOUS, - LONELY, - MEAN, - MOODY, - NERVOUS, - NEUTRAL, - OFFENDED, - PLAYFUL, - PROUD, - RELIEVED, - REMORSEFUL, - RESTLESS, - SAD, - SARCASTIC, - SERIOUS, - SHOCKED, - SHY, - SICK, - SLEEPY, - STRESSED, - SURPRISED, - THIRSTY, - WORRIED + UNKNOWN = 0, + AFRAID, + AMAZED, + ANGRY, + ANNOYED, + ANXIOUS, + AROUSED, + ASHAMED, + BORED, + BRAVE, + CALM, + COLD, + CONFUSED, + CONTENTED, + CRANKY, + CURIOUS, + DEPRESSED, + DISAPPOINTED, + DISGUSTED, + DISTRACTED, + EMBARRASSED, + EXCITED, + FLIRTATIOUS, + FRUSTRATED, + GRUMPY, + GUILTY, + HAPPY, + HOT, + HUMBLED, + HUMILIATED, + HUNGRY, + HURT, + IMPRESSED, + IN_AWE, + IN_LOVE, + INDIGNANT, + INTERESTED, + INTOXICATED, + INVINCIBLE, + JEALOUS, + LONELY, + MEAN, + MOODY, + NERVOUS, + NEUTRAL, + OFFENDED, + PLAYFUL, + PROUD, + RELIEVED, + REMORSEFUL, + RESTLESS, + SAD, + SARCASTIC, + SERIOUS, + SHOCKED, + SHY, + SICK, + SLEEPY, + STRESSED, + SURPRISED, + THIRSTY, + WORRIED } JabberMood; void jabber_mood_init(void);