cpw.malu.xmpp.idle: 18de7ed8: Change jabber_presence_send to not take ...
malu at pidgin.im
malu at pidgin.im
Mon Nov 17 13:25:28 EST 2008
-----------------------------------------------------------------
Revision: 18de7ed8a29db51e943c1649ac63b3374a76747d
Ancestor: 0f629ecd56445f5e3480f562756dff78835b1100
Author: malu at pidgin.im
Date: 2008-11-17T18:22:26
Branch: im.pidgin.cpw.malu.xmpp.idle
URL: http://d.pidgin.im/viewmtn/revision/info/18de7ed8a29db51e943c1649ac63b3374a76747d
Modified files:
libpurple/protocols/jabber/buddy.c
libpurple/protocols/jabber/disco.c
libpurple/protocols/jabber/jabber.c
libpurple/protocols/jabber/jabber.h
libpurple/protocols/jabber/presence.c
libpurple/protocols/jabber/presence.h
libpurple/protocols/jabber/roster.c
ChangeLog:
Change jabber_presence_send to not take an extra argument to force idle updating
Changed a g_sprintf to g_snprintf
Thanks to darkrain42 for feedback and suggestions
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/buddy.c ba0c5e278c9fd7a40af3c1b4b734f1b65496ca23
+++ libpurple/protocols/jabber/buddy.c b687d1cce701f26584534067479bb48e29893101
@@ -627,7 +627,7 @@ void jabber_set_buddy_icon(PurpleConnect
gpresence = purple_account_get_presence(gc->account);
status = purple_presence_get_active_status(gpresence);
- jabber_presence_send(gc->account, status, FALSE);
+ jabber_presence_send(gc->account, status);
}
/*
============================================================
--- libpurple/protocols/jabber/disco.c 7a7045489884ae4fcd1b2ab6e76b1da0f4bf0148
+++ libpurple/protocols/jabber/disco.c 7f85a8a092ed6670ee147af38b8482042416e2ee
@@ -348,7 +348,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(js->gc->account, NULL, FALSE);
+ jabber_presence_send(js->gc->account, NULL);
if (js->server_caps & JABBER_CAP_ADHOC) {
/* The server supports ad-hoc commands, so let's request the list */
============================================================
--- libpurple/protocols/jabber/jabber.c 07dcd63dd716adf23b5b19743564bfe7a5d47682
+++ libpurple/protocols/jabber/jabber.c 50aac197d093c2a139eb96ce12b51565d9ec4bfd
@@ -1441,7 +1441,7 @@ void jabber_idle_set(PurpleConnection *g
/* send out an updated prescence */
purple_debug_info("jabber", "sending updated presence for idle\n");
- jabber_presence_send(account, status, TRUE);
+ jabber_presence_send(account, status);
}
void jabber_add_feature(const char *shortname, const char *namespace, JabberFeatureEnabled cb) {
============================================================
--- libpurple/protocols/jabber/jabber.h 278f09ab8a8ec522143d1a89519a628427847ed7
+++ libpurple/protocols/jabber/jabber.h 6d0bf31a8f3070e9b25718ac00c76001bf82ddb7
@@ -153,6 +153,7 @@ struct _JabberStream
GList *file_transfers;
time_t idle;
+ time_t old_idle;
JabberID *user;
PurpleConnection *gc;
============================================================
--- libpurple/protocols/jabber/presence.c 8ff09df191e0c2c016d00a522fab6ac511920419
+++ libpurple/protocols/jabber/presence.c 62a9edbd04fd3676a6b4da48fde40c3ce8ed7a0b
@@ -95,8 +95,7 @@ void jabber_presence_fake_to_self(Jabber
}
-void jabber_presence_send(PurpleAccount *account, PurpleStatus *status,
- gboolean update_idle)
+void jabber_presence_send(PurpleAccount *account, PurpleStatus *status)
{
PurpleConnection *gc = NULL;
JabberStream *js = NULL;
@@ -151,8 +150,9 @@ void jabber_presence_send(PurpleAccount
#define CHANGED(a,b) ((!a && b) || (a && a[0] == '\0' && b && b[0] != '\0') || \
(a && !b) || (a && a[0] != '\0' && b && b[0] == '\0') || (a && b && strcmp(a,b)))
/* check if there are any differences to the <presence> and send them in that case */
- if (update_idle || allowBuzz != js->allowBuzz || js->old_state != state || CHANGED(js->old_msg, stripped) ||
- js->old_priority != priority || CHANGED(js->old_avatarhash, js->avatar_hash)) {
+ if (allowBuzz != js->allowBuzz || js->old_state != state || CHANGED(js->old_msg, stripped) ||
+ js->old_priority != priority || CHANGED(js->old_avatarhash, js->avatar_hash) ||
+ js->old_idle != js->idle) {
js->allowBuzz = allowBuzz;
presence = jabber_presence_create_js(js, state, stripped, priority);
@@ -179,6 +179,7 @@ void jabber_presence_send(PurpleAccount
js->old_avatarhash = g_strdup(js->avatar_hash);
js->old_state = state;
js->old_priority = priority;
+ js->old_idle = js->idle;
}
g_free(stripped);
@@ -265,7 +266,7 @@ xmlnode *jabber_presence_create_js(Jabbe
if (js->idle && state != JABBER_BUDDY_STATE_UNAVAILABLE) {
xmlnode *query = xmlnode_new_child(presence, "query");
gchar seconds[10];
- g_sprintf(seconds, "%d", (int) (time(NULL) - js->idle));
+ g_snprintf(seconds, 10, "%d", (int) (time(NULL) - js->idle));
xmlnode_set_namespace(query, "jabber:iq:last");
xmlnode_set_attrib(query, "seconds", seconds);
============================================================
--- libpurple/protocols/jabber/presence.h d9060c67c048b365eb8c9edc4bec60b58c371cfa
+++ libpurple/protocols/jabber/presence.h a77bd82d513655a2ba4eef03d8c9f2d70e7e7e3d
@@ -26,8 +26,7 @@
#include "jabber.h"
#include "xmlnode.h"
-void jabber_presence_send(PurpleAccount *account, PurpleStatus *status,
- gboolean update_idle);
+void jabber_presence_send(PurpleAccount *account, PurpleStatus *status);
xmlnode *jabber_presence_create(JabberBuddyState state, const char *msg, int priority); /* DEPRECATED */
xmlnode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority);
void jabber_presence_parse(JabberStream *js, xmlnode *packet);
============================================================
--- libpurple/protocols/jabber/roster.c 89f92e6dd7b9b26035b253670fefa8bbdf42bad7
+++ libpurple/protocols/jabber/roster.c a384763565f91ecfa641f97f9ba59f697fa9169a
@@ -261,7 +261,7 @@ void jabber_roster_parse(JabberStream *j
if(!js->roster_parsed) {
js->roster_parsed = TRUE;
- jabber_presence_send(js->gc->account, NULL, FALSE);
+ jabber_presence_send(js->gc->account, NULL);
}
}
More information about the Commits
mailing list