gobjectification: 59ee7907: Fix Jabber compilation, as I told Gary I...
darkrain42 at pidgin.im
darkrain42 at pidgin.im
Mon Jun 8 02:40:29 EDT 2009
-----------------------------------------------------------------
Revision: 59ee79076323cbeeecc0eb85c47dd5d9644d8f65
Ancestor: 13654e8bc5daa13dc56d4b9127a14e7b29972acb
Author: darkrain42 at pidgin.im
Date: 2009-06-08T06:38:10
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/59ee79076323cbeeecc0eb85c47dd5d9644d8f65
Modified files:
libpurple/protocols/jabber/buddy.c
libpurple/protocols/jabber/caps.c
libpurple/protocols/jabber/caps.h
libpurple/protocols/jabber/jabber.c
libpurple/protocols/jabber/oob.c
libpurple/protocols/jabber/presence.c libpurple/signals.h
ChangeLog:
Fix Jabber compilation, as I told Gary I would.
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/buddy.c d3569d070a87478a97eb02cd19717743d508c4bf
+++ libpurple/protocols/jabber/buddy.c 299dda99541872a954ca27274e6a5825ae2a37d9
@@ -490,7 +490,7 @@ void jabber_set_buddy_icon(PurpleConnect
PurpleAccount *account = purple_connection_get_account(gc);
/* Publish the avatar as specified in XEP-0084 */
- jabber_avatar_set(gc->proto_data, img);
+ jabber_avatar_set(purple_connection_get_protocol_data(gc), img);
/* Set the image in our vCard */
jabber_set_info(gc, purple_account_get_user_info(account));
@@ -1499,7 +1499,7 @@ static void jabber_last_parse(JabberStre
if (jbr ==
jabber_buddy_find_resource(jb, NULL)) {
- purple_prpl_got_user_idle(js->gc->account,
+ purple_prpl_got_user_idle(purple_connection_get_account(js->gc),
buddy_name, jbr->idle, jbr->idle);
}
}
@@ -1921,7 +1921,7 @@ static void jabber_buddy_logout(PurpleBl
/* simply create a directed unavailable presence */
PurpleBuddy *buddy = (PurpleBuddy *) node;
PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy));
- JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(buddy->account)));
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
xmlnode *presence;
presence = jabber_presence_create_js(js, JABBER_BUDDY_STATE_UNAVAILABLE, NULL, 0);
============================================================
--- libpurple/protocols/jabber/caps.c 5b4d2e178a08e1604feb7098410724677149b929
+++ libpurple/protocols/jabber/caps.c 0362f586f8f14e1e283ad9d6693f2f1b29d03255
@@ -20,10 +20,12 @@
*/
#include "internal.h"
+#include "cipher.h"
+#include "md5cipher.h"
+#include "sha1cipher.h"
#include "debug.h"
#include "caps.h"
-#include "cipher.h"
#include "iq.h"
#include "presence.h"
#include "util.h"
@@ -457,9 +459,9 @@ jabber_caps_client_iqcb(JabberStream *js
if (userdata->hash) {
gchar *hash = NULL;
if (!strcmp(userdata->hash, "sha-1")) {
- hash = jabber_caps_calculate_hash(info, "sha1");
+ hash = jabber_caps_calculate_hash(info, PURPLE_CIPHER(purple_sha1_cipher_new()));
} else if (!strcmp(userdata->hash, "md5")) {
- hash = jabber_caps_calculate_hash(info, "md5");
+ hash = jabber_caps_calculate_hash(info, PURPLE_CIPHER(purple_md5_cipher_new()));
}
if (!hash || strcmp(hash, userdata->ver)) {
@@ -820,16 +822,15 @@ jabber_caps_verification_append(GString
return g_string_append_c(verification, '<');
}
-gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, const char *hash)
+gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, PurpleCipher *hasher)
{
GList *node;
GString *verification;
- PurpleCipherContext *context;
guint8 checksum[20];
gsize checksum_size = 20;
gboolean success;
- if (!info || !(context = purple_cipher_context_new_by_name(hash, NULL)))
+ if (!info)
return NULL;
/* sort identities, features and x-data forms */
@@ -898,13 +899,13 @@ gchar *jabber_caps_calculate_hash(Jabber
}
/* generate hash */
- purple_cipher_context_append(context, (guchar*)verification->str, verification->len);
+ purple_cipher_append(hasher, (guchar*)verification->str, verification->len);
- success = purple_cipher_context_digest(context, verification->len,
- checksum, &checksum_size);
+ success = purple_cipher_digest(hasher, verification->len,
+ checksum, &checksum_size);
g_string_free(verification, TRUE);
- purple_cipher_context_destroy(context);
+ g_object_unref(hasher);
return (success ? purple_base64_encode(checksum, checksum_size) : NULL);
}
@@ -937,7 +938,7 @@ void jabber_caps_calculate_own_hash(Jabb
info.forms = NULL;
g_free(js->caps_hash);
- js->caps_hash = jabber_caps_calculate_hash(&info, "sha1");
+ js->caps_hash = jabber_caps_calculate_hash(&info, purple_sha1_cipher_new());
g_list_free(info.identities);
g_list_free(features);
}
@@ -959,7 +960,8 @@ void jabber_caps_broadcast_change()
const char *prpl_id = purple_account_get_protocol_id(account);
if (!strcmp("prpl-jabber", prpl_id) && purple_account_is_connected(account)) {
PurpleConnection *gc = purple_account_get_connection(account);
- jabber_presence_send(gc->proto_data, TRUE);
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+ jabber_presence_send(js, TRUE);
}
}
============================================================
--- libpurple/protocols/jabber/caps.h d38cca7fd22b8f627e69d0998d2970d57f02f05f
+++ libpurple/protocols/jabber/caps.h 91c8cc39c72ddaa5027aee655adc0eda08502123
@@ -25,6 +25,7 @@ typedef struct _JabberCapsClientInfo Jab
typedef struct _JabberCapsClientInfo JabberCapsClientInfo;
#include "jabber.h"
+#include "cipher.h"
/* Implementation of XEP-0115 - Entity Capabilities */
@@ -96,7 +97,7 @@ void jabber_caps_get_info(JabberStream *
* @param hash Hash cipher to be used. Either sha-1 or md5.
* @return The base64 encoded SHA-1 hash; must be freed by caller
*/
-gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, const char *hash);
+gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, PurpleCipher *hasher);
/**
* Calculate SHA1 hash for own featureset.
============================================================
--- libpurple/protocols/jabber/jabber.c 796a5d5dd0246b8020f3b1d12a53c602b1a40301
+++ libpurple/protocols/jabber/jabber.c 790b31a690f46029704cbc6f22b8822796938788
@@ -879,7 +879,6 @@ jabber_registration_result_cb(JabberStre
#if 0
PurpleAccount *account = purple_connection_get_account(js->gc);
#endif
- const char *type = xmlnode_get_attrib(packet, "type");
char *buf;
char *to = data;
@@ -1448,7 +1447,12 @@ void jabber_close(PurpleConnection *gc)
* 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) {
+#else
+ {
+#endif
if (js->use_bosh)
jabber_bosh_connection_close(js->bosh);
else
@@ -1631,8 +1635,6 @@ void jabber_idle_set(PurpleConnection *g
void jabber_idle_set(PurpleConnection *gc, int idle)
{
JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
- PurpleAccount *account = purple_connection_get_account(gc);
- PurpleStatus *status = purple_account_get_active_status(account);
js->idle = idle ? time(NULL) - idle : idle;
@@ -1956,9 +1958,10 @@ char *jabber_status_text(PurpleBuddy *b)
JabberBuddy *jb = NULL;
PurpleAccount *account = purple_buddy_get_account(b);
PurpleConnection *gc = purple_account_get_connection(account);
+ JabberStream *js = gc ? purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
- if (gc && purple_object_get_protocol_data(PURPLE_OBJECT(gc)))
- jb = jabber_buddy_find(purple_object_get_protocol_data(PURPLE_OBJECT(gc), purple_buddy_get_name(b), FALSE);
+ if (js)
+ jb = jabber_buddy_find(js, purple_buddy_get_name(b), FALSE);
if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && (jb->subscription & JABBER_SUB_PENDING || !(jb->subscription & JABBER_SUB_TO))) {
ret = g_strdup(_("Not Authorized"));
@@ -2049,7 +2052,6 @@ void jabber_tooltip_text(PurpleBuddy *b,
gc = purple_account_get_connection(account);
g_return_if_fail(gc != NULL);
- g_return_if_fail(gc->proto_data != NULL);
js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
g_return_if_fail(js != NULL);
@@ -2140,7 +2142,7 @@ GList *jabber_status_types(PurpleAccount
PurpleStatusType *type;
GList *types = NULL;
GValue *priority_value;
- PurpleValue *buzz_enabled;
+ GValue *buzz_enabled;
priority_value = purple_g_value_slice_new(G_TYPE_INT);
g_value_set_int(priority_value, 1);
@@ -2893,7 +2895,8 @@ 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_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(conv->account)));
+ PurpleConnection *gc = purple_account_get_connection(conv->account);
+ JabberStream *js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
const gchar *who;
if (!args || !args[0]) {
@@ -2911,8 +2914,7 @@ static PurpleCmdRet jabber_cmd_buzz(Purp
const gchar *alias;
gchar *str;
PurpleBuddy *buddy =
- purple_find_buddy(purple_connection_get_account(conv->account->gc),
- who);
+ purple_find_buddy(conv->account, who);
if (buddy != NULL)
alias = purple_buddy_get_contact_alias(buddy);
@@ -3018,8 +3020,8 @@ jabber_initiate_media(PurpleAccount *acc
PurpleMediaSessionType type)
{
#ifdef USE_VV
- JabberStream *js = (JabberStream *)
- purple_account_get_connection(account)->proto_data;
+ JabberStream *js =
+ purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(account)));
JabberBuddy *jb;
JabberBuddyResource *jbr = NULL;
char *resource;
@@ -3162,8 +3164,8 @@ PurpleMediaCaps jabber_get_media_caps(Pu
PurpleMediaCaps jabber_get_media_caps(PurpleAccount *account, const char *who)
{
#ifdef USE_VV
- JabberStream *js = (JabberStream *)
- purple_account_get_connection(account)->proto_data;
+ JabberStream *js =
+ purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(account)));
JabberBuddy *jb;
JabberBuddyResource *jbr;
PurpleMediaCaps caps = PURPLE_MEDIA_CAPS_NONE;
@@ -3400,7 +3402,7 @@ jabber_ipc_contact_has_feature(PurpleAcc
if (!purple_account_is_connected(account))
return FALSE;
- js = gc->proto_data;
+ js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (!(resource = jabber_get_resource(jid)) ||
!(jb = jabber_buddy_find(js, jid, FALSE)) ||
============================================================
--- libpurple/protocols/jabber/oob.c e2762a22d6fcb6bdca27ad9ffb29dc5452d1ae84
+++ libpurple/protocols/jabber/oob.c e4480991e8478c5e40c1aa88fd7f5421bf0b04bd
@@ -211,10 +211,10 @@ void jabber_oob_parse(JabberStream *js,
g_free(url);
jox->js = js;
jox->headers = g_string_new("");
- jox->iq_id = g_strdup(xmlnode_get_attrib(packet, "id"));
+ jox->iq_id = g_strdup(id);
xfer = purple_xfer_new(purple_connection_get_account(js->gc), PURPLE_XFER_RECEIVE,
- xmlnode_get_attrib(packet, "from"));
+ from);
if (xfer)
{
xfer->data = jox;
============================================================
--- libpurple/protocols/jabber/presence.c 037eca6c624e6a8116e4f93ec70c5c4a23b4bba0
+++ libpurple/protocols/jabber/presence.c 0cf91cce05fad69b55c62aff4698212d8444b6b2
@@ -398,7 +398,7 @@ jabber_vcard_parse_avatar(JabberStream *
data = purple_base64_decode(text, &size);
hash = jabber_calculate_data_sha1sum(data, size);
- purple_buddy_icons_set_for_user(js->gc->account, from, data, size, hash);
+ purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, data, size, hash);
g_free(hash);
g_free(text);
}
@@ -856,9 +856,11 @@ void jabber_presence_parse(JabberStream
}
if((found_jbr = jabber_buddy_find_resource(jb, NULL))) {
+ PurpleAccount *account = purple_connection_get_account(js->gc);
+
jabber_google_presence_incoming(js, buddy_name, found_jbr);
- 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);
- purple_prpl_got_user_idle(js->gc->account, buddy_name, found_jbr->idle, found_jbr->idle);
+ purple_prpl_got_user_status(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_idle(account, buddy_name, found_jbr->idle, found_jbr->idle);
if (nickname)
serv_got_alias(js->gc, buddy_name, nickname);
} else {
============================================================
--- libpurple/signals.h ef02c3226cd752ab287addb698c49e6414dd3e2b
+++ libpurple/signals.h a20b39fb381f021a37ecfa55ebaa4d29ba6152a9
@@ -347,6 +347,8 @@ void purple_old_marshal_BOOLEAN__POINTER
PurpleCallback cb, va_list args, void *data, void **return_val);
void purple_old_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER(
PurpleCallback cb, va_list args, void *data, void **return_val);
+void purple_old_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER(
+ PurpleCallback cb, va_list args, void *data, void **return_val);
void purple_old_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT(
PurpleCallback cb, va_list args, void *data, void **return_val);
@@ -393,6 +395,7 @@ void purple_old_marshal_POINTER__POINTER
#define purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT purple_old_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT
#define purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER purple_old_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER
#define purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER purple_old_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER
+#define purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER purple_old_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER
#define purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT purple_old_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT
#define purple_marshal_BOOLEAN__INT_POINTER purple_old_marshal_BOOLEAN__INT_POINTER
#define purple_marshal_POINTER__POINTER_INT purple_old_marshal_POINTER__POINTER_INT
More information about the Commits
mailing list