soc.2010.icq-tlc: 021e6a7b: "Invisibility mode" improvements.
ivan.komarov at soc.pidgin.im
ivan.komarov at soc.pidgin.im
Wed Jun 23 18:55:47 EDT 2010
-----------------------------------------------------------------
Revision: 021e6a7b4ba46230e93812c39268259f8c6bc7fe
Ancestor: fb1ab831dedebf45ea50b6f87bfc00265a0115ef
Author: ivan.komarov at soc.pidgin.im
Date: 2010-06-23T22:22:52
Branch: im.pidgin.soc.2010.icq-tlc
URL: http://d.pidgin.im/viewmtn/revision/info/021e6a7b4ba46230e93812c39268259f8c6bc7fe
Modified files:
libpurple/protocols/oscar/family_oservice.c
libpurple/protocols/oscar/oscar.c
libpurple/protocols/oscar/oscar.h
ChangeLog:
"Invisibility mode" improvements.
1. Removed the code for setting the status message to the status name
(like "Available" or "Invisible") when no message is set by user.
This should fix #10633, since now no one will see our status
change to "Invisible" if we go invisible with no message set.
2. Got rid of sending superfluous packets on server.
* There's no need to call oscar_set_extended_status() from
oscar_set_status_icq(), because in all cases it has already
been called before that. The only thing oscar_set_status_icq()
does except setting the extended status is setting the
permit/deny setting, so I renamed it accordingly.
* No need to call oscar_set_icq_permdeny() in
purple_ssi_parseerr() (it will be called in purple_ssi_parselist() anyway).
* Combined setting the extended status and the status message
(as per TODO).
This should fix the problem when client like QIP see us as Invisible
for some (quite long) time before we appear as Offline.
Also, I removed the code for setting the "itmsurl" status attribute,
as there was no way to set this iTunes Store URL from the UI.
-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/family_oservice.c e0dc2fa7f9149a5493566ef9849fd69c9b609b58
+++ libpurple/protocols/oscar/family_oservice.c 4cb6ccc4d45d2e63f1a1f2c412abaaeff71a1054
@@ -883,7 +883,7 @@ aim_srv_setextrainfo(OscarData *od,
int
aim_srv_setextrainfo(OscarData *od,
gboolean seticqstatus, guint32 icqstatus,
- gboolean setstatusmsg, const char *statusmsg, const char *itmsurl)
+ gboolean setstatusmsg, const char *statusmsg)
{
FlapConnection *conn;
ByteStream bs;
@@ -911,18 +911,15 @@ aim_srv_setextrainfo(OscarData *od,
if (setstatusmsg)
{
- size_t statusmsglen, itmsurllen;
+ size_t statusmsglen;
ByteStream tmpbs;
statusmsglen = (statusmsg != NULL) ? strlen(statusmsg) : 0;
- itmsurllen = (itmsurl != NULL) ? strlen(itmsurl) : 0;
- byte_stream_new(&tmpbs, statusmsglen + 8 + itmsurllen + 8);
+ byte_stream_new(&tmpbs, statusmsglen + 8);
byte_stream_put_bart_asset_str(&tmpbs, 0x0002, statusmsg);
- byte_stream_put_bart_asset_str(&tmpbs, 0x0009, itmsurl);
- aim_tlvlist_add_raw(&tlvlist, 0x001d,
- byte_stream_curpos(&tmpbs), tmpbs.data);
+ aim_tlvlist_add_raw(&tlvlist, 0x001d, byte_stream_curpos(&tmpbs), tmpbs.data);
byte_stream_destroy(&tmpbs);
}
============================================================
--- libpurple/protocols/oscar/oscar.c b7cee78f49864d5983563764f969c9353071fe94
+++ libpurple/protocols/oscar/oscar.c 934e7c79beffc4241dc2487b4430a7f6ec41c595
@@ -133,7 +133,7 @@ static void oscar_set_info_and_status(Pu
void oscar_set_info(PurpleConnection *gc, const char *info);
static void oscar_set_info_and_status(PurpleAccount *account, gboolean setinfo, const char *rawinfo, gboolean setstatus, PurpleStatus *status);
-static void oscar_set_extendedstatus(PurpleConnection *gc);
+static void oscar_set_extended_status(PurpleConnection *gc);
static gboolean purple_ssi_rerequestdata(gpointer data);
void oscar_free_name_data(struct name_data *data) {
@@ -3238,7 +3238,7 @@ static int purple_bosrights(OscarData *o
PurpleStatus *status;
gboolean is_available;
PurplePresence *presence;
- const char *username, *message, *itmsurl;
+ const char *username, *message;
char *tmp;
va_list ap;
guint16 maxpermits, maxdenies;
@@ -3279,15 +3279,14 @@ static int purple_bosrights(OscarData *o
else
message = NULL;
tmp = purple_markup_strip_html(message);
- itmsurl = purple_status_get_attr_string(status, "itmsurl");
- aim_srv_setextrainfo(od, FALSE, 0, is_available, tmp, itmsurl);
+ aim_srv_setextrainfo(od, FALSE, 0, is_available, tmp);
g_free(tmp);
presence = purple_status_get_presence(status);
aim_srv_setidle(od, !purple_presence_is_idle(presence) ? 0 : time(NULL) - purple_presence_get_idle_time(presence));
if (od->icq) {
- oscar_set_extendedstatus(gc);
+ oscar_set_extended_status(gc);
aim_icq_setsecurity(od,
purple_account_get_bool(account, "authorization", OSCAR_DEFAULT_AUTHORIZATION),
purple_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE));
@@ -3854,8 +3853,8 @@ oscar_set_info(PurpleConnection *gc, con
oscar_set_info_and_status(account, TRUE, rawinfo, FALSE, status);
}
-static void
-oscar_set_extendedstatus(PurpleConnection *gc)
+static guint32
+oscar_get_extended_status(PurpleConnection *gc)
{
OscarData *od;
PurpleAccount *account;
@@ -3899,10 +3898,16 @@ oscar_set_extendedstatus(PurpleConnectio
else if (!strcmp(status_id, OSCAR_STATUS_ID_CUSTOM))
data |= AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY;
- aim_srv_setextrainfo(od, TRUE, data, FALSE, NULL, NULL);
+ return data;
}
static void
+oscar_set_extended_status(PurpleConnection *gc)
+{
+ aim_srv_setextrainfo(purple_connection_get_protocol_data(gc), TRUE, oscar_get_extended_status(gc), FALSE, NULL);
+}
+
+static void
oscar_set_info_and_status(PurpleAccount *account, gboolean setinfo, const char *rawinfo,
gboolean setstatus, PurpleStatus *status)
{
@@ -3920,7 +3925,6 @@ oscar_set_info_and_status(PurpleAccount
gsize awaylen = 0;
char *status_text = NULL;
- const char *itmsurl = NULL;
status_type = purple_status_get_type(status);
primitive = purple_status_type_get_primitive(status_type);
@@ -4002,8 +4006,6 @@ oscar_set_info_and_status(PurpleAccount
const char *status_html;
status_html = purple_status_get_attr_string(status, "message");
- if (od->icq && (status_html == NULL || status_html[0] == '\0'))
- status_html = purple_status_type_get_name(status_type);
if (status_html != NULL)
{
status_text = purple_markup_strip_html(status_html);
@@ -4015,17 +4017,13 @@ oscar_set_info_and_status(PurpleAccount
}
}
- itmsurl = purple_status_get_attr_string(status, "itmsurl");
-
- /* TODO: Combine these two calls! */
- aim_srv_setextrainfo(od, FALSE, 0, TRUE, status_text, itmsurl);
- oscar_set_extendedstatus(gc);
+ aim_srv_setextrainfo(od, TRUE, oscar_get_extended_status(gc), TRUE, status_text);
g_free(status_text);
}
}
static void
-oscar_set_status_icq(PurpleAccount *account)
+oscar_set_icq_permdeny(PurpleAccount *account)
{
PurpleConnection *gc = purple_account_get_connection(account);
OscarData *od = purple_connection_get_protocol_data(gc);
@@ -4036,16 +4034,9 @@ oscar_set_status_icq(PurpleAccount *acco
* online. Mimicking the official client's behavior, we use PURPLE_PRIVACY_ALLOW_USERS
* when our status is "invisible" and PURPLE_PRIVACY_DENY_USERS otherwise.
* In the former case, we are visible only to buddies on our "permanently visible" list.
- * In the latter, we are invisible only to buddies on our "permanentnly invisible" list.
+ * In the latter, we are invisible only to buddies on our "permanently invisible" list.
*/
aim_ssi_setpermdeny(od, invisible ? PURPLE_PRIVACY_ALLOW_USERS : PURPLE_PRIVACY_DENY_USERS);
-
- /*
- * TODO: I guess we should probably wait and do this after we get
- * confirmation from the above SSI call? Right now other people
- * see our status blip to "invisible" before we appear offline.
- */
- oscar_set_extendedstatus(gc);
}
void
@@ -4071,12 +4062,11 @@ oscar_set_status(PurpleAccount *account,
return;
}
+ if (od->icq)
+ oscar_set_icq_permdeny(account);
+
/* Set the AIM-style away message for both AIM and ICQ accounts */
oscar_set_info_and_status(account, FALSE, NULL, TRUE, status);
-
- /* Set the ICQ status for ICQ accounts only */
- if (od->icq)
- oscar_set_status_icq(account);
}
#ifdef CRAZY_WARN
@@ -4244,8 +4234,6 @@ static int purple_ssi_parseerr(OscarData
return 1;
}
- oscar_set_status_icq(purple_connection_get_account(gc));
-
return 1;
}
@@ -4546,7 +4534,7 @@ static int purple_ssi_parselist(OscarDat
} /* End of switch on curitem->type */
} /* End of for loop */
- oscar_set_status_icq(account);
+ oscar_set_icq_permdeny(account);
/* Activate SSI */
/* Sending the enable causes other people to be able to see you, and you to see them */
@@ -5671,7 +5659,7 @@ oscar_icq_privacy_opts(PurpleConnection
purple_account_set_bool(account, "authorization", auth);
purple_account_set_bool(account, "web_aware", web_aware);
- oscar_set_extendedstatus(gc);
+ oscar_set_extended_status(gc);
aim_icq_setsecurity(od, auth, web_aware);
}
============================================================
--- libpurple/protocols/oscar/oscar.h c223825e709e23e905e6bce154c9edf3c0e0a798
+++ libpurple/protocols/oscar/oscar.h 08390f06121b89b6c1c1d1e98dabb0292aadf06e
@@ -723,7 +723,7 @@ aim_rxcallback_t aim_callhandler(OscarDa
/* 0x0014 */ void aim_srv_setprivacyflags(OscarData *od, FlapConnection *conn, guint32);
/* 0x0016 */ void aim_srv_nop(OscarData *od, FlapConnection *conn);
/* 0x0017 */ void aim_srv_setversions(OscarData *od, FlapConnection *conn);
-/* 0x001e */ int aim_srv_setextrainfo(OscarData *od, gboolean seticqstatus, guint32 icqstatus, gboolean setstatusmsg, const char *statusmsg, const char *itmsurl);
+/* 0x001e */ int aim_srv_setextrainfo(OscarData *od, gboolean seticqstatus, guint32 icqstatus, gboolean setstatusmsg, const char *statusmsg);
void aim_bos_reqrights(OscarData *od, FlapConnection *conn);
More information about the Commits
mailing list