soc.2009.transport: 72d6ce4d: fixed purpleBuddyChanged
hanzz at soc.pidgin.im
hanzz at soc.pidgin.im
Tue May 19 05:20:33 EDT 2009
-----------------------------------------------------------------
Revision: 72d6ce4d1301c1db42fee04dfe214ca1e5b6f6ff
Ancestor: b4ebb11afbb4c318af78b169b492e05458a9618d
Author: hanzz at soc.pidgin.im
Date: 2009-05-19T09:17:05
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/72d6ce4d1301c1db42fee04dfe214ca1e5b6f6ff
Modified files:
sql.cpp sql.h user.cpp
ChangeLog:
fixed purpleBuddyChanged
-------------- next part --------------
============================================================
--- sql.cpp 2e05680c86c7e511a518046efdda1b8dff84abde
+++ sql.cpp 6cb5d2ceef37751c0e94d8762b13674847b29aee
@@ -153,6 +153,8 @@ std::map<std::string,RosterRow> SQLClass
user.jid=(std::string)row["jid"];
user.uin=(std::string)row["uin"];
user.subscription=(std::string)row["subscription"];
+ user.nickname=(std::string)row["nickname"];
+ user.group=(std::string)row["group"];
if (user.subscription.empty())
user.subscription="ask";
user.online=false;
@@ -176,6 +178,8 @@ std::map<std::string,RosterRow> SQLClass
user.jid=(std::string)row["jid"];
user.uin=(std::string)row["uin"];
user.subscription=(std::string)row["subscription"];
+ user.nickname=(std::string)row["nickname"];
+ user.group=(std::string)row["group"];
user.online=false;
user.lastPresence="";
rows[(std::string)row["uin"]]=user;
============================================================
--- sql.h 51d3a7633c680a16eb216310ab45870ead47897d
+++ sql.h dc96d4e220d067ecea126925c7c15605d37a169d
@@ -42,6 +42,8 @@ struct RosterRow {
std::string uin;
std::string subscription;
bool online;
+ std::string nickname;
+ std::string group;
std::string lastPresence;
};
============================================================
--- user.cpp 6f47369aa163dd691bbd460701382e7d3b9a6666
+++ user.cpp 525f3a8173bf7c437f31078773c6e19961561b44
@@ -155,11 +155,11 @@ void User::sendRosterX()
// adding these users to roster db with subscription=ask
std::map<std::string,PurpleBuddy*>::iterator it = m_subscribeCache.begin();
while(it != m_subscribeCache.end()) {
-// if (!(*it).second.uin.empty()){
+ PurpleBuddy *buddy = (*it).second;
+ std::string name(purple_buddy_get_name(buddy));
+ if (!name.empty()){
RosterRow user;
- PurpleBuddy *buddy = (*it).second;
std::string alias(purple_buddy_get_alias(buddy));
- std::string name(purple_buddy_get_name(buddy));
user.id = -1;
user.jid = m_jid;
user.uin = name;
@@ -175,7 +175,7 @@ void User::sendRosterX()
item->addAttribute("name",alias);
item->addChild(new Tag("group",(std::string) purple_group_get_name(purple_buddy_get_group(buddy))));
x->addChild(item);
-// }
+ }
it++;
}
tag->addChild(x);
@@ -283,8 +283,14 @@ Tag *User::generatePresenceStanza(Purple
// Check if it's patched libpurple which saved icons to directories
char *hash = rindex(avatarHash,'/');
std::string h;
- if (hash)
+ if (hash) {
+ char *dot
+ hash++;
+ dot = strchr(hash, '.');
+ if (dot)
+ *dot = '\0';
x->addChild(new Tag("photo",(std::string) hash));
+ }
else
x->addChild(new Tag("photo",(std::string) avatarHash));
}
@@ -367,11 +373,11 @@ void User::purpleBuddyChanged(PurpleBudd
m_syncTimer = purple_timeout_add_seconds(4, sync_cb, this);
}
- bool inRoster = purple_blist_node_get_bool(&buddy->node, "inRoster");
- if (!inRoster) {
- inRoster = isInRoster(name,"");
- purple_blist_node_set_bool(&buddy->node, "inRoster", true);
- }
+// bool inRoster = purple_blist_node_get_bool(&buddy->node, "inRoster");
+// if (!inRoster) {
+ bool inRoster = isInRoster(name,"");
+// purple_blist_node_set_bool(&buddy->node, "inRoster", true);
+// }
if (!inRoster) {
if (!m_rosterXCalled && hasFeature(GLOOX_FEATURE_ROSTERX)){
More information about the Commits
mailing list