gobjectification: 1ef8dbac: compile jabber.
sadrul at pidgin.im
sadrul at pidgin.im
Thu Mar 13 04:37:01 EDT 2008
-----------------------------------------------------------------
Revision: 1ef8dbac37ad58ea1822f8fdd5b01770f3f715a6
Ancestor: 7c507b08162a17fd19e22740c0e4ec10613125a7
Author: sadrul at pidgin.im
Date: 2008-03-13T06:42:09
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/1ef8dbac37ad58ea1822f8fdd5b01770f3f715a6
Modified files:
libpurple/protocols/jabber/adhoccommands.c
libpurple/protocols/jabber/auth.c
libpurple/protocols/jabber/buddy.c
libpurple/protocols/jabber/chat.c
libpurple/protocols/jabber/disco.c
libpurple/protocols/jabber/google.c
libpurple/protocols/jabber/jabber.c
libpurple/protocols/jabber/jutil.c
libpurple/protocols/jabber/message.c
libpurple/protocols/jabber/oob.c
libpurple/protocols/jabber/parser.c
libpurple/protocols/jabber/ping.c
libpurple/protocols/jabber/presence.c
libpurple/protocols/jabber/roster.c
libpurple/protocols/jabber/si.c
libpurple/protocols/jabber/usermood.c
libpurple/protocols/jabber/usernick.c
libpurple/protocols/jabber/usertune.c
libpurple/protocols/jabber/xdata.c
ChangeLog:
compile jabber.
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/adhoccommands.c c0cd56217d0f15123226823ea3521e117c3041c6
+++ libpurple/protocols/jabber/adhoccommands.c b310d0e2d419f5e45fbbb7d606d29bb9b530304f
@@ -211,7 +211,7 @@ void jabber_adhoc_execute_action(PurpleB
if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
JabberAdHocCommands *cmd = data;
PurpleBuddy *buddy = (PurpleBuddy *) node;
- JabberStream *js = purple_account_get_connection(buddy->account)->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(buddy->account)));
jabber_adhoc_execute(js, cmd);
}
@@ -278,7 +278,7 @@ static void jabber_adhoc_server_execute(
JabberAdHocCommands *cmd = action->user_data;
if(cmd) {
PurpleConnection *gc = (PurpleConnection *) action->context;
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
jabber_adhoc_execute(js, cmd);
}
============================================================
--- libpurple/protocols/jabber/auth.c 614e361267945e9b30c59e8b85a91fc31cc45148
+++ libpurple/protocols/jabber/auth.c 94c8e83400a7596ddd0d18afad9eecfca551a58e
@@ -51,7 +51,7 @@ jabber_process_starttls(JabberStream *js
"<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>", -1);
return TRUE;
} else if(xmlnode_get_child(starttls, "required")) {
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
_("Server requires TLS/SSL for login. No TLS/SSL support found."));
return TRUE;
@@ -79,7 +79,7 @@ static void finish_plaintext_authenticat
response = g_string_append(response, js->user->node);
response = g_string_append_len(response, "\0", 1);
response = g_string_append(response,
- purple_connection_get_password(purple_account_get_connection(js)));
+ purple_connection_get_password(js->gc));
enc_out = purple_base64_encode((guchar *)response->str, response->len);
@@ -101,7 +101,7 @@ static void finish_plaintext_authenticat
x = xmlnode_new_child(query, "resource");
xmlnode_insert_data(x, js->user->resource, -1);
x = xmlnode_new_child(query, "password");
- xmlnode_insert_data(x, purple_connection_get_password(purple_account_get_connection(js)), -1);
+ xmlnode_insert_data(x, purple_connection_get_password(js->gc), -1);
jabber_iq_set_callback(iq, auth_old_result_cb, NULL);
jabber_iq_send(iq);
}
@@ -111,7 +111,7 @@ static void allow_plaintext_auth(PurpleA
{
purple_account_set_bool(account, "auth_plain_in_clear", TRUE);
- finish_plaintext_authentication(purple_account_get_connection(account)->proto_data);
+ finish_plaintext_authentication(purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(account))));
}
static void disallow_plaintext_auth(PurpleAccount *account)
@@ -160,7 +160,7 @@ static int jabber_sasl_cb_secret(sasl_co
static int jabber_sasl_cb_secret(sasl_conn_t *conn, void *ctx, int id, sasl_secret_t **secret)
{
JabberStream *js = (JabberStream *)ctx;
- const char *pw = purple_account_get_password(purple_account_get_connection(js)->account);
+ const char *pw = purple_account_get_password(purple_connection_get_account(js->gc));
size_t len;
static sasl_secret_t *x = NULL;
@@ -184,7 +184,7 @@ static void allow_cyrus_plaintext_auth(P
{
purple_account_set_bool(account, "auth_plain_in_clear", TRUE);
- jabber_auth_start_cyrus(purple_account_get_connection(account)->proto_data);
+ jabber_auth_start_cyrus(purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(account))));
}
static gboolean auth_pass_generic(JabberStream *js, PurpleRequestFields *fields)
@@ -197,14 +197,14 @@ static gboolean auth_pass_generic(Jabber
if (!entry || !*entry)
{
- purple_notify_error(purple_account_get_connection(js)->account, NULL, _("Password is required to sign on."), NULL);
+ purple_notify_error(purple_connection_get_account(js->gc), NULL, _("Password is required to sign on."), NULL);
return FALSE;
}
if (remember)
- purple_account_set_remember_password(purple_account_get_connection(js)->account, TRUE);
+ purple_account_set_remember_password(purple_connection_get_account(js->gc), TRUE);
- purple_account_set_password(purple_account_get_connection(js)->account, entry);
+ purple_account_set_password(purple_connection_get_account(js->gc), entry);
return TRUE;
}
@@ -217,7 +217,7 @@ static void auth_pass_cb(PurpleConnectio
if (!PURPLE_CONNECTION_IS_VALID(conn))
return;
- js = conn->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(conn));
if (!auth_pass_generic(js, fields))
return;
@@ -238,7 +238,7 @@ auth_old_pass_cb(PurpleConnection *conn,
if (!PURPLE_CONNECTION_IS_VALID(conn))
return;
- js = conn->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(conn));
if (!auth_pass_generic(js, fields))
return;
@@ -257,7 +257,7 @@ auth_no_pass_cb(PurpleConnection *conn,
if (!PURPLE_CONNECTION_IS_VALID(conn))
return;
- js = conn->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(conn));
/* Disable the account as the user has canceled connecting */
purple_account_set_enabled(conn->account, purple_core_get_ui(), FALSE);
@@ -280,7 +280,7 @@ static void jabber_auth_start_cyrus(Jabb
if (!js->gsc) {
secprops.max_ssf = -1;
secprops.maxbufsize = 4096;
- plaintext = purple_account_get_bool(purple_account_get_connection(js)->account, "auth_plain_in_clear", FALSE);
+ plaintext = purple_account_get_bool(purple_connection_get_account(js->gc), "auth_plain_in_clear", FALSE);
if (!plaintext)
secprops.security_flags |= SASL_SEC_NOPLAINTEXT;
} else {
@@ -312,8 +312,8 @@ static void jabber_auth_start_cyrus(Jabb
* to get one
*/
- if (!purple_account_get_password(purple_account_get_connection(js)->account)) {
- purple_account_request_password(purple_account_get_connection(js)->account, G_CALLBACK(auth_pass_cb), G_CALLBACK(auth_no_pass_cb), purple_account_get_connection(js));
+ if (!purple_account_get_password(purple_connection_get_account(js->gc))) {
+ purple_account_request_password(purple_connection_get_account(js->gc), G_CALLBACK(auth_pass_cb), G_CALLBACK(auth_no_pass_cb), js->gc);
return;
/* If we've got a password, but aren't sending
@@ -322,11 +322,11 @@ static void jabber_auth_start_cyrus(Jabb
*/
} else if (!plaintext) {
char *msg = g_strdup_printf(_("%s requires plaintext authentication over an unencrypted connection. Allow this and continue authentication?"),
- purple_account_get_connection(js)purple_account_get_username(->account));
- purple_request_yes_no(purple_account_get_connection(js), _("Plaintext Authentication"),
+ purple_connection_get_account(js->gc)->username);
+ purple_request_yes_no(js->gc, _("Plaintext Authentication"),
_("Plaintext Authentication"),
msg,
- 1, purple_account_get_connection(js)->account, NULL, NULL, purple_account_get_connection(js)->account,
+ 1, purple_connection_get_account(js->gc), NULL, NULL, purple_connection_get_account(js->gc),
allow_cyrus_plaintext_auth,
disallow_plaintext_auth);
g_free(msg);
@@ -401,7 +401,7 @@ static void jabber_auth_start_cyrus(Jabb
jabber_send(js, auth);
xmlnode_free(auth);
} else {
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE,
"SASL authentication failed\n");
}
@@ -441,7 +441,7 @@ jabber_sasl_build_callbacks(JabberStream
js->sasl_cb[id].context = (void *)js;
id++;
- if (purple_account_get_password(purple_account_get_connection(js)->account) != NULL ) {
+ if (purple_account_get_password(purple_connection_get_account(js->gc)) != NULL ) {
js->sasl_cb[id].id = SASL_CB_PASS;
js->sasl_cb[id].proc = jabber_sasl_cb_secret;
js->sasl_cb[id].context = (void *)js;
@@ -476,7 +476,7 @@ jabber_auth_start(JabberStream *js, xmln
mechs = xmlnode_get_child(packet, "mechanisms");
if(!mechs) {
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("Invalid response from server."));
return;
@@ -523,22 +523,22 @@ jabber_auth_start(JabberStream *js, xmln
} else if(plain) {
js->auth_type = JABBER_AUTH_PLAIN;
- if(js->gsc == NULL && !purple_account_get_bool(purple_account_get_connection(js)->account, "auth_plain_in_clear", FALSE)) {
+ if(js->gsc == NULL && !purple_account_get_bool(purple_connection_get_account(js->gc), "auth_plain_in_clear", FALSE)) {
char *msg = g_strdup_printf(_("%s requires plaintext authentication over an unencrypted connection. Allow this and continue authentication?"),
- purple_account_get_connection(js)purple_account_get_username(->account));
- purple_request_yes_no(purple_account_get_connection(js), _("Plaintext Authentication"),
+ purple_connection_get_account(js->gc)->username);
+ purple_request_yes_no(js->gc, _("Plaintext Authentication"),
_("Plaintext Authentication"),
msg,
1,
- purple_connection_get_account(purple_account_get_connection(js)), NULL, NULL,
- purple_connection_get_account(purple_account_get_connection(js)), allow_plaintext_auth,
+ purple_connection_get_account(js->gc), NULL, NULL,
+ purple_connection_get_account(js->gc), allow_plaintext_auth,
disallow_plaintext_auth);
g_free(msg);
return;
}
finish_plaintext_authentication(js);
} else {
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE,
_("Server does not use any supported authentication method"));
}
@@ -563,11 +563,11 @@ static void auth_old_result_cb(JabberStr
!strcmp(err_code, "401")) {
reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
/* Clear the pasword if it isn't being saved */
- if (!purple_account_get_remember_password(purple_account_get_connection(js)->account))
- purple_account_set_password(purple_account_get_connection(js)->account, NULL);
+ if (!purple_account_get_remember_password(purple_connection_get_account(js->gc)))
+ purple_account_set_password(purple_connection_get_account(js->gc), NULL);
}
- purple_connection_error_reason (purple_account_get_connection(js), reason, msg);
+ purple_connection_error_reason (js->gc, reason, msg);
g_free(msg);
}
}
@@ -642,17 +642,17 @@ static void auth_old_cb(JabberStream *js
JabberIq *iq;
xmlnode *query, *x;
const char *type = xmlnode_get_attrib(packet, "type");
- const char *pw = purple_connection_get_password(purple_account_get_connection(js));
+ const char *pw = purple_connection_get_password(js->gc);
if(!type) {
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("Invalid response from server."));
return;
} else if(!strcmp(type, "error")) {
PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
char *msg = jabber_parse_error(js, packet, &reason);
- purple_connection_error_reason (purple_account_get_connection(js), reason, msg);
+ purple_connection_error_reason (js->gc, reason, msg);
g_free(msg);
} else if(!strcmp(type, "result")) {
query = xmlnode_get_child(packet, "query");
@@ -715,20 +715,20 @@ static void auth_old_cb(JabberStream *js
jabber_iq_send(iq);
} else if(xmlnode_get_child(query, "password")) {
- if(js->gsc == NULL && !purple_account_get_bool(purple_account_get_connection(js)->account,
+ if(js->gsc == NULL && !purple_account_get_bool(purple_connection_get_account(js->gc),
"auth_plain_in_clear", FALSE)) {
- purple_request_yes_no(purple_account_get_connection(js), _("Plaintext Authentication"),
+ purple_request_yes_no(js->gc, _("Plaintext Authentication"),
_("Plaintext Authentication"),
_("This server requires plaintext authentication over an unencrypted connection. Allow this and continue authentication?"),
1,
- purple_connection_get_account(purple_account_get_connection(js)), NULL, NULL,
- purple_connection_get_account(purple_account_get_connection(js)), allow_plaintext_auth,
+ purple_connection_get_account(js->gc), NULL, NULL,
+ purple_connection_get_account(js->gc), allow_plaintext_auth,
disallow_plaintext_auth);
return;
}
finish_plaintext_authentication(js);
} else {
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE,
_("Server does not use any supported authentication method"));
return;
@@ -747,8 +747,8 @@ void jabber_auth_start_old(JabberStream
* password prompting here
*/
- if (!purple_account_get_password(purple_account_get_connection(js)->account)) {
- purple_account_request_password(purple_account_get_connection(js)->account, G_CALLBACK(auth_old_pass_cb), G_CALLBACK(auth_no_pass_cb), purple_account_get_connection(js));
+ if (!purple_account_get_password(purple_connection_get_account(js->gc))) {
+ purple_account_request_password(purple_connection_get_account(js->gc), G_CALLBACK(auth_old_pass_cb), G_CALLBACK(auth_no_pass_cb), js->gc);
return;
}
#endif
@@ -894,7 +894,7 @@ jabber_auth_handle_challenge(JabberStrea
GHashTable *parts;
if(!enc_in) {
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("Invalid response from server."));
return;
@@ -917,7 +917,7 @@ jabber_auth_handle_challenge(JabberStrea
"<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl' />",
-1);
} else {
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("Invalid challenge from server"));
}
@@ -942,7 +942,7 @@ jabber_auth_handle_challenge(JabberStrea
realm = js->user->domain;
if (nonce == NULL || realm == NULL)
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("Invalid challenge from server"));
else {
@@ -957,12 +957,12 @@ jabber_auth_handle_challenge(JabberStrea
a2 = g_strdup_printf("AUTHENTICATE:xmpp/%s", realm);
auth_resp = generate_response_value(js->user,
- purple_connection_get_password(purple_account_get_connection(js)), nonce, cnonce, a2, realm);
+ purple_connection_get_password(js->gc), nonce, cnonce, a2, realm);
g_free(a2);
a2 = g_strdup_printf(":xmpp/%s", realm);
js->expected_rspauth = generate_response_value(js->user,
- purple_connection_get_password(purple_account_get_connection(js)), nonce, cnonce, a2, realm);
+ purple_connection_get_password(js->gc), nonce, cnonce, a2, realm);
g_free(a2);
g_string_append_printf(response, "username=\"%s\"", js->user->node);
@@ -1016,7 +1016,7 @@ jabber_auth_handle_challenge(JabberStrea
g_free(dec_in);
if (js->sasl_state != SASL_CONTINUE && js->sasl_state != SASL_OK) {
purple_debug_error("jabber", "Error is %d : %s\n",js->sasl_state,sasl_errdetail(js->sasl));
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("SASL error"));
return;
@@ -1043,7 +1043,7 @@ void jabber_auth_handle_success(JabberSt
#endif
if(!ns || strcmp(ns, "urn:ietf:params:xml:ns:xmpp-sasl")) {
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("Invalid response from server."));
return;
@@ -1070,7 +1070,7 @@ void jabber_auth_handle_success(JabberSt
if (js->sasl_state != SASL_OK) {
/* This should never happen! */
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("Invalid response from server."));
}
@@ -1094,11 +1094,11 @@ void jabber_auth_handle_failure(JabberSt
char *msg = jabber_parse_error(js, packet, &reason);
if(!msg) {
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("Invalid response from server."));
} else {
- purple_connection_error_reason (purple_account_get_connection(js), reason, msg);
+ purple_connection_error_reason (js->gc, reason, msg);
g_free(msg);
}
}
============================================================
--- libpurple/protocols/jabber/buddy.c 32a628382a9f100dd6e2ae6e2dc82586644b88ef
+++ libpurple/protocols/jabber/buddy.c e2c04e0f6fc1b8fee2f610ad40a9e752b03c2fdb
@@ -73,7 +73,7 @@ JabberBuddy *jabber_buddy_find(JabberStr
if (js->buddies == NULL)
return NULL;
- if(!(realname = jabber_normalize(purple_account_get_connection(js)->account, name)))
+ if(!(realname = jabber_normalize(purple_connection_get_account(js->gc), name)))
return NULL;
jb = g_hash_table_lookup(js->buddies, realname);
@@ -422,7 +422,7 @@ void jabber_set_info(PurpleConnection *g
{
PurpleStoredImage *img;
JabberIq *iq;
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
xmlnode *vc_node;
const struct tag_attr *tag_attr;
@@ -501,7 +501,7 @@ void jabber_set_buddy_icon(PurpleConnect
PurplePresence *gpresence;
PurpleStatus *status;
- if(((JabberStream*)gc->proto_data)->pep) {
+ if(((JabberStream*)purple_object_get_protocol_data(PURPLE_OBJECT(gc)))->pep) {
/* XEP-0084: User Avatars */
if(img) {
/* A PNG header, including the IHDR, but nothing else */
@@ -568,7 +568,7 @@ void jabber_set_buddy_icon(PurpleConnect
g_free(base64avatar);
/* publish the avatar itself */
- jabber_pep_publish((JabberStream*)gc->proto_data, publish);
+ jabber_pep_publish((JabberStream*)purple_object_get_protocol_data(PURPLE_OBJECT(gc)), publish);
/* next step: publish the metadata */
publish = xmlnode_new("publish");
@@ -594,7 +594,7 @@ void jabber_set_buddy_icon(PurpleConnect
g_free(heightstring);
/* publish the metadata */
- jabber_pep_publish((JabberStream*)gc->proto_data, publish);
+ jabber_pep_publish((JabberStream*)purple_object_get_protocol_data(PURPLE_OBJECT(gc)), publish);
g_free(hash);
} else { /* if(img) */
@@ -611,7 +611,7 @@ void jabber_set_buddy_icon(PurpleConnect
xmlnode_new_child(metadata, "stop");
/* publish the metadata */
- jabber_pep_publish((JabberStream*)gc->proto_data, publish);
+ jabber_pep_publish((JabberStream*)purple_object_get_protocol_data(PURPLE_OBJECT(gc)), publish);
}
} else {
purple_debug(PURPLE_DEBUG_ERROR, "jabber",
@@ -1127,7 +1127,7 @@ static void jabber_buddy_info_show_if_re
purple_notify_user_info_add_pair(user_info, NULL, jbi->vcard_text);
}
- purple_notify_userinfo(purple_account_get_connection(jbi->js), jbi->jid, user_info, NULL, NULL);
+ purple_notify_userinfo(jbi->js->gc, jbi->jid, user_info, NULL, NULL);
purple_notify_user_info_destroy(user_info);
while(jbi->vcard_imgids) {
@@ -1169,7 +1169,7 @@ static void jabber_vcard_save_mine(Jabbe
(vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp")))
{
txt = xmlnode_to_str(vcard, NULL);
- purple_account_set_user_info(purple_connection_get_account(purple_account_get_connection(js)), txt);
+ purple_account_set_user_info(purple_connection_get_account(js->gc), txt);
g_free(txt);
} else {
@@ -1178,8 +1178,8 @@ static void jabber_vcard_save_mine(Jabbe
js->vcard_fetched = TRUE;
- if(NULL != (img = purple_buddy_icons_find_account_icon(purple_account_get_connection(js)->account))) {
- jabber_set_buddy_icon(purple_account_get_connection(js), img);
+ if(NULL != (img = purple_buddy_icons_find_account_icon(purple_connection_get_account(js->gc)))) {
+ jabber_set_buddy_icon(js->gc, img);
purple_imgstore_unref(img);
}
}
@@ -1234,7 +1234,7 @@ static void jabber_vcard_parse(JabberStr
bare_jid = jabber_get_bare_jid(from);
- b = purple_find_buddy(purple_account_get_connection(js)->account, bare_jid);
+ b = purple_find_buddy(purple_connection_get_account(js->gc), bare_jid);
info_text = g_string_new("");
@@ -1274,7 +1274,7 @@ static void jabber_vcard_parse(JabberStr
g_free(text2);
}
} else if(text && !strcmp(child->name, "NICKNAME")) {
- serv_got_alias(purple_account_get_connection(js), from, text);
+ serv_got_alias(js->gc, from, text);
if(b) {
purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", text);
}
@@ -1431,7 +1431,7 @@ static void jabber_vcard_parse(JabberStr
for(i=0; i<20; i++, p+=2)
snprintf(p, 3, "%02x", hashval[i]);
- purple_buddy_icons_set_for_user(purple_account_get_connection(js)->account, bare_jid,
+ purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), bare_jid,
data, size, hash);
g_free(bintext);
}
@@ -1462,7 +1462,7 @@ static void do_buddy_avatar_update_fromu
return;
}
- purple_buddy_icons_set_for_user(purple_connection_get_account(purple_account_get_connection(info->js)), info->from, (void*)url_text, len, info->id);
+ purple_buddy_icons_set_for_user(purple_connection_get_account(info->js->gc), info->from, (void*)url_text, len, info->id);
g_free(info->from);
g_free(info->id);
g_free(info);
@@ -1499,12 +1499,12 @@ static void do_buddy_avatar_update_data(
return;
}
- purple_buddy_icons_set_for_user(purple_connection_get_account(purple_account_get_connection(js)), from, img, size, checksum);
+ purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, img, size, checksum);
g_free(b64data);
}
void jabber_buddy_avatar_update_metadata(JabberStream *js, const char *from, xmlnode *items) {
- PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(purple_account_get_connection(js)), from);
+ PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(js->gc), from);
const char *checksum;
xmlnode *item, *metadata;
if(!buddy)
@@ -1517,7 +1517,7 @@ void jabber_buddy_avatar_update_metadata
return;
/* check if we have received a stop */
if(xmlnode_get_child(metadata, "stop")) {
- purple_buddy_icons_set_for_user(purple_connection_get_account(purple_account_get_connection(js)), from, NULL, 0, NULL);
+ purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, NULL, 0, NULL);
} else {
xmlnode *info, *goodinfo = NULL;
@@ -1786,7 +1786,7 @@ void jabber_buddy_get_info(PurpleConnect
void jabber_buddy_get_info(PurpleConnection *gc, const char *who)
{
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
char *bare_jid = jabber_get_bare_jid(who);
if(bare_jid) {
@@ -1798,7 +1798,7 @@ void jabber_buddy_get_info_chat(PurpleCo
void jabber_buddy_get_info_chat(PurpleConnection *gc, int id,
const char *resource)
{
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
JabberChat *chat = jabber_chat_find_by_id(js, id);
char *full_jid;
@@ -1823,7 +1823,7 @@ static void jabber_buddy_set_invisibilit
char *msg;
int priority;
- account = purple_connection_get_account(purple_account_get_connection(js));
+ account = purple_connection_get_account(js->gc);
gpresence = purple_account_get_presence(account);
status = purple_presence_get_active_status(gpresence);
@@ -1854,7 +1854,7 @@ static void jabber_buddy_make_invisible(
buddy = (PurpleBuddy *) node;
gc = purple_account_get_connection(buddy->account);
- js = gc->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
jabber_buddy_set_invisibility(js, buddy->name, TRUE);
}
@@ -1869,7 +1869,7 @@ static void jabber_buddy_make_visible(Pu
buddy = (PurpleBuddy *) node;
gc = purple_account_get_connection(buddy->account);
- js = gc->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
jabber_buddy_set_invisibility(js, buddy->name, FALSE);
}
@@ -1885,7 +1885,7 @@ static void jabber_buddy_cancel_presence
buddy = (PurpleBuddy *) node;
gc = purple_account_get_connection(buddy->account);
- js = gc->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
/* I wonder if we should prompt the user before doing this */
jabber_presence_subscription_set(js, buddy->name, "unsubscribed");
@@ -1901,7 +1901,7 @@ static void jabber_buddy_rerequest_auth(
buddy = (PurpleBuddy *) node;
gc = purple_account_get_connection(buddy->account);
- js = gc->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
jabber_presence_subscription_set(js, buddy->name, "subscribe");
}
@@ -1917,7 +1917,7 @@ static void jabber_buddy_unsubscribe(Pur
buddy = (PurpleBuddy *) node;
gc = purple_account_get_connection(buddy->account);
- js = gc->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
jabber_presence_subscription_set(js, buddy->name, "unsubscribe");
}
@@ -1927,7 +1927,7 @@ static void jabber_buddy_login(PurpleBli
/* simply create a directed presence of the current status */
PurpleBuddy *buddy = (PurpleBuddy *) node;
PurpleConnection *gc = purple_account_get_connection(buddy->account);
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
PurpleAccount *account = purple_connection_get_account(gc);
PurplePresence *gpresence = purple_account_get_presence(account);
PurpleStatus *status = purple_presence_get_active_status(gpresence);
@@ -1952,7 +1952,7 @@ static void jabber_buddy_logout(PurpleBl
if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
/* simply create a directed unavailable presence */
PurpleBuddy *buddy = (PurpleBuddy *) node;
- JabberStream *js = purple_account_get_connection(buddy->account)->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(buddy->account)));
xmlnode *presence;
presence = jabber_presence_create_js(js, JABBER_BUDDY_STATE_UNAVAILABLE, NULL, 0);
@@ -1967,7 +1967,7 @@ static GList *jabber_buddy_menu(PurpleBu
static GList *jabber_buddy_menu(PurpleBuddy *buddy)
{
PurpleConnection *gc = purple_account_get_connection(buddy->account);
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
JabberBuddy *jb = jabber_buddy_find(js, buddy->name, TRUE);
GList *jbrs;
@@ -2283,7 +2283,7 @@ static void user_search_result_cb(Jabber
purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD,
user_search_result_add_buddy_cb);
- purple_notify_searchresults(purple_account_get_connection(js), NULL, NULL, _("The following are the results of your search"), results, NULL, NULL);
+ purple_notify_searchresults(js->gc, NULL, NULL, _("The following are the results of your search"), results, NULL, NULL);
}
static void user_search_x_data_cb(JabberStream *js, xmlnode *result, gpointer data)
@@ -2388,7 +2388,7 @@ static void user_search_fields_result_cb
if(!msg)
msg = g_strdup(_("Unknown error"));
- purple_notify_error(purple_account_get_connection(js), _("Directory Query Failed"),
+ purple_notify_error(js->gc, _("Directory Query Failed"),
_("Could not query the directory server."), msg);
g_free(msg);
@@ -2459,11 +2459,11 @@ static void user_search_fields_result_cb
usi->js = js;
usi->directory_server = g_strdup(from);
- purple_request_fields(purple_account_get_connection(js), _("Search for XMPP users"),
+ purple_request_fields(js->gc, _("Search for XMPP users"),
_("Search for XMPP users"), instructions, fields,
_("Search"), G_CALLBACK(user_search_cb),
_("Cancel"), G_CALLBACK(user_search_cancel_cb),
- purple_connection_get_account(purple_account_get_connection(js)), NULL, NULL,
+ purple_connection_get_account(js->gc), NULL, NULL,
usi);
g_free(instructions);
@@ -2476,7 +2476,7 @@ void jabber_user_search(JabberStream *js
/* XXX: should probably better validate the directory we're given */
if(!directory || !*directory) {
- purple_notify_error(purple_account_get_connection(js), _("Invalid Directory"), _("Invalid Directory"), NULL);
+ purple_notify_error(js->gc, _("Invalid Directory"), _("Invalid Directory"), NULL);
return;
}
@@ -2491,7 +2491,7 @@ void jabber_user_search_begin(PurplePlug
void jabber_user_search_begin(PurplePluginAction *action)
{
PurpleConnection *gc = (PurpleConnection *) action->context;
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
purple_request_input(gc, _("Enter a User Directory"), _("Enter a User Directory"),
_("Select a user directory to search"),
============================================================
--- libpurple/protocols/jabber/chat.c 9831cd3c31ce4bc211f22bc1e8de21ffaaede2f0
+++ libpurple/protocols/jabber/chat.c 6a161a8c97dd1018b01048f34bf722b2a6fd7f34
@@ -67,7 +67,7 @@ GHashTable *jabber_chat_info_defaults(Pu
GHashTable *jabber_chat_info_defaults(PurpleConnection *gc, const char *chat_name)
{
GHashTable *defaults;
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
@@ -137,7 +137,7 @@ JabberChat *jabber_chat_find_by_conv(Pur
{
PurpleAccount *account = purple_conversation_get_account(conv);
PurpleConnection *gc = purple_account_get_connection(account);
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
int id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv));
return jabber_chat_find_by_id(js, id);
@@ -146,7 +146,7 @@ void jabber_chat_invite(PurpleConnection
void jabber_chat_invite(PurpleConnection *gc, int id, const char *msg,
const char *name)
{
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
JabberChat *chat;
xmlnode *message, *body, *x, *invite;
char *room_jid;
@@ -201,7 +201,7 @@ void jabber_chat_join(PurpleConnection *
char *room, *server, *handle, *passwd;
xmlnode *presence, *x;
char *tmp, *room_jid, *full_jid;
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
PurplePresence *gpresence;
PurpleStatus *status;
JabberBuddyState state;
@@ -245,7 +245,7 @@ void jabber_chat_join(PurpleConnection *
g_free(tmp);
chat = g_new0(JabberChat, 1);
- chat->js = gc->proto_data;
+ chat->js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
chat->room = g_strdup(room);
chat->server = g_strdup(server);
@@ -281,7 +281,7 @@ void jabber_chat_leave(PurpleConnection
void jabber_chat_leave(PurpleConnection *gc, int id)
{
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
JabberChat *chat = jabber_chat_find_by_id(js, id);
@@ -321,7 +321,7 @@ char *jabber_chat_buddy_real_name(Purple
char *jabber_chat_buddy_real_name(PurpleConnection *gc, int id, const char *who)
{
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
JabberChat *chat;
chat = jabber_chat_find_by_id(js, id);
@@ -393,7 +393,7 @@ static void jabber_chat_room_configure_c
} else if(!strcmp(type, "error")) {
char *msg = jabber_parse_error(js, packet, NULL);
- purple_notify_error(purple_account_get_connection(js), _("Configuration error"), _("Configuration error"), msg);
+ purple_notify_error(js->gc, _("Configuration error"), _("Configuration error"), msg);
if(msg)
g_free(msg);
@@ -402,7 +402,7 @@ static void jabber_chat_room_configure_c
msg = g_strdup_printf("Unable to configure room %s", from);
- purple_notify_info(purple_account_get_connection(js), _("Unable to configure"), _("Unable to configure"), msg);
+ purple_notify_info(js->gc, _("Unable to configure"), _("Unable to configure"), msg);
g_free(msg);
}
@@ -417,7 +417,7 @@ void jabber_chat_request_room_configure(
chat->config_dialog_handle = NULL;
if(!chat->muc) {
- purple_notify_error(purple_account_get_connection(chat->js), _("Room Configuration Error"), _("Room Configuration Error"),
+ purple_notify_error(chat->js->gc, _("Room Configuration Error"), _("Room Configuration Error"),
_("This room is not capable of being configured"));
return;
}
@@ -467,7 +467,7 @@ static void jabber_chat_register_x_data_
if(type && !strcmp(type, "error")) {
char *msg = jabber_parse_error(js, packet, NULL);
- purple_notify_error(purple_account_get_connection(js), _("Registration error"), _("Registration error"), msg);
+ purple_notify_error(js->gc, _("Registration error"), _("Registration error"), msg);
if(msg)
g_free(msg);
@@ -536,7 +536,7 @@ static void jabber_chat_register_cb(Jabb
} else if(!strcmp(type, "error")) {
char *msg = jabber_parse_error(js, packet, NULL);
- purple_notify_error(purple_account_get_connection(js), _("Registration error"), _("Registration error"), msg);
+ purple_notify_error(js->gc, _("Registration error"), _("Registration error"), msg);
if(msg)
g_free(msg);
@@ -545,7 +545,7 @@ static void jabber_chat_register_cb(Jabb
msg = g_strdup_printf("Unable to configure room %s", from);
- purple_notify_info(purple_account_get_connection(js), _("Unable to configure"), _("Unable to configure"), msg);
+ purple_notify_info(js->gc, _("Unable to configure"), _("Unable to configure"), msg);
g_free(msg);
}
@@ -602,7 +602,7 @@ void jabber_chat_set_topic(PurpleConnect
void jabber_chat_set_topic(PurpleConnection *gc, int id, const char *topic)
{
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
JabberChat *chat = jabber_chat_find_by_id(js, id);
if(!chat)
@@ -629,7 +629,7 @@ void jabber_chat_change_nick(JabberChat
return;
}
- gpresence = purple_account_get_presence(purple_account_get_connection(chat->js)->account);
+ gpresence = purple_account_get_presence(purple_connection_get_account(chat->js->gc));
status = purple_presence_get_active_status(gpresence);
purple_status_to_jabber(status, &state, &msg, &priority);
@@ -674,7 +674,7 @@ static void roomlist_disco_result_cb(Jab
if(!(type = xmlnode_get_attrib(packet, "type")) || strcmp(type, "result")) {
char *err = jabber_parse_error(js, packet, NULL);
- purple_notify_error(purple_account_get_connection(js), _("Error"),
+ purple_notify_error(js->gc, _("Error"),
_("Error retrieving room list"), err);
purple_roomlist_set_in_progress(js->roomlist, FALSE);
purple_roomlist_unref(js->roomlist);
@@ -685,7 +685,7 @@ static void roomlist_disco_result_cb(Jab
if(!(query = xmlnode_get_child(packet, "query"))) {
char *err = jabber_parse_error(js, packet, NULL);
- purple_notify_error(purple_account_get_connection(js), _("Error"),
+ purple_notify_error(js->gc, _("Error"),
_("Error retrieving room list"), err);
purple_roomlist_set_in_progress(js->roomlist, FALSE);
purple_roomlist_unref(js->roomlist);
@@ -734,7 +734,7 @@ static void roomlist_ok_cb(JabberStream
return;
if(!server || !*server) {
- purple_notify_error(purple_account_get_connection(js), _("Invalid Server"), _("Invalid Server"), NULL);
+ purple_notify_error(js->gc, _("Invalid Server"), _("Invalid Server"), NULL);
return;
}
@@ -757,14 +757,14 @@ PurpleRoomlist *jabber_roomlist_get_list
PurpleRoomlist *jabber_roomlist_get_list(PurpleConnection *gc)
{
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
GList *fields = NULL;
PurpleRoomlistField *f;
if(js->roomlist)
purple_roomlist_unref(js->roomlist);
- js->roomlist = purple_roomlist_new(purple_connection_get_account(purple_account_get_connection(js)));
+ js->roomlist = purple_roomlist_new(purple_connection_get_account(js->gc));
f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "room", TRUE);
fields = g_list_append(fields, f);
@@ -796,7 +796,7 @@ void jabber_roomlist_cancel(PurpleRoomli
JabberStream *js;
gc = purple_account_get_connection(list->account);
- js = gc->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
purple_roomlist_set_in_progress(list, FALSE);
============================================================
--- libpurple/protocols/jabber/disco.c 8d626a775ccbbd50e960044217d7ed71eee00ae2
+++ libpurple/protocols/jabber/disco.c d6572cbc1906cf5b74af0319b6419820fcaf3003
@@ -338,7 +338,7 @@ jabber_disco_finish_server_info_result_c
}
/* Send initial presence; this will trigger receipt of presence for contacts on the roster */
- jabber_presence_send(purple_account_get_connection(js)->account, NULL);
+ jabber_presence_send(purple_connection_get_account(js->gc), NULL);
if (js->server_caps & JABBER_CAP_ADHOC) {
/* The server supports ad-hoc commands, so let's request the list */
============================================================
--- libpurple/protocols/jabber/google.c f5df5626884347c2b925b83b5fc15c9751c83132
+++ libpurple/protocols/jabber/google.c 0f32f325713cd08e5267a9f70c2baa01c646557d
@@ -65,7 +65,7 @@ jabber_gmail_parse(JabberStream *js, xml
if (count == 0 || !message) {
if (count > 0)
- purple_notify_emails(purple_account_get_connection(js), count, FALSE, NULL, NULL, (const char**) default_tos, NULL, NULL, NULL);
+ purple_notify_emails(js->gc, count, FALSE, NULL, NULL, (const char**) default_tos, NULL, NULL, NULL);
g_free(default_tos[0]);
return;
}
@@ -121,10 +121,10 @@ jabber_gmail_parse(JabberStream *js, xml
}
if (i>0)
- purple_notify_emails(purple_account_get_connection(js), count, count == i, (const char**) subjects, froms, tos,
+ purple_notify_emails(js->gc, count, count == i, (const char**) subjects, froms, tos,
urls, NULL, NULL);
else
- purple_notify_emails(purple_account_get_connection(js), count, FALSE, NULL, NULL, (const char**) default_tos, NULL, NULL, NULL);
+ purple_notify_emails(js->gc, count, FALSE, NULL, NULL, (const char**) default_tos, NULL, NULL, NULL);
g_free(to_name);
@@ -151,7 +151,7 @@ jabber_gmail_poke(JabberStream *js, xmln
JabberIq *iq;
/* bail if the user isn't interested */
- if (!purple_account_get_check_mail(purple_account_get_connection(js)->account))
+ if (!purple_account_get_check_mail(purple_connection_get_account(js->gc)))
return;
type = xmlnode_get_attrib(packet, "type");
@@ -180,7 +180,7 @@ void jabber_gmail_init(JabberStream *js)
void jabber_gmail_init(JabberStream *js) {
JabberIq *iq;
- if (!purple_account_get_check_mail(purple_account_get_connection(js)->account))
+ if (!purple_account_get_check_mail(purple_connection_get_account(js->gc)))
return;
iq = jabber_iq_new_query(js, JABBER_IQ_GET, "google:mail:notify");
@@ -204,7 +204,7 @@ void jabber_google_roster_outgoing(Jabbe
void jabber_google_roster_outgoing(JabberStream *js, xmlnode *query, xmlnode *item)
{
- PurpleAccount *account = purple_connection_get_account(purple_account_get_connection(js));
+ PurpleAccount *account = purple_connection_get_account(js->gc);
GSList *list = account->deny;
const char *jid = xmlnode_get_attrib(item, "jid");
char *jid_norm = g_strdup(jabber_normalize(account, jid));
@@ -226,7 +226,7 @@ gboolean jabber_google_roster_incoming(J
gboolean jabber_google_roster_incoming(JabberStream *js, xmlnode *item)
{
- PurpleAccount *account = purple_connection_get_account(purple_account_get_connection(js));
+ PurpleAccount *account = purple_connection_get_account(js->gc);
GSList *list = account->deny;
const char *jid = xmlnode_get_attrib(item, "jid");
gboolean on_block_list = FALSE;
@@ -284,14 +284,14 @@ void jabber_google_roster_add_deny(Purpl
PurpleBuddy *b;
JabberBuddy *jb;
- js = (JabberStream*)(gc->proto_data);
+ js = (JabberStream*)(purple_object_get_protocol_data(PURPLE_OBJECT(gc)));
if (!js || !js->server_caps & JABBER_CAP_GOOGLE_ROSTER)
return;
jb = jabber_buddy_find(js, who, TRUE);
- buddies = purple_find_buddies(purple_account_get_connection(js)->account, who);
+ buddies = purple_find_buddies(purple_connection_get_account(js->gc), who);
if(!buddies)
return;
@@ -357,12 +357,12 @@ void jabber_google_roster_rem_deny(Purpl
g_return_if_fail(gc != NULL);
g_return_if_fail(who != NULL);
- js = (JabberStream*)(gc->proto_data);
+ js = (JabberStream*)(purple_object_get_protocol_data(PURPLE_OBJECT(gc)));
if (!js || !js->server_caps & JABBER_CAP_GOOGLE_ROSTER)
return;
- buddies = purple_find_buddies(purple_account_get_connection(js)->account, who);
+ buddies = purple_find_buddies(purple_connection_get_account(js->gc), who);
if(!buddies)
return;
@@ -522,11 +522,11 @@ void jabber_google_presence_incoming(Jab
if (!js->googletalk)
return;
if (jbr->status && !strncmp(jbr->status, "â« ", strlen("â« "))) {
- purple_prpl_got_user_status(purple_account_get_connection(js)->account, user, "tune",
+ purple_prpl_got_user_status(purple_connection_get_account(js->gc), user, "tune",
PURPLE_TUNE_TITLE, jbr->status + strlen("â« "), NULL);
jbr->status = NULL;
} else {
- purple_prpl_got_user_status_deactive(purple_account_get_connection(js)->account, user, "tune");
+ purple_prpl_got_user_status_deactive(purple_connection_get_account(js->gc), user, "tune");
}
}
============================================================
--- libpurple/protocols/jabber/jabber.c cbb85fe8b77dd24886c8100d8c84fe2a6991caac
+++ libpurple/protocols/jabber/jabber.c 4a651e21bc6ab544ec9ed0d74cc50dad5aaa9975
@@ -89,7 +89,7 @@ jabber_session_initialized_cb(JabberStre
if(js->unregistration)
jabber_unregister_account_cb(js);
} else {
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
("Error initializing session"));
}
@@ -122,7 +122,7 @@ static void jabber_bind_result_cb(Jabber
JabberBuddy *my_jb = NULL;
jabber_id_free(js->user);
if(!(js->user = jabber_id_new(full_jid))) {
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("Invalid response from server."));
}
@@ -133,7 +133,7 @@ static void jabber_bind_result_cb(Jabber
} else {
PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
char *msg = jabber_parse_error(js, packet, &reason);
- purple_connection_error_reason (purple_account_get_connection(js), reason, msg);
+ purple_connection_error_reason (js->gc, reason, msg);
g_free(msg);
}
@@ -145,8 +145,8 @@ static void jabber_stream_features_parse
if(xmlnode_get_child(packet, "starttls")) {
if(jabber_process_starttls(js, packet))
return;
- } else if(purple_account_get_bool(purple_account_get_connection(js)->account, "require_tls", FALSE) && !js->gsc) {
- purple_connection_error_reason (purple_account_get_connection(js),
+ } else if(purple_account_get_bool(purple_connection_get_account(js->gc), "require_tls", FALSE) && !js->gsc) {
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR,
_("You require encryption, but it is not available on this server."));
return;
@@ -182,7 +182,7 @@ static void jabber_stream_handle_error(J
PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
char *msg = jabber_parse_error(js, packet, &reason);
- purple_connection_error_reason (purple_account_get_connection(js), reason, msg);
+ purple_connection_error_reason (js->gc, reason, msg);
g_free(msg);
}
@@ -193,7 +193,7 @@ void jabber_process_packet(JabberStream
{
const char *xmlns;
- purple_signal_emit(my_protocol, "jabber-receiving-xmlnode", purple_account_get_connection(js), packet);
+ purple_signal_emit(my_protocol, "jabber-receiving-xmlnode", js->gc, packet);
/* if the signal leaves us with a null packet, we're done */
if(NULL == *packet)
@@ -264,7 +264,7 @@ static void jabber_send_cb(gpointer data
if (ret < 0 && errno == EAGAIN)
return;
else if (ret <= 0) {
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("Write error"));
return;
@@ -285,7 +285,7 @@ void jabber_send_raw(JabberStream *js, c
/* If we've got a security layer, we need to encode the data,
* splitting it on the maximum buffer length negotiated */
- purple_signal_emit(my_protocol, "jabber-sending-text", purple_account_get_connection(js), &data);
+ purple_signal_emit(my_protocol, "jabber-sending-text", js->gc, &data);
if (data == NULL)
return;
@@ -319,7 +319,7 @@ void jabber_send_raw(JabberStream *js, c
}
if (ret < 0 && errno != EAGAIN)
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("Write error"));
else if (ret < olen) {
@@ -349,7 +349,7 @@ void jabber_send_raw(JabberStream *js, c
}
if (ret < 0 && errno != EAGAIN)
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("Write error"));
else if (ret < len) {
@@ -367,7 +367,7 @@ int jabber_prpl_send_raw(PurpleConnectio
int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len)
{
- JabberStream *js = (JabberStream*)gc->proto_data;
+ JabberStream *js = (JabberStream*)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
jabber_send_raw(js, buf, len);
return len;
}
@@ -377,7 +377,7 @@ void jabber_send(JabberStream *js, xmlno
char *txt;
int len;
- purple_signal_emit(my_protocol, "jabber-sending-xmlnode", purple_account_get_connection(js), &packet);
+ purple_signal_emit(my_protocol, "jabber-sending-xmlnode", js->gc, &packet);
/* if we get NULL back, we're done processing */
if(NULL == packet)
@@ -396,7 +396,7 @@ static gboolean jabber_pong_timeout(Purp
static gboolean jabber_pong_timeout(PurpleConnection *gc)
{
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("Ping timeout"));
js->keepalive_timeout = -1;
@@ -405,7 +405,7 @@ void jabber_keepalive(PurpleConnection *
void jabber_keepalive(PurpleConnection *gc)
{
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET);
xmlnode *ping = xmlnode_new_child(iq->node, "ping");
@@ -421,7 +421,7 @@ jabber_recv_cb_ssl(gpointer data, Purple
PurpleInputCondition cond)
{
PurpleConnection *gc = data;
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
int len;
static char buf[4096];
@@ -432,7 +432,10 @@ jabber_recv_cb_ssl(gpointer data, Purple
}
while((len = purple_ssl_read(gsc, buf, sizeof(buf) - 1)) > 0) {
+#warning FIXME: uncomment!
+#if 0
gc->last_received = time(NULL);
+#endif
buf[len] = '\0';
purple_debug(PURPLE_DEBUG_INFO, "jabber", "Recv (ssl)(%d): %s\n", len, buf);
jabber_parser_process(js, buf, len);
@@ -443,7 +446,7 @@ jabber_recv_cb_ssl(gpointer data, Purple
if(errno == EAGAIN)
return;
else
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("Read Error"));
}
@@ -452,7 +455,7 @@ jabber_recv_cb(gpointer data, gint sourc
jabber_recv_cb(gpointer data, gint source, PurpleInputCondition condition)
{
PurpleConnection *gc = data;
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
int len;
static char buf[4096];
@@ -460,7 +463,10 @@ jabber_recv_cb(gpointer data, gint sourc
return;
if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) {
+#warning FIXME: uncomment!
+#if 0
gc->last_received = time(NULL);
+#endif
#ifdef HAVE_CYRUS_SASL
if (js->sasl_maxbuf>0) {
const char *out;
@@ -483,7 +489,7 @@ jabber_recv_cb(gpointer data, gint sourc
} else if(errno == EAGAIN) {
return;
} else {
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("Read Error"));
}
@@ -502,7 +508,7 @@ jabber_login_callback_ssl(gpointer data,
return;
}
- js = gc->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if(js->state == JABBER_STREAM_CONNECTING)
jabber_send_raw(js, "<?xml version='1.0' ?>", -1);
@@ -518,7 +524,7 @@ jabber_login_callback(gpointer data, gin
jabber_login_callback(gpointer data, gint source, const gchar *error)
{
PurpleConnection *gc = data;
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (source < 0) {
gchar *tmp;
@@ -536,7 +542,7 @@ jabber_login_callback(gpointer data, gin
jabber_send_raw(js, "<?xml version='1.0' ?>", -1);
jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING);
- gc->inpa = purple_input_add(js->fd, PURPLE_INPUT_READ, jabber_recv_cb, gc);
+ g_object_set(G_OBJECT(gc),"inpa",purple_input_add(js->fd, PURPLE_INPUT_READ, jabber_recv_cb, gc),NULL);
}
static void
@@ -550,7 +556,7 @@ jabber_ssl_connect_failure(PurpleSslConn
if(!PURPLE_CONNECTION_IS_VALID(gc))
return;
- js = gc->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
js->gsc = NULL;
purple_connection_ssl_error (gc, error);
@@ -558,10 +564,10 @@ static void tls_init(JabberStream *js)
static void tls_init(JabberStream *js)
{
- purple_input_remove(purple_account_get_connection(js)->inpa);
- purple_account_get_connection(js)->inpa = 0;
- js->gsc = purple_ssl_connect_with_host_fd(purple_account_get_connection(js)->account, js->fd,
- jabber_login_callback_ssl, jabber_ssl_connect_failure, js->certificate_CN, purple_account_get_connection(js));
+ purple_input_remove(purple_object_get_int(PURPLE_OBJECT(js->gc),"inpa"));
+ g_object_set(G_OBJECT(js->gc),"inpa",0,NULL);
+ js->gsc = purple_ssl_connect_with_host_fd(purple_connection_get_account(js->gc), js->fd,
+ jabber_login_callback_ssl, jabber_ssl_connect_failure, js->certificate_CN, js->gc);
}
static void jabber_login_connect(JabberStream *js, const char *domain, const char *host, int port)
@@ -575,9 +581,9 @@ static void jabber_login_connect(JabberS
else
js->serverFQDN = g_strdup(host);
- if (purple_proxy_connect(purple_account_get_connection(js), purple_account_get_connection(js)->account, host,
- port, jabber_login_callback, purple_account_get_connection(js)) == NULL)
- purple_connection_error_reason (purple_account_get_connection(js),
+ if (purple_proxy_connect(js->gc, purple_connection_get_account(js->gc), host,
+ port, jabber_login_callback, js->gc) == NULL)
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("Unable to create socket"));
}
@@ -594,7 +600,7 @@ static void srv_resolved_cb(PurpleSrvRes
g_free(resp);
} else {
jabber_login_connect(js, js->user->domain, js->user->domain,
- purple_account_get_int(purple_account_get_connection(js)->account, "port", 5222));
+ purple_account_get_int(purple_connection_get_account(js->gc), "port", 5222));
}
}
@@ -607,9 +613,10 @@ jabber_login(PurpleAccount *account)
JabberStream *js;
JabberBuddy *my_jb = NULL;
- gc->flags |= PURPLE_CONNECTION_FLAGS_HTML;
- js = gc->proto_data = g_new0(JabberStream, 1);
- purple_account_get_connection(js) = gc;
+ purple_connection_set_flags(gc,
+ purple_connection_get_flags(gc) | PURPLE_CONNECTION_FLAGS_HTML);
+ purple_object_set_protocol_data(PURPLE_OBJECT(gc), js = g_new0(JabberStream, 1));
+ js->gc = gc;
js->fd = -1;
js->iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, g_free);
@@ -659,14 +666,14 @@ jabber_login(PurpleAccount *account)
jabber_stream_set_state(js, JABBER_STREAM_CONNECTING);
/* if they've got old-ssl mode going, we probably want to ignore SRV lookups */
- if(purple_account_get_bool(purple_account_get_connection(js)->account, "old_ssl", FALSE)) {
+ if(purple_account_get_bool(purple_connection_get_account(js->gc), "old_ssl", FALSE)) {
if(purple_ssl_is_supported()) {
- js->gsc = purple_ssl_connect(purple_account_get_connection(js)->account,
+ js->gsc = purple_ssl_connect(purple_connection_get_account(js->gc),
js->certificate_CN,
purple_account_get_int(account, "port", 5223), jabber_login_callback_ssl,
- jabber_ssl_connect_failure, purple_account_get_connection(js));
+ jabber_ssl_connect_failure, js->gc);
} else {
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
_("SSL support unavailable"));
}
@@ -689,7 +696,7 @@ conn_close_cb(gpointer data)
conn_close_cb(gpointer data)
{
JabberStream *js = data;
- PurpleAccount *account = purple_connection_get_account(purple_account_get_connection(js));
+ PurpleAccount *account = purple_connection_get_account(js->gc);
jabber_parser_free(js);
@@ -707,7 +714,7 @@ jabber_registration_result_cb(JabberStre
static void
jabber_registration_result_cb(JabberStream *js, xmlnode *packet, gpointer data)
{
- PurpleAccount *account = purple_connection_get_account(purple_account_get_connection(js));
+ PurpleAccount *account = purple_connection_get_account(js->gc);
const char *type = xmlnode_get_attrib(packet, "type");
char *buf;
char *to = data;
@@ -849,7 +856,7 @@ jabber_register_cb(JabberRegisterCBData
cbdata->js->user->node = g_strdup(value);
}
if(cbdata->js->registration && !strcmp(id, "password"))
- purple_account_set_password(purple_account_get_connection(cbdata->js)->account, value);
+ purple_account_set_password(purple_connection_get_account(cbdata->js->gc), value);
}
}
}
@@ -857,7 +864,7 @@ jabber_register_cb(JabberRegisterCBData
if(cbdata->js->registration) {
username = g_strdup_printf("%s@%s/%s", cbdata->js->user->node, cbdata->js->user->domain,
cbdata->js->user->resource);
- purple_account_set_username(purple_account_get_connection(cbdata->js)->account, username);
+ purple_account_set_username(purple_connection_get_account(cbdata->js->gc), username);
g_free(username);
}
@@ -870,7 +877,7 @@ jabber_register_cancel_cb(JabberRegister
static void
jabber_register_cancel_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields)
{
- PurpleAccount *account = purple_connection_get_account(purple_account_get_connection(cbdata->js));
+ PurpleAccount *account = purple_connection_get_account(cbdata->js->gc);
if(account && cbdata->js->registration) {
if(account->registration_cb)
(account->registration_cb)(account, FALSE, account->registration_cb_user_data);
@@ -898,7 +905,7 @@ void jabber_register_parse(JabberStream
void jabber_register_parse(JabberStream *js, xmlnode *packet)
{
- PurpleAccount *account = purple_connection_get_account(purple_account_get_connection(js));
+ PurpleAccount *account = purple_connection_get_account(js->gc);
const char *type;
const char *from;
PurpleRequestFields *fields;
@@ -919,7 +926,7 @@ void jabber_register_parse(JabberStream
if(js->registration) {
/* get rid of the login thingy */
- purple_connection_set_state(purple_account_get_connection(js), PURPLE_CONNECTION_STATE_CONNECTED);
+ purple_connection_set_state(js->gc, PURPLE_CONNECTION_STATE_CONNECTED);
}
query = xmlnode_get_child(packet, "query");
@@ -951,7 +958,10 @@ void jabber_register_parse(JabberStream
g_free(href);
if(js->registration) {
- purple_account_get_connection(js)->wants_to_die = TRUE;
+#warning FIXME: there needs to be a better alternative to wants_to_die
+#if 0
+ js->gc->wants_to_die = TRUE;
+#endif
if(account->registration_cb) /* succeeded, but we have no login info */
(account->registration_cb)(account, TRUE, account->registration_cb_user_data);
jabber_connection_schedule_close(js);
@@ -976,7 +986,7 @@ void jabber_register_parse(JabberStream
if(js->registration)
field = purple_request_field_string_new("password", _("Password"),
- purple_connection_get_password(purple_account_get_connection(js)), FALSE);
+ purple_connection_get_password(js->gc), FALSE);
else
field = purple_request_field_string_new("password", _("Password"), NULL, FALSE);
@@ -986,7 +996,7 @@ void jabber_register_parse(JabberStream
if(xmlnode_get_child(query, "name")) {
if(js->registration)
field = purple_request_field_string_new("name", _("Name"),
- purple_account_get_alias(purple_account_get_connection(js)->account), FALSE);
+ purple_account_get_alias(purple_connection_get_account(js->gc)), FALSE);
else
field = purple_request_field_string_new("name", _("Name"), NULL, FALSE);
purple_request_field_group_add_field(group, field);
@@ -1054,20 +1064,20 @@ void jabber_register_parse(JabberStream
cbdata->who = g_strdup(from);
if(js->registration)
- purple_request_fields(purple_account_get_connection(js), _("Register New XMPP Account"),
+ purple_request_fields(js->gc, _("Register New XMPP Account"),
_("Register New XMPP Account"), instructions, fields,
_("Register"), G_CALLBACK(jabber_register_cb),
_("Cancel"), G_CALLBACK(jabber_register_cancel_cb),
- purple_connection_get_account(purple_account_get_connection(js)), NULL, NULL,
+ purple_connection_get_account(js->gc), NULL, NULL,
cbdata);
else {
char *title = registered?g_strdup_printf(_("Change Account Registration at %s"), from)
:g_strdup_printf(_("Register New Account at %s"), from);
- purple_request_fields(purple_account_get_connection(js), title,
+ purple_request_fields(js->gc, title,
title, instructions, fields,
(registered ? _("Change Registration") : _("Register")), G_CALLBACK(jabber_register_cb),
_("Cancel"), G_CALLBACK(jabber_register_cancel_cb),
- purple_connection_get_account(purple_account_get_connection(js)), NULL, NULL,
+ purple_connection_get_account(js->gc), NULL, NULL,
cbdata);
g_free(title);
}
@@ -1100,8 +1110,8 @@ void jabber_register_account(PurpleAccou
"connect_server", "");
const char *server;
- js = gc->proto_data = g_new0(JabberStream, 1);
- purple_account_get_connection(js) = gc;
+ purple_object_set_protocol_data(PURPLE_OBJECT(gc), js = g_new0(JabberStream, 1));
+ js->gc = gc;
js->registration = TRUE;
js->iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, g_free);
@@ -1169,18 +1179,18 @@ static void jabber_unregister_account_iq
}
static void jabber_unregister_account_iq_cb(JabberStream *js, xmlnode *packet, gpointer data) {
- PurpleAccount *account = purple_connection_get_account(purple_account_get_connection(js));
+ PurpleAccount *account = purple_connection_get_account(js->gc);
const char *type = xmlnode_get_attrib(packet,"type");
if(!strcmp(type,"error")) {
char *msg = jabber_parse_error(js, packet, NULL);
- purple_notify_error(purple_account_get_connection(js), _("Error unregistering account"),
+ purple_notify_error(js->gc, _("Error unregistering account"),
_("Error unregistering account"), msg);
g_free(msg);
if(js->unregistration_cb)
js->unregistration_cb(account, FALSE, js->unregistration_user_data);
} else if(!strcmp(type,"result")) {
- purple_notify_info(purple_account_get_connection(js), _("Account successfully unregistered"),
+ purple_notify_info(js->gc, _("Account successfully unregistered"),
_("Account successfully unregistered"), NULL);
if(js->unregistration_cb)
js->unregistration_cb(account, TRUE, js->unregistration_user_data);
@@ -1207,18 +1217,19 @@ void jabber_unregister_account(PurpleAcc
void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data) {
PurpleConnection *gc = purple_account_get_connection(account);
JabberStream *js;
+ PurpleConnectionState state = purple_connection_get_state(gc);
- if(gc->state != PURPLE_CONNECTION_STATE_CONNECTED) {
- if(gc->state != PURPLE_CONNECTION_STATE_CONNECTING)
+ if(state != PURPLE_CONNECTION_STATE_CONNECTED) {
+ if(state != PURPLE_CONNECTION_STATE_CONNECTING)
jabber_login(account);
- js = gc->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
js->unregistration = TRUE;
js->unregistration_cb = cb;
js->unregistration_user_data = user_data;
return;
}
- js = gc->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (js->unregistration) {
purple_debug_error("jabber", "Unregistration in process; ignoring duplicate request.\n");
@@ -1234,26 +1245,32 @@ void jabber_close(PurpleConnection *gc)
void jabber_close(PurpleConnection *gc)
{
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
/* Don't perform any actions on the ssl connection
* if we were forcibly disconnected because it will crash
* on some SSL backends.
*/
+#warning FIXME: there needs to be a better alternative to gc:disconnect_timeout
+#if 0
if (!gc->disconnect_timeout)
jabber_send_raw(js, "</stream:stream>", -1);
+#endif
if (js->srv_query_data)
purple_srv_cancel(js->srv_query_data);
if(js->gsc) {
#ifdef HAVE_OPENSSL
+#warning FIXME: there needs to be a better alternative to gc:disconnect_timeout
+#if 0
if (!gc->disconnect_timeout)
#endif
+#endif
purple_ssl_close(js->gsc);
} else if (js->fd > 0) {
- if(purple_account_get_connection(js)->inpa)
- purple_input_remove(purple_account_get_connection(js)->inpa);
+ if(purple_object_get_int(PURPLE_OBJECT(js->gc),"inpa"))
+ purple_input_remove(purple_object_get_int(PURPLE_OBJECT(js->gc),"inpa"));
close(js->fd);
}
@@ -1330,7 +1347,7 @@ void jabber_close(PurpleConnection *gc)
g_free(js);
- gc->proto_data = NULL;
+ purple_object_set_protocol_data(PURPLE_OBJECT(gc),NULL);
}
void jabber_stream_set_state(JabberStream *js, JabberStreamState state)
@@ -1340,20 +1357,20 @@ void jabber_stream_set_state(JabberStrea
case JABBER_STREAM_OFFLINE:
break;
case JABBER_STREAM_CONNECTING:
- purple_connection_update_progress(purple_account_get_connection(js), _("Connecting"), 1,
+ purple_connection_update_progress(js->gc, _("Connecting"), 1,
JABBER_CONNECT_STEPS);
break;
case JABBER_STREAM_INITIALIZING:
- purple_connection_update_progress(purple_account_get_connection(js), _("Initializing Stream"),
+ purple_connection_update_progress(js->gc, _("Initializing Stream"),
js->gsc ? 5 : 2, JABBER_CONNECT_STEPS);
jabber_stream_init(js);
break;
case JABBER_STREAM_INITIALIZING_ENCRYPTION:
- purple_connection_update_progress(purple_account_get_connection(js), _("Initializing SSL/TLS"),
+ purple_connection_update_progress(js->gc, _("Initializing SSL/TLS"),
6, JABBER_CONNECT_STEPS);
break;
case JABBER_STREAM_AUTHENTICATING:
- purple_connection_update_progress(purple_account_get_connection(js), _("Authenticating"),
+ purple_connection_update_progress(js->gc, _("Authenticating"),
js->gsc ? 7 : 3, JABBER_CONNECT_STEPS);
if(js->protocol_version == JABBER_PROTO_0_9 && js->registration) {
jabber_register_start(js);
@@ -1362,7 +1379,7 @@ void jabber_stream_set_state(JabberStrea
}
break;
case JABBER_STREAM_REINITIALIZING:
- purple_connection_update_progress(purple_account_get_connection(js), _("Re-initializing Stream"),
+ purple_connection_update_progress(js->gc, _("Re-initializing Stream"),
(js->gsc ? 8 : 4), JABBER_CONNECT_STEPS);
/* The stream will be reinitialized later, in jabber_recv_cb_ssl() */
@@ -1371,7 +1388,7 @@ void jabber_stream_set_state(JabberStrea
break;
case JABBER_STREAM_CONNECTED:
/* now we can alert the core that we're ready to send status */
- purple_connection_set_state(purple_account_get_connection(js), PURPLE_CONNECTION_STATE_CONNECTED);
+ purple_connection_set_state(js->gc, PURPLE_CONNECTION_STATE_CONNECTED);
jabber_disco_items_server(js);
break;
}
@@ -1385,7 +1402,7 @@ void jabber_idle_set(PurpleConnection *g
void jabber_idle_set(PurpleConnection *gc, int idle)
{
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
js->idle = idle ? time(NULL) - idle : idle;
}
@@ -1435,7 +1452,7 @@ const char* jabber_list_emblem(PurpleBud
if(!purple_account_get_connection(b->account))
return NULL;
- js = purple_account_get_connection(b->account)->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(b->account)));
if(js)
jb = jabber_buddy_find(js, b->name, FALSE);
@@ -1452,8 +1469,8 @@ char *jabber_status_text(PurpleBuddy *b)
char *ret = NULL;
JabberBuddy *jb = NULL;
- if (purple_account_get_connection(b->account) && purple_account_get_connection(b->account)->proto_data)
- jb = jabber_buddy_find(purple_account_get_connection(b->account)->proto_data, b->name, FALSE);
+ if (purple_account_get_connection(b->account) && purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(b->account))))
+ jb = jabber_buddy_find(purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(b->account))), b->name, FALSE);
if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && (jb->subscription & JABBER_SUB_PENDING || !(jb->subscription & JABBER_SUB_TO))) {
ret = g_strdup(_("Not Authorized"));
@@ -1482,14 +1499,17 @@ void jabber_tooltip_text(PurpleBuddy *b,
void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full)
{
JabberBuddy *jb;
+ PurpleConnection *gc;
+ JabberStream *js;
g_return_if_fail(b != NULL);
g_return_if_fail(b->account != NULL);
- g_return_if_fail(purple_account_get_connection(b->account) != NULL);
- g_return_if_fail(purple_account_get_connection(b->account)->proto_data != NULL);
+ gc = purple_account_get_connection(b->account);
+ g_return_if_fail(gc != NULL);
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(js));
+ g_return_if_fail(js != NULL);
- jb = jabber_buddy_find(purple_account_get_connection(b->account)->proto_data, b->name,
- FALSE);
+ jb = jabber_buddy_find(js, b->name, FALSE);
if(jb) {
JabberBuddyResource *jbr = NULL;
@@ -1707,14 +1727,14 @@ jabber_password_change_result_cb(JabberS
type = xmlnode_get_attrib(packet, "type");
if(type && !strcmp(type, "result")) {
- purple_notify_info(purple_account_get_connection(js), _("Password Changed"), _("Password Changed"),
+ purple_notify_info(js->gc, _("Password Changed"), _("Password Changed"),
_("Your password has been changed."));
- purple_account_set_password(purple_account_get_connection(js)->account, (char *)data);
+ purple_account_set_password(purple_connection_get_account(js->gc), (char *)data);
} else {
char *msg = jabber_parse_error(js, packet, NULL);
- purple_notify_error(purple_account_get_connection(js), _("Error changing password"),
+ purple_notify_error(js->gc, _("Error changing password"),
_("Error changing password"), msg);
g_free(msg);
}
@@ -1733,7 +1753,7 @@ static void jabber_password_change_cb(Ja
p2 = purple_request_fields_get_string(fields, "password2");
if(strcmp(p1, p2)) {
- purple_notify_error(purple_account_get_connection(js), NULL, _("New passwords do not match."), NULL);
+ purple_notify_error(js->gc, NULL, _("New passwords do not match."), NULL);
return;
}
@@ -1757,7 +1777,7 @@ static void jabber_password_change(Purpl
{
PurpleConnection *gc = (PurpleConnection *) action->context;
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
PurpleRequestFields *fields;
PurpleRequestFieldGroup *group;
PurpleRequestField *field;
@@ -1778,7 +1798,7 @@ static void jabber_password_change(Purpl
purple_request_field_set_required(field, TRUE);
purple_request_field_group_add_field(group, field);
- purple_request_fields(purple_account_get_connection(js), _("Change XMPP Password"),
+ purple_request_fields(js->gc, _("Change XMPP Password"),
_("Change XMPP Password"), _("Please enter your new password"),
fields, _("OK"), G_CALLBACK(jabber_password_change_cb),
_("Cancel"), NULL,
@@ -1789,7 +1809,7 @@ GList *jabber_actions(PurplePlugin *plug
GList *jabber_actions(PurplePlugin *plugin, gpointer context)
{
PurpleConnection *gc = (PurpleConnection *) context;
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
GList *m = NULL;
PurplePluginAction *act;
@@ -1854,7 +1874,7 @@ void jabber_convo_closed(PurpleConnectio
void jabber_convo_closed(PurpleConnection *gc, const char *who)
{
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
JabberID *jid;
JabberBuddy *jb;
JabberBuddyResource *jbr;
@@ -1955,8 +1975,8 @@ char *jabber_parse_error(JabberStream *j
} else if(xmlnode_get_child(packet, "not-authorized")) {
SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED);
/* Clear the pasword if it isn't being saved */
- if (!purple_account_get_remember_password(purple_account_get_connection(js)->account))
- purple_account_set_password(purple_account_get_connection(js)->account, NULL);
+ if (!purple_account_get_remember_password(purple_connection_get_account(js->gc)))
+ purple_account_set_password(purple_connection_get_account(js->gc), NULL);
text = _("Not Authorized");
} else if(xmlnode_get_child(packet, "temporary-auth-failure")) {
text = _("Temporary Authentication Failure");
@@ -2299,7 +2319,7 @@ static PurpleCmdRet jabber_cmd_buzz(Purp
static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv,
const char *cmd, char **args, char **error, void *data)
{
- JabberStream *js = purple_account_get_connection(conv->account)->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(conv->account)));
if(!args || !args[0])
return PURPLE_CMD_RET_FAILED;
@@ -2321,7 +2341,7 @@ gboolean jabber_send_attention(PurpleCon
gboolean jabber_send_attention(PurpleConnection *gc, const char *username, guint code)
{
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
gchar *error = NULL;
if (!_jabber_send_buzz(js, username, &error)) {
============================================================
--- libpurple/protocols/jabber/jutil.c e763263b267ff42399809bfd5cf34e43d9890605
+++ libpurple/protocols/jabber/jutil.c 6183de7b47bbca91996fa597bbdfb49e52142b95
@@ -188,7 +188,7 @@ const char *jabber_normalize(const Purpl
const char *jabber_normalize(const PurpleAccount *account, const char *in)
{
PurpleConnection *gc = account ? purple_account_get_connection(account) : NULL;
- JabberStream *js = gc ? gc->proto_data : NULL;
+ JabberStream *js = gc ? purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
static char buf[3072]; /* maximum legal length of a jabber jid */
JabberID *jid;
char *node, *domain;
============================================================
--- libpurple/protocols/jabber/message.c 9fb3b0e0f9754acaba859540bf6f7b11cefbef00
+++ libpurple/protocols/jabber/message.c 321e5968d2c7c361e9f1e41f0253aeb1069a7492
@@ -40,7 +40,7 @@ void jabber_message_free(JabberMessage *
g_free(jm->subject);
g_free(jm->body);
g_free(jm->xhtml);
- g_free(purple_account_get_password(jm));
+ g_free(jm->password);
g_free(jm->error);
g_free(jm->thread_id);
g_list_free(jm->etc);
@@ -63,14 +63,14 @@ static void handle_chat(JabberMessage *j
jb = jabber_buddy_find(jm->js, jm->from, TRUE);
jbr = jabber_buddy_find_resource(jb, jid->resource);
- if(jabber_find_unnormalized_conv(jm->from, purple_account_get_connection(jm->js)->account)) {
+ if(jabber_find_unnormalized_conv(jm->from, purple_connection_get_account(jm->js->gc))) {
from = g_strdup(jm->from);
} else if(jid->node) {
if(jid->resource) {
PurpleConversation *conv;
from = g_strdup_printf("%s@%s", jid->node, jid->domain);
- conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, purple_account_get_connection(jm->js)->account);
+ conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, purple_connection_get_account(jm->js->gc));
if(conv) {
purple_conversation_set_name(conv, jm->from);
}
@@ -83,19 +83,19 @@ static void handle_chat(JabberMessage *j
if(!jm->xhtml && !jm->body) {
if(JM_STATE_COMPOSING == jm->chat_state) {
- serv_got_typing(purple_account_get_connection(jm->js), from, 0, PURPLE_TYPING);
+ serv_got_typing(jm->js->gc, from, 0, PURPLE_TYPING);
} else if(JM_STATE_PAUSED == jm->chat_state) {
- serv_got_typing(purple_account_get_connection(jm->js), from, 0, PURPLE_TYPED);
+ serv_got_typing(jm->js->gc, from, 0, PURPLE_TYPED);
} else if(JM_STATE_GONE == jm->chat_state) {
PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
- from, purple_account_get_connection(jm->js)->account);
+ from, purple_connection_get_account(jm->js->gc));
if (conv && jid->node && jid->domain) {
char buf[256];
PurpleBuddy *buddy;
g_snprintf(buf, sizeof(buf), "%s@%s", jid->node, jid->domain);
- if ((buddy = purple_find_buddy(purple_account_get_connection(jm->js)->account, buf))) {
+ if ((buddy = purple_find_buddy(purple_connection_get_account(jm->js->gc), buf))) {
const char *who;
char *escaped;
@@ -113,10 +113,10 @@ static void handle_chat(JabberMessage *j
PURPLE_MESSAGE_SYSTEM, time(NULL));
}
}
- serv_got_typing_stopped(purple_account_get_connection(jm->js), from);
+ serv_got_typing_stopped(jm->js->gc, from);
} else {
- serv_got_typing_stopped(purple_account_get_connection(jm->js), from);
+ serv_got_typing_stopped(jm->js->gc, from);
}
} else {
if(jbr) {
@@ -140,7 +140,7 @@ static void handle_chat(JabberMessage *j
jm->body = jabber_google_format_to_html(jm->body);
g_free(tmp);
}
- serv_got_im(purple_account_get_connection(jm->js), from, jm->xhtml ? jm->xhtml : jm->body, 0,
+ serv_got_im(jm->js->gc, from, jm->xhtml ? jm->xhtml : jm->body, 0,
jm->sent);
}
@@ -195,7 +195,7 @@ static void handle_headline(JabberMessag
}
}
- purple_notify_formatted(purple_account_get_connection(jm->js), title, jm->subject ? jm->subject : title,
+ purple_notify_formatted(jm->js->gc, title, jm->subject ? jm->subject : title,
NULL, body->str, NULL, NULL);
g_free(title);
@@ -235,7 +235,7 @@ static void handle_groupchat(JabberMessa
if(jm->xhtml || jm->body) {
if(jid->resource)
- serv_got_chat_in(purple_account_get_connection(jm->js), chat->id, jid->resource,
+ serv_got_chat_in(jm->js->gc, chat->id, jid->resource,
jm->delayed ? PURPLE_MESSAGE_DELAYED : 0,
jm->xhtml ? jm->xhtml : jm->body, jm->sent);
else if(chat->muc)
@@ -260,10 +260,10 @@ static void handle_groupchat_invite(Jabb
g_hash_table_replace(components, "room", g_strdup(jid->node));
g_hash_table_replace(components, "server", g_strdup(jid->domain));
g_hash_table_replace(components, "handle", g_strdup(jm->js->user->node));
- g_hash_table_replace(components, "password", g_strdup(purple_account_get_password(jm)));
+ g_hash_table_replace(components, "password", g_strdup(jm->password));
jabber_id_free(jid);
- serv_got_chat_invite(purple_account_get_connection(jm->js), jm->to, jm->from, jm->body, components);
+ serv_got_chat_invite(jm->js->gc, jm->to, jm->from, jm->body, components);
}
static void handle_error(JabberMessage *jm)
@@ -276,7 +276,7 @@ static void handle_error(JabberMessage *
buf = g_strdup_printf(_("Message delivery to %s failed: %s"),
jm->from, jm->error ? jm->error : "");
- purple_notify_formatted(purple_account_get_connection(jm->js), _("XMPP Message Error"), _("XMPP Message Error"), buf,
+ purple_notify_formatted(jm->js->gc, _("XMPP Message Error"), _("XMPP Message Error"), buf,
jm->xhtml ? jm->xhtml : jm->body, NULL, NULL);
g_free(buf);
@@ -296,7 +296,7 @@ static void handle_buzz(JabberMessage *j
if(!jm->js->allowBuzz)
return;
- account = purple_connection_get_account(purple_account_get_connection(jm->js));
+ account = purple_connection_get_account(jm->js->gc);
if ((buddy = purple_find_buddy(account, jm->from)) != NULL)
username = g_markup_escape_text(purple_buddy_get_alias(buddy), -1);
@@ -454,7 +454,7 @@ void jabber_message_parse(JabberStream *
jm->body = xmlnode_get_data(reason);
}
if((password = xmlnode_get_child(child, "password")))
- purple_account_get_password(jm) = xmlnode_get_data(password);
+ jm->password = xmlnode_get_data(password);
jm->type = JABBER_MESSAGE_GROUPCHAT_INVITE;
}
@@ -610,13 +610,13 @@ int jabber_message_send_im(PurpleConnect
resource = jabber_get_resource(who);
- jb = jabber_buddy_find(gc->proto_data, who, TRUE);
+ jb = jabber_buddy_find(purple_object_get_protocol_data(PURPLE_OBJECT(gc)), who, TRUE);
jbr = jabber_buddy_find_resource(jb, resource);
g_free(resource);
jm = g_new0(JabberMessage, 1);
- jm->js = gc->proto_data;
+ jm->js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
jm->type = JABBER_MESSAGE_CHAT;
jm->chat_state = JM_STATE_ACTIVE;
jm->to = g_strdup(who);
@@ -662,14 +662,14 @@ int jabber_message_send_chat(PurpleConne
if(!msg || !gc)
return 0;
- js = gc->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
chat = jabber_chat_find_by_id(js, id);
if(!chat)
return 0;
jm = g_new0(JabberMessage, 1);
- jm->js = gc->proto_data;
+ jm->js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
jm->type = JABBER_MESSAGE_GROUPCHAT;
jm->to = g_strdup_printf("%s@%s", chat->room, chat->server);
jm->id = jabber_get_next_id(jm->js);
@@ -696,7 +696,7 @@ unsigned int jabber_send_typing(PurpleCo
JabberBuddyResource *jbr;
char *resource = jabber_get_resource(who);
- jb = jabber_buddy_find(gc->proto_data, who, TRUE);
+ jb = jabber_buddy_find(purple_object_get_protocol_data(PURPLE_OBJECT(gc)), who, TRUE);
jbr = jabber_buddy_find_resource(jb, resource);
g_free(resource);
@@ -706,7 +706,7 @@ unsigned int jabber_send_typing(PurpleCo
/* TODO: figure out threading */
jm = g_new0(JabberMessage, 1);
- jm->js = gc->proto_data;
+ jm->js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
jm->type = JABBER_MESSAGE_CHAT;
jm->to = g_strdup(who);
jm->id = jabber_get_next_id(jm->js);
============================================================
--- libpurple/protocols/jabber/oob.c 815bbce82c941f98eb4121b36131f45b77f3b8b9
+++ libpurple/protocols/jabber/oob.c d3c0a7e8eec6934a0a4857a9e27fd09dda090b98
@@ -213,7 +213,7 @@ void jabber_oob_parse(JabberStream *js,
jox->headers = g_string_new("");
jox->iq_id = g_strdup(xmlnode_get_attrib(packet, "id"));
- xfer = purple_xfer_new(purple_account_get_connection(js)->account, PURPLE_XFER_RECEIVE,
+ xfer = purple_xfer_new(purple_connection_get_account(js->gc), PURPLE_XFER_RECEIVE,
xmlnode_get_attrib(packet, "from"));
if (xfer)
{
============================================================
--- libpurple/protocols/jabber/parser.c 524c4187294ed4449a76954cac3d63cb74a64209
+++ libpurple/protocols/jabber/parser.c 6cecb079972daf216504b3dce358ca781c92c3d9
@@ -193,7 +193,7 @@ void jabber_parser_process(JabberStream
js->context = xmlCreatePushParserCtxt(&jabber_parser_libxml, js, buf, len, NULL);
xmlParseChunk(js->context, "", 0, 0);
} else if (xmlParseChunk(js->context, buf, len, 0) < 0) {
- purple_connection_error_reason (purple_account_get_connection(js),
+ purple_connection_error_reason (js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("XML Parse error"));
}
============================================================
--- libpurple/protocols/jabber/ping.c 0fb1c1127cb5963ad1791af80d8208e8be5e8443
+++ libpurple/protocols/jabber/ping.c c4d389bf0e10dcef7c19b8112250fa6d899f2bef
@@ -65,7 +65,7 @@ gboolean jabber_ping_jid(PurpleConversat
purple_debug_info("jabber", "jabber_ping_jid\n");
- iq = jabber_iq_new(purple_account_get_connection(conv->account)->proto_data, JABBER_IQ_GET);
+ iq = jabber_iq_new(purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(conv->account))), JABBER_IQ_GET);
xmlnode_set_attrib(iq->node, "to", jid);
ping = xmlnode_new_child(iq->node, "ping");
============================================================
--- libpurple/protocols/jabber/presence.c 1487e246f6d84a92ebb68bbd5124f1f4aa45028a
+++ libpurple/protocols/jabber/presence.c 5f7b7a7dd412d133457e603e6f3ae1735e117ec3
@@ -67,7 +67,7 @@ void jabber_presence_fake_to_self(Jabber
return;
my_base_jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain);
- if(purple_find_buddy(purple_account_get_connection(js)->account, my_base_jid)) {
+ if(purple_find_buddy(purple_connection_get_account(js->gc), my_base_jid)) {
JabberBuddy *jb;
JabberBuddyResource *jbr;
if((jb = jabber_buddy_find(js, my_base_jid, TRUE))) {
@@ -83,9 +83,9 @@ void jabber_presence_fake_to_self(Jabber
jabber_buddy_track_resource(jb, js->user->resource, priority, state, msg);
}
if((jbr = jabber_buddy_find_resource(jb, NULL))) {
- purple_prpl_got_user_status(purple_account_get_connection(js)->account, my_base_jid, jabber_buddy_state_get_status_id(jbr->state), "priority", jbr->priority, jbr->status ? "message" : NULL, jbr->status, NULL);
+ purple_prpl_got_user_status(purple_connection_get_account(js->gc), my_base_jid, jabber_buddy_state_get_status_id(jbr->state), "priority", jbr->priority, jbr->status ? "message" : NULL, jbr->status, NULL);
} else {
- purple_prpl_got_user_status(purple_account_get_connection(js)->account, my_base_jid, "offline", msg ? "message" : NULL, msg, NULL);
+ purple_prpl_got_user_status(purple_connection_get_account(js->gc), my_base_jid, "offline", msg ? "message" : NULL, msg, NULL);
}
g_free(msg);
@@ -128,7 +128,7 @@ void jabber_presence_send(PurpleAccount
}
gc = purple_account_get_connection(account);
- js = gc->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
/* we don't want to send presence before we've gotten our roster */
if(!js->roster_parsed) {
@@ -203,7 +203,7 @@ void jabber_presence_send(PurpleAccount
length,
(char*)uri
};
- jabber_tune_set(purple_account_get_connection(js), &tuneinfo);
+ jabber_tune_set(js->gc, &tuneinfo);
/* update old values */
g_free(js->old_artist);
@@ -310,8 +310,8 @@ static void authorize_add_cb(gpointer da
static void authorize_add_cb(gpointer data)
{
struct _jabber_add_permit *jap = data;
- if(PURPLE_CONNECTION_IS_VALID(purple_account_get_connection(jap)))
- jabber_presence_subscription_set(purple_account_get_connection(jap)->proto_data,
+ if(PURPLE_CONNECTION_IS_VALID(jap->gc))
+ jabber_presence_subscription_set(purple_object_get_protocol_data(PURPLE_OBJECT(jap->gc)),
jap->who, "subscribed");
g_free(jap->who);
g_free(jap);
@@ -320,8 +320,8 @@ static void deny_add_cb(gpointer data)
static void deny_add_cb(gpointer data)
{
struct _jabber_add_permit *jap = data;
- if(PURPLE_CONNECTION_IS_VALID(purple_account_get_connection(jap)))
- jabber_presence_subscription_set(purple_account_get_connection(jap)->proto_data,
+ if(PURPLE_CONNECTION_IS_VALID(jap->gc))
+ jabber_presence_subscription_set(purple_object_get_protocol_data(PURPLE_OBJECT(jap->gc)),
jap->who, "unsubscribed");
g_free(jap->who);
g_free(jap);
@@ -365,7 +365,7 @@ static void jabber_vcard_parse_avatar(Ja
for(i=0; i<20; i++, p+=2)
snprintf(p, 3, "%02x", hashval[i]);
- purple_buddy_icons_set_for_user(purple_account_get_connection(js)->account, from, data, size, hash);
+ purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, data, size, hash);
g_free(text);
}
}
@@ -446,7 +446,7 @@ void jabber_presence_parse(JabberStream
} else if(type && !strcmp(type, "subscribe")) {
struct _jabber_add_permit *jap = g_new0(struct _jabber_add_permit, 1);
gboolean onlist = FALSE;
- PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(purple_account_get_connection(js)), from);
+ PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(js->gc), from);
JabberBuddy *jb = NULL;
if (buddy) {
@@ -455,11 +455,11 @@ void jabber_presence_parse(JabberStream
onlist = TRUE;
}
- purple_account_get_connection(jap) = purple_account_get_connection(js);
+ jap->gc = js->gc;
jap->who = g_strdup(from);
jap->js = js;
- purple_account_request_authorization(purple_connection_get_account(purple_account_get_connection(js)), from, NULL, NULL, NULL, onlist,
+ purple_account_request_authorization(purple_connection_get_account(js->gc), from, NULL, NULL, NULL, onlist,
authorize_add_cb, deny_add_cb, jap);
jabber_id_free(jid);
return;
@@ -522,14 +522,14 @@ void jabber_presence_parse(JabberStream
if((chat = jabber_chat_find(js, jid->node, jid->domain))) {
chat->config_dialog_type = PURPLE_REQUEST_ACTION;
chat->config_dialog_handle =
- purple_request_action(purple_account_get_connection(js),
+ purple_request_action(js->gc,
_("Create New Room"),
_("Create New Room"),
_("You are creating a new room. Would"
" you like to configure it, or"
" accept the default settings?"),
/* Default Action */ 1,
- purple_connection_get_account(purple_account_get_connection(js)), NULL, chat->conv,
+ purple_connection_get_account(js->gc), NULL, chat->conv,
chat, 2,
_("_Configure Room"), G_CALLBACK(jabber_chat_request_room_configure),
_("_Accept Defaults"), G_CALLBACK(jabber_chat_create_instant_room));
@@ -576,11 +576,11 @@ void jabber_presence_parse(JabberStream
if(chat->conv) {
title = g_strdup_printf(_("Error in chat %s"), from);
if (g_hash_table_size(chat->members) == 0)
- serv_got_chat_left(purple_account_get_connection(js), chat->id);
+ serv_got_chat_left(js->gc, chat->id);
} else {
title = g_strdup_printf(_("Error joining chat %s"), from);
}
- purple_notify_error(purple_account_get_connection(js), title, title, msg);
+ purple_notify_error(js->gc, title, title, msg);
g_free(title);
g_free(msg);
@@ -651,7 +651,7 @@ void jabber_presence_parse(JabberStream
}
if(!nick_change) {
if(!g_utf8_collate(jid->resource, chat->handle)) {
- serv_got_chat_left(purple_account_get_connection(js), chat->id);
+ serv_got_chat_left(js->gc, chat->id);
jabber_chat_destroy(chat);
} else {
purple_conv_chat_remove_user(PURPLE_CONV_CHAT(chat->conv), jid->resource,
@@ -663,7 +663,7 @@ void jabber_presence_parse(JabberStream
if(!chat->conv) {
chat->id = i++;
chat->muc = muc;
- chat->conv = serv_got_joined_chat(purple_account_get_connection(js), chat->id, room_jid);
+ chat->conv = serv_got_joined_chat(js->gc, chat->id, room_jid);
purple_conv_chat_set_nick(PURPLE_CONV_CHAT(chat->conv), chat->handle);
jabber_chat_disco_traffic(chat);
@@ -685,10 +685,10 @@ void jabber_presence_parse(JabberStream
} else {
buddy_name = g_strdup_printf("%s%s%s", jid->node ? jid->node : "",
jid->node ? "@" : "", jid->domain);
- if((b = purple_find_buddy(purple_account_get_connection(js)->account, buddy_name)) == NULL) {
+ if((b = purple_find_buddy(purple_connection_get_account(js->gc), buddy_name)) == NULL) {
if(!jid->node || strcmp(jid->node,js->user->node) || strcmp(jid->domain,js->user->domain)) {
purple_debug_warning("jabber", "Got presence for unknown buddy %s on account %s (%x)\n",
- buddy_name, purple_account_get_username(purple_account_get_connection(js)->account), purple_account_get_connection(js)->account);
+ buddy_name, purple_account_get_username(purple_connection_get_account(js->gc)), purple_connection_get_account(js->gc));
jabber_id_free(jid);
g_free(avatar_hash);
g_free(buddy_name);
@@ -731,7 +731,7 @@ void jabber_presence_parse(JabberStream
PurpleConversation *conv;
jabber_buddy_remove_resource(jb, jid->resource);
- if((conv = jabber_find_unnormalized_conv(from, purple_account_get_connection(js)->account)))
+ if((conv = jabber_find_unnormalized_conv(from, purple_connection_get_account(js->gc))))
purple_conversation_set_name(conv, buddy_name);
} else {
@@ -754,9 +754,9 @@ void jabber_presence_parse(JabberStream
if((found_jbr = jabber_buddy_find_resource(jb, NULL))) {
jabber_google_presence_incoming(js, buddy_name, found_jbr);
- purple_prpl_got_user_status(purple_account_get_connection(js)->account, buddy_name, jabber_buddy_state_get_status_id(found_jbr->state), "priority", found_jbr->priority, "message", found_jbr->status, NULL);
+ purple_prpl_got_user_status(purple_connection_get_account(js->gc), buddy_name, jabber_buddy_state_get_status_id(found_jbr->state), "priority", found_jbr->priority, "message", found_jbr->status, NULL);
} else {
- purple_prpl_got_user_status(purple_account_get_connection(js)->account, buddy_name, "offline", status ? "message" : NULL, status, NULL);
+ purple_prpl_got_user_status(purple_connection_get_account(js->gc), buddy_name, "offline", status ? "message" : NULL, status, NULL);
}
g_free(buddy_name);
}
============================================================
--- libpurple/protocols/jabber/roster.c 0f8a4f252fd169f7ddcf6708db37bb3d7165e709
+++ libpurple/protocols/jabber/roster.c 4eb95faaa099b0fcca44342e2eb915e21a830770
@@ -45,7 +45,7 @@ static void remove_purple_buddies(Jabber
{
GSList *buddies, *l;
- buddies = purple_find_buddies(purple_account_get_connection(js)->account, jid);
+ buddies = purple_find_buddies(purple_connection_get_account(js->gc), jid);
for(l = buddies; l; l = l->next)
purple_blist_remove_buddy(l->data);
@@ -60,7 +60,7 @@ static void add_purple_buddies_to_groups
gchar *my_bare_jid;
GList *pool = NULL;
- buddies = purple_find_buddies(purple_account_get_connection(js)->account, jid);
+ buddies = purple_find_buddies(purple_connection_get_account(js->gc), jid);
g2 = groups;
@@ -85,7 +85,7 @@ static void add_purple_buddies_to_groups
const char *servernick;
if((servernick = purple_blist_node_get_string((PurpleBlistNode*)b, "servernick")))
- serv_got_alias(purple_account_get_connection(js), jid, servernick);
+ serv_got_alias(js->gc, jid, servernick);
if(alias && (!b->alias || strcmp(b->alias, alias)))
purple_blist_alias_buddy(b, alias);
@@ -104,7 +104,7 @@ static void add_purple_buddies_to_groups
b = pool->data;
pool = g_list_delete_link(pool, pool);
} else {
- b = purple_buddy_new(purple_account_get_connection(js)->account, jid, alias);
+ b = purple_buddy_new(purple_connection_get_account(js->gc), jid, alias);
}
if(!g) {
@@ -122,7 +122,7 @@ static void add_purple_buddies_to_groups
PurplePresence *gpresence;
PurpleStatus *status;
- gpresence = purple_account_get_presence(purple_account_get_connection(js)->account);
+ gpresence = purple_account_get_presence(purple_connection_get_account(js->gc));
status = purple_presence_get_active_status(gpresence);
jabber_presence_fake_to_self(js, status);
}
@@ -150,14 +150,14 @@ void jabber_roster_parse(JabberStream *j
char *from_norm;
gboolean invalid;
- from_norm = g_strdup(jabber_normalize(purple_account_get_connection(js)->account, from));
+ from_norm = g_strdup(jabber_normalize(purple_connection_get_account(js->gc), from));
if(!from_norm)
return;
invalid = g_utf8_collate(from_norm,
- jabber_normalize(purple_account_get_connection(js)->account,
- purple_account_get_username(purple_account_get_connection(js)->account)));
+ jabber_normalize(purple_connection_get_account(js->gc),
+ purple_account_get_username(purple_connection_get_account(js->gc))));
g_free(from_norm);
@@ -190,10 +190,10 @@ void jabber_roster_parse(JabberStream *j
char *jid_norm;
const char *username;
- jid_norm = g_strdup(jabber_normalize(purple_account_get_connection(js)->account, jid));
- username = purple_account_get_username(purple_account_get_connection(js)->account);
+ jid_norm = g_strdup(jabber_normalize(purple_connection_get_account(js->gc), jid));
+ username = purple_account_get_username(purple_connection_get_account(js->gc));
me = g_utf8_collate(jid_norm,
- jabber_normalize(purple_account_get_connection(js)->account,
+ jabber_normalize(purple_connection_get_account(js->gc),
username));
g_free(jid_norm);
@@ -217,7 +217,7 @@ void jabber_roster_parse(JabberStream *j
/*
if ((jb->subscription & JABBER_SUB_FROM) ||
(jb->subscription & JABBER_SUB_NONE)) {
- purple_prpl_got_user_status(purple_account_get_connection(js)->account, jid, "offline", NULL);
+ purple_prpl_got_user_status(purple_connection_get_account(js->gc), jid, "offline", NULL);
}
*/
}
@@ -256,7 +256,7 @@ void jabber_roster_parse(JabberStream *j
if(!js->roster_parsed) {
js->roster_parsed = TRUE;
- jabber_presence_send(purple_account_get_connection(js)->account, NULL);
+ jabber_presence_send(purple_connection_get_account(js->gc), NULL);
}
}
@@ -269,13 +269,13 @@ static void jabber_roster_update(JabberS
JabberIq *iq;
xmlnode *query, *item, *group;
- if(!(b = purple_find_buddy(purple_account_get_connection(js)->account, name)))
+ if(!(b = purple_find_buddy(purple_connection_get_account(js->gc), name)))
return;
if(grps) {
groups = grps;
} else {
- GSList *buddies = purple_find_buddies(purple_account_get_connection(js)->account, name);
+ GSList *buddies = purple_find_buddies(purple_connection_get_account(js->gc), name);
if(!buddies)
return;
while(buddies) {
@@ -314,7 +314,7 @@ void jabber_roster_add_buddy(PurpleConne
void jabber_roster_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy,
PurpleGroup *group)
{
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
char *who;
GSList *groups = NULL;
JabberBuddy *jb;
@@ -340,7 +340,7 @@ void jabber_roster_add_buddy(PurpleConne
PurplePresence *gpresence;
PurpleStatus *status;
- gpresence = purple_account_get_presence(purple_account_get_connection(js)->account);
+ gpresence = purple_account_get_presence(purple_connection_get_account(js->gc));
status = purple_presence_get_active_status(gpresence);
jabber_presence_fake_to_self(js, status);
} else if(!jb || !(jb->subscription & JABBER_SUB_TO)) {
@@ -362,7 +362,7 @@ void jabber_roster_alias_change(PurpleCo
if(b != NULL) {
purple_blist_alias_buddy(b, alias);
- jabber_roster_update(gc->proto_data, name, NULL);
+ jabber_roster_update(purple_object_get_protocol_data(PURPLE_OBJECT(gc)), name, NULL);
}
}
@@ -386,7 +386,7 @@ void jabber_roster_group_change(PurpleCo
groups = g_slist_append(groups, g->name);
buddies = g_slist_remove(buddies, b);
}
- jabber_roster_update(gc->proto_data, name, groups);
+ jabber_roster_update(purple_object_get_protocol_data(PURPLE_OBJECT(gc)), name, groups);
g_slist_free(groups);
}
@@ -417,10 +417,10 @@ void jabber_roster_remove_buddy(PurpleCo
buddies = g_slist_remove(buddies, tmpbuddy);
}
- jabber_roster_update(gc->proto_data, buddy->name, groups);
+ jabber_roster_update(purple_object_get_protocol_data(PURPLE_OBJECT(gc)), buddy->name, groups);
g_slist_free(groups);
} else {
- JabberIq *iq = jabber_iq_new_query(gc->proto_data, JABBER_IQ_SET,
+ JabberIq *iq = jabber_iq_new_query(purple_object_get_protocol_data(PURPLE_OBJECT(gc)), JABBER_IQ_SET,
"jabber:iq:roster");
xmlnode *query = xmlnode_get_child(iq->node, "query");
xmlnode *item = xmlnode_new_child(query, "item");
============================================================
--- libpurple/protocols/jabber/si.c 5db4e23fbc5814a8d4829b2db56daec04a2ca247
+++ libpurple/protocols/jabber/si.c 496d2f114b0aed34e23568d17afd457d58c0ec10
@@ -1016,7 +1016,7 @@ static void jabber_si_xfer_send_disco_cb
jabber_si_xfer_send_request(xfer);
} else {
char *msg = g_strdup_printf(_("Unable to send file to %s, user does not support file transfers"), who);
- purple_notify_error(purple_account_get_connection(js), _("File Send Failed"),
+ purple_notify_error(js->gc, _("File Send Failed"),
_("File Send Failed"), msg);
g_free(msg);
}
@@ -1086,7 +1086,7 @@ static void jabber_si_xfer_init(PurpleXf
msg = g_strdup_printf(_("Unable to send file to %s, not subscribed to user presence"), xfer->who);
}
- purple_notify_error(purple_account_get_connection(jsx->js), _("File Send Failed"), _("File Send Failed"), msg);
+ purple_notify_error(jsx->js->gc, _("File Send Failed"), _("File Send Failed"), msg);
g_free(msg);
} else if(g_list_length(jb->resources) == 1) {
/* only 1 resource online (probably our most common case)
@@ -1114,9 +1114,9 @@ static void jabber_si_xfer_init(PurpleXf
purple_request_fields_add_group(fields, group);
- purple_request_fields(purple_account_get_connection(jsx->js), _("Select a Resource"), msg, NULL, fields,
+ purple_request_fields(jsx->js->gc, _("Select a Resource"), msg, NULL, fields,
_("Send File"), G_CALLBACK(resource_select_ok_cb), _("Cancel"), G_CALLBACK(resource_select_cancel_cb),
- purple_account_get_connection(jsx->js)->account, xfer->who, NULL, xfer);
+ purple_connection_get_account(jsx->js->gc), xfer->who, NULL, xfer);
g_free(msg);
}
@@ -1162,7 +1162,7 @@ PurpleXfer *jabber_si_new_xfer(PurpleCon
PurpleXfer *xfer;
JabberSIXfer *jsx;
- js = gc->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_SEND, who);
if (xfer)
@@ -1186,7 +1186,7 @@ void jabber_si_xfer_send(PurpleConnectio
PurpleXfer *xfer;
- js = gc->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if(!purple_find_buddy(purple_connection_get_account(gc), who) || !jabber_buddy_find(js, who, FALSE))
return;
@@ -1274,7 +1274,7 @@ void jabber_si_parse(JabberStream *js, x
jsx->stream_id = g_strdup(stream_id);
jsx->iq_id = g_strdup(xmlnode_get_attrib(packet, "id"));
- xfer = purple_xfer_new(purple_account_get_connection(js)->account, PURPLE_XFER_RECEIVE, from);
+ xfer = purple_xfer_new(purple_connection_get_account(js->gc), PURPLE_XFER_RECEIVE, from);
if (xfer)
{
xfer->data = jsx;
============================================================
--- libpurple/protocols/jabber/usermood.c eb75680ef276422ace50eecfa46107b17c55e5a3
+++ libpurple/protocols/jabber/usermood.c 805f0abd0c4ce7ac4ba7bb4f649a41a61a9f72cb
@@ -135,7 +135,7 @@ static void jabber_mood_cb(JabberStream
}
status_id = jabber_buddy_state_get_status_id(resource->state);
- purple_prpl_got_user_status(purple_account_get_connection(js)->account, from, status_id, "mood", _(newmood), "moodtext", moodtext?moodtext:"", NULL);
+ purple_prpl_got_user_status(purple_connection_get_account(js->gc), from, status_id, "mood", _(newmood), "moodtext", moodtext?moodtext:"", NULL);
}
g_free(moodtext);
}
@@ -155,7 +155,7 @@ static void do_mood_set_from_fields(Purp
return;
}
- js = gc->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
/* This is ugly, but protects us from unexpected values. */
for (max_mood_idx = 0; moodstrings[max_mood_idx]; max_mood_idx++);
============================================================
--- libpurple/protocols/jabber/usernick.c fd46fa2bc6907ddb5bb6dd0bd9ca2ce91a987dc1
+++ libpurple/protocols/jabber/usernick.c c20ded1eb220731292e328b8b694571998c82792
@@ -43,7 +43,7 @@ static void jabber_nick_cb(JabberStream
if (!nick)
return;
nickname = xmlnode_get_data(nick);
- serv_got_alias(purple_account_get_connection(js), from, nickname);
+ serv_got_alias(js->gc, from, nickname);
g_free(nickname);
}
@@ -73,16 +73,16 @@ static void do_nick_got_own_nick_cb(Jabb
oldnickname = xmlnode_get_data(nick);
}
- purple_request_input(purple_account_get_connection(js), _("Set User Nickname"), _("Please specify a new nickname for you."),
+ purple_request_input(js->gc, _("Set User Nickname"), _("Please specify a new nickname for you."),
_("This information is visible to all contacts on your contact list, so choose something appropriate."),
oldnickname, FALSE, FALSE, NULL, _("Set"), PURPLE_CALLBACK(do_nick_set), _("Cancel"), NULL,
- purple_connection_get_account(purple_account_get_connection(js)), NULL, NULL, js);
+ purple_connection_get_account(js->gc), NULL, NULL, js);
g_free(oldnickname);
}
static void do_nick_set_nick(PurplePluginAction *action) {
PurpleConnection *gc = (PurpleConnection *) action->context;
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
char *jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain);
/* since the nickname might have been changed by another resource of this account, we always have to request the old one
============================================================
--- libpurple/protocols/jabber/usertune.c 23c344f688b0f853fc959fc13408b296ed48138d
+++ libpurple/protocols/jabber/usertune.c 4fd504e608a58b9fef1412863cf140c39ad96ec9
@@ -90,7 +90,7 @@ static void jabber_tune_cb(JabberStream
}
if (valid) {
- purple_prpl_got_user_status(purple_account_get_connection(js)->account, from, "tune",
+ purple_prpl_got_user_status(purple_connection_get_account(js->gc), from, "tune",
PURPLE_TUNE_ARTIST, tuneinfodata.artist,
PURPLE_TUNE_TITLE, tuneinfodata.title,
PURPLE_TUNE_ALBUM, tuneinfodata.album,
@@ -98,7 +98,7 @@ static void jabber_tune_cb(JabberStream
PURPLE_TUNE_TIME, tuneinfodata.time,
PURPLE_TUNE_URL, tuneinfodata.url, NULL);
} else {
- purple_prpl_got_user_status_deactive(purple_account_get_connection(js)->account, from, "tune");
+ purple_prpl_got_user_status_deactive(purple_connection_get_account(js->gc), from, "tune");
}
g_free(tuneinfodata.artist);
@@ -115,7 +115,7 @@ void jabber_tune_set(PurpleConnection *g
void jabber_tune_set(PurpleConnection *gc, const PurpleJabberTuneInfo *tuneinfo) {
xmlnode *publish, *tunenode;
- JabberStream *js = gc->proto_data;
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
publish = xmlnode_new("publish");
xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/tune");
============================================================
--- libpurple/protocols/jabber/xdata.c ba80c09e3e8b9118b8a51805a23347a6e0d3469a
+++ libpurple/protocols/jabber/xdata.c a5bb60f9c19aeee1e75bf8c583b70f7956483f14
@@ -395,10 +395,10 @@ void *jabber_x_data_request_with_actions
if((x = xmlnode_get_child(packet, "instructions")))
instructions = xmlnode_get_data(x);
- handle = purple_request_fields(purple_account_get_connection(js), title, title, instructions, fields,
+ handle = purple_request_fields(js->gc, title, title, instructions, fields,
_("OK"), G_CALLBACK(jabber_x_data_ok_cb),
_("Cancel"), G_CALLBACK(jabber_x_data_cancel_cb),
- purple_connection_get_account(purple_account_get_connection(js)), /* XXX Do we have a who here? */ NULL, NULL,
+ purple_connection_get_account(js->gc), /* XXX Do we have a who here? */ NULL, NULL,
data);
g_free(title);
More information about the Commits
mailing list