# HG changeset patch # User Andreas Monitzer # Date 1188327787 0 # Node ID b0733d5d76216b57ff28e2000220740ef0cb4f17 # Parent ebe2d2e71223d2740ab585e9deea6d63ca9e6474 Fixed code indenting, some spaces were still left and now replaced by tabs. diff -r ebe2d2e71223 -r b0733d5d7621 libpurple/protocols/jabber/buddy.c --- a/libpurple/protocols/jabber/buddy.c Tue Aug 28 07:09:48 2007 +0000 +++ b/libpurple/protocols/jabber/buddy.c Tue Aug 28 19:03:07 2007 +0000 @@ -129,7 +129,7 @@ jbr->state = state; if(jbr->status) g_free(jbr->status); - if (status) + if (status) jbr->status = g_markup_escape_text(status, -1); else jbr->status = NULL; @@ -2279,10 +2279,10 @@ * in purple-i18n@lists.sourceforge.net (March 2006) */ static const char * jabber_user_dir_comments [] = { - /* current comment from Jabber User Directory users.jabber.org */ - N_("Find a contact by entering the search criteria in the given fields. " - "Note: Each field supports wild card searches (%)"), - NULL + /* current comment from Jabber User Directory users.jabber.org */ + N_("Find a contact by entering the search criteria in the given fields. " + "Note: Each field supports wild card searches (%)"), + NULL }; #endif diff -r ebe2d2e71223 -r b0733d5d7621 libpurple/protocols/jabber/disco.c --- a/libpurple/protocols/jabber/disco.c Tue Aug 28 07:09:48 2007 +0000 +++ b/libpurple/protocols/jabber/disco.c Tue Aug 28 19:03:07 2007 +0000 @@ -102,61 +102,61 @@ SUPPORT_FEATURE("http://jabber.org/protocol/xhtml-im") SUPPORT_FEATURE("urn:xmpp:ping") SUPPORT_FEATURE("http://www.xmpp.org/extensions/xep-0199.html#ns") - - if(!node) { /* non-caps disco#info, add all enabled extensions */ - GList *features; - for(features = jabber_features; features; features = features->next) { - JabberFeature *feat = (JabberFeature*)features->data; + + if(!node) { /* non-caps disco#info, add all enabled extensions */ + GList *features; + for(features = jabber_features; features; features = features->next) { + JabberFeature *feat = (JabberFeature*)features->data; if(feat->is_enabled == NULL || feat->is_enabled(js, feat->shortname, feat->namespace) == TRUE) SUPPORT_FEATURE(feat->namespace); - } - } + } + } } else { - const char *ext = NULL; - unsigned pos; - unsigned nodelen = strlen(node); - unsigned capslen = strlen(CAPS0115_NODE); - /* do a basic plausability check */ - if(nodelen > capslen+1) { - /* verify that the string is CAPS0115# and get the pointer to the ext part */ - for(pos = 0; pos < capslen+1; ++pos) { - if(pos == capslen) { - if(node[pos] == '#') - ext = &node[pos+1]; - else - break; - } else if(node[pos] != CAPS0115_NODE[pos]) - break; - } - - if(ext != NULL) { - /* look for that ext */ - GList *features; - for(features = jabber_features; features; features = features->next) { - JabberFeature *feat = (JabberFeature*)features->data; - if(!strcmp(feat->shortname, ext)) { + const char *ext = NULL; + unsigned pos; + unsigned nodelen = strlen(node); + unsigned capslen = strlen(CAPS0115_NODE); + /* do a basic plausability check */ + if(nodelen > capslen+1) { + /* verify that the string is CAPS0115# and get the pointer to the ext part */ + for(pos = 0; pos < capslen+1; ++pos) { + if(pos == capslen) { + if(node[pos] == '#') + ext = &node[pos+1]; + else + break; + } else if(node[pos] != CAPS0115_NODE[pos]) + break; + } + + if(ext != NULL) { + /* look for that ext */ + GList *features; + for(features = jabber_features; features; features = features->next) { + JabberFeature *feat = (JabberFeature*)features->data; + if(!strcmp(feat->shortname, ext)) { SUPPORT_FEATURE(feat->namespace); break; - } - } - if(features == NULL) - ext = NULL; - } - } - - if(ext == NULL) { - xmlnode *error, *inf; - - /* XXX: gross hack, implement jabber_iq_set_type or something */ - xmlnode_set_attrib(iq->node, "type", "error"); - iq->type = JABBER_IQ_ERROR; - - error = xmlnode_new_child(query, "error"); - xmlnode_set_attrib(error, "code", "404"); - xmlnode_set_attrib(error, "type", "cancel"); - inf = xmlnode_new_child(error, "item-not-found"); - xmlnode_set_namespace(inf, "urn:ietf:params:xml:ns:xmpp-stanzas"); - } + } + } + if(features == NULL) + ext = NULL; + } + } + + if(ext == NULL) { + xmlnode *error, *inf; + + /* XXX: gross hack, implement jabber_iq_set_type or something */ + xmlnode_set_attrib(iq->node, "type", "error"); + iq->type = JABBER_IQ_ERROR; + + error = xmlnode_new_child(query, "error"); + xmlnode_set_attrib(error, "code", "404"); + xmlnode_set_attrib(error, "type", "cancel"); + inf = xmlnode_new_child(error, "item-not-found"); + xmlnode_set_namespace(inf, "urn:ietf:params:xml:ns:xmpp-stanzas"); + } } jabber_iq_send(iq); @@ -330,8 +330,8 @@ const char *category, *type, *name; category = xmlnode_get_attrib(child, "category"); type = xmlnode_get_attrib(child, "type"); - if(category && type && !strcmp(category, "pubsub") && !strcmp(type,"pep")) - js->pep = TRUE; + if(category && type && !strcmp(category, "pubsub") && !strcmp(type,"pep")) + js->pep = TRUE; if (!category || strcmp(category, "server")) continue; if (!type || strcmp(type, "im")) diff -r ebe2d2e71223 -r b0733d5d7621 libpurple/protocols/jabber/jabber.c --- a/libpurple/protocols/jabber/jabber.c Tue Aug 28 07:09:48 2007 +0000 +++ b/libpurple/protocols/jabber/jabber.c Tue Aug 28 19:03:07 2007 +0000 @@ -818,7 +818,7 @@ jabber_register_cancel_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) { PurpleAccount *account = purple_connection_get_account(cbdata->js->gc); - if(cbdata->js->registration) { + if(account && cbdata->js->registration) { if(account->registration_cb) (account->registration_cb)(account, FALSE, account->registration_cb_user_data); jabber_connection_schedule_close(cbdata->js); diff -r ebe2d2e71223 -r b0733d5d7621 libpurple/protocols/jabber/libxmpp.c --- a/libpurple/protocols/jabber/libxmpp.c Tue Aug 28 07:09:48 2007 +0000 +++ b/libpurple/protocols/jabber/libxmpp.c Tue Aug 28 19:03:07 2007 +0000 @@ -194,63 +194,63 @@ static void init_plugin(PurplePlugin *plugin) { - PurpleAccountUserSplit *split; - PurpleAccountOption *option; - + PurpleAccountUserSplit *split; + PurpleAccountOption *option; + /* Translators: 'domain' is used here in the context of Internet domains, e.g. pidgin.im */ - split = purple_account_user_split_new(_("Domain"), NULL, '@'); - purple_account_user_split_set_reverse(split, FALSE); - prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); - - split = purple_account_user_split_new(_("Resource"), "Home", '/'); - purple_account_user_split_set_reverse(split, FALSE); - prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); - - option = purple_account_option_bool_new(_("Require SSL/TLS"), "require_tls", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_bool_new(_("Force old (port 5223) SSL"), "old_ssl", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_bool_new( - _("Allow plaintext auth over unencrypted streams"), - "auth_plain_in_clear", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); + split = purple_account_user_split_new(_("Domain"), NULL, '@'); + purple_account_user_split_set_reverse(split, FALSE); + prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); + + split = purple_account_user_split_new(_("Resource"), "Home", '/'); + purple_account_user_split_set_reverse(split, FALSE); + prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); + + option = purple_account_option_bool_new(_("Require SSL/TLS"), "require_tls", FALSE); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + option = purple_account_option_bool_new(_("Force old (port 5223) SSL"), "old_ssl", FALSE); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + option = purple_account_option_bool_new( + _("Allow plaintext auth over unencrypted streams"), + "auth_plain_in_clear", FALSE); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + option = purple_account_option_int_new(_("Connect port"), "port", 5222); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + option = purple_account_option_string_new(_("Connect server"), + "connect_server", NULL); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + + jabber_init_plugin(plugin); + + purple_prefs_remove("/plugins/prpl/jabber"); + + /* XXX - If any other plugin wants SASL this won't be good ... */ +#ifdef HAVE_CYRUS_SASL + sasl_client_init(NULL); +#endif + jabber_register_commands(); + + jabber_iq_init(); + jabber_pep_init(); + + jabber_tune_init(); + jabber_caps_init(); - option = purple_account_option_int_new(_("Connect port"), "port", 5222); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_string_new(_("Connect server"), - "connect_server", NULL); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - - jabber_init_plugin(plugin); - - purple_prefs_remove("/plugins/prpl/jabber"); - - /* XXX - If any other plugin wants SASL this won't be good ... */ -#ifdef HAVE_CYRUS_SASL - sasl_client_init(NULL); -#endif - jabber_register_commands(); - - jabber_iq_init(); - jabber_pep_init(); - - jabber_tune_init(); - jabber_caps_init(); - - jabber_add_feature("avatarmeta", AVATARNAMESPACEMETA, jabber_pep_namespace_only_when_pep_enabled_cb); - jabber_add_feature("avatardata", AVATARNAMESPACEDATA, jabber_pep_namespace_only_when_pep_enabled_cb); - jabber_add_feature("buzz", "http://www.xmpp.org/extensions/xep-0224.html#ns", jabber_buzz_isenabled); - - jabber_pep_register_handler("avatar", AVATARNAMESPACEMETA, jabber_buddy_avatar_update_metadata); + jabber_add_feature("avatarmeta", AVATARNAMESPACEMETA, jabber_pep_namespace_only_when_pep_enabled_cb); + jabber_add_feature("avatardata", AVATARNAMESPACEDATA, jabber_pep_namespace_only_when_pep_enabled_cb); + jabber_add_feature("buzz", "http://www.xmpp.org/extensions/xep-0224.html#ns", jabber_buzz_isenabled); + + jabber_pep_register_handler("avatar", AVATARNAMESPACEMETA, jabber_buddy_avatar_update_metadata); } diff -r ebe2d2e71223 -r b0733d5d7621 libpurple/protocols/jabber/presence.c --- a/libpurple/protocols/jabber/presence.c Tue Aug 28 07:09:48 2007 +0000 +++ b/libpurple/protocols/jabber/presence.c Tue Aug 28 19:03:07 2007 +0000 @@ -256,39 +256,39 @@ xmlnode_set_namespace(c, "http://jabber.org/protocol/caps"); xmlnode_set_attrib(c, "node", CAPS0115_NODE); xmlnode_set_attrib(c, "ver", VERSION); - - if(js != NULL) { - /* add the extensions */ - char extlist[1024]; - unsigned remaining = 1023; /* one less for the \0 */ - GList *feature; - - extlist[0] = '\0'; - for(feature = jabber_features; feature && remaining > 0; feature = feature->next) { - JabberFeature *feat = (JabberFeature*)feature->data; - unsigned featlen; - + + if(js != NULL) { + /* add the extensions */ + char extlist[1024]; + unsigned remaining = 1023; /* one less for the \0 */ + GList *feature; + + extlist[0] = '\0'; + for(feature = jabber_features; feature && remaining > 0; feature = feature->next) { + JabberFeature *feat = (JabberFeature*)feature->data; + unsigned featlen; + if(feat->is_enabled != NULL && feat->is_enabled(js, feat->shortname, feat->namespace) == FALSE) continue; /* skip this feature */ featlen = strlen(feat->shortname); - - /* cut off when we don't have any more space left in our buffer (too bad) */ - if(featlen > remaining) - break; - - strncat(extlist,feat->shortname,remaining); - remaining -= featlen; - if(feature->next) { /* no space at the end */ - strncat(extlist," ",remaining); - --remaining; - } - } - /* did we add anything? */ - if(remaining < 1023) - xmlnode_set_attrib(c, "ext", extlist); - } - + + /* cut off when we don't have any more space left in our buffer (too bad) */ + if(featlen > remaining) + break; + + strncat(extlist,feat->shortname,remaining); + remaining -= featlen; + if(feature->next) { /* no space at the end */ + strncat(extlist," ",remaining); + --remaining; + } + } + /* did we add anything? */ + if(remaining < 1023) + xmlnode_set_attrib(c, "ext", extlist); + } + return presence; } diff -r ebe2d2e71223 -r b0733d5d7621 libpurple/protocols/jabber/xdata.c --- a/libpurple/protocols/jabber/xdata.c Tue Aug 28 07:09:48 2007 +0000 +++ b/libpurple/protocols/jabber/xdata.c Tue Aug 28 19:03:07 2007 +0000 @@ -367,9 +367,9 @@ g_free(value); } - - if(field && xmlnode_get_child(fn, "required")) - purple_request_field_set_required(field,TRUE); + + if(field && xmlnode_get_child(fn, "required")) + purple_request_field_set_required(field,TRUE); } if(actions != NULL) {