soc.2009.transport: 61c6a707: Fixed bug when buddy is added to DB more...
hanzz at soc.pidgin.im
hanzz at soc.pidgin.im
Sun Apr 26 14:00:55 EDT 2009
-----------------------------------------------------------------
Revision: 61c6a707c325ccc06d4be206628d22e7df12c6af
Ancestor: 5c5c18c8254b1de094b23f885ca04974873eb397
Author: hanzz at soc.pidgin.im
Date: 2009-04-26T17:59:09
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/61c6a707c325ccc06d4be206628d22e7df12c6af
Modified files:
user.cpp user.h
ChangeLog:
Fixed bug when buddy is added to DB more than once.
-------------- next part --------------
============================================================
--- user.cpp e0812fc7411cd6567377e6de8b4bef13b80631e5
+++ user.cpp 88e09dd6447984cdfee116b004b934dad843d1ff
@@ -152,24 +152,24 @@ void User::sendRosterX()
Tag *item;
// adding these users to roster db with subscription=ask
- std::vector<subscribeContact>::iterator it = m_subscribeCache.begin();
+ std::map<std::string,subscribeContact>::iterator it = m_subscribeCache.begin();
while(it != m_subscribeCache.end()) {
- if (!(*it).uin.empty()){
+ if (!(*it).second.uin.empty()){
RosterRow user;
- user.id=-1;
- user.jid=m_jid;
- user.uin=(*it).uin;
- user.subscription="ask";
- user.online=false;
- user.lastPresence="";
- m_roster[(*it).uin]=user;
- p->sql()->addUserToRoster(m_jid,(*it).uin,"ask");
+ user.id = -1;
+ user.jid = m_jid;
+ user.uin = (*it).second.uin;
+ user.subscription = "ask";
+ user.online = false;
+ user.lastPresence = "";
+ m_roster[(*it).second.uin] = user;
+ p->sql()->addUserToRoster(m_jid,(*it).second.uin,"ask");
item = new Tag("item");
item->addAttribute("action","add");
- item->addAttribute("jid",(*it).uin+"@"+p->jid());
- item->addAttribute("name",(*it).alias);
- item->addChild(new Tag("group",(*it).group));
+ item->addAttribute("jid",(*it).second.uin+"@"+p->jid());
+ item->addAttribute("name",(*it).second.alias);
+ item->addChild(new Tag("group",(*it).second.group));
x->addChild(item);
}
it++;
@@ -365,10 +365,10 @@ void User::purpleBuddyChanged(PurpleBudd
if (!inRoster) {
if (!m_rosterXCalled && hasFeature(GLOOX_FEATURE_ROSTERX)){
subscribeContact c;
- c.uin=name;
- c.alias=alias;
- c.group=(std::string) purple_group_get_name(purple_buddy_get_group(buddy));
- m_subscribeCache.push_back(c);
+ c.uin = name;
+ c.alias = alias;
+ c.group = (std::string) purple_group_get_name(purple_buddy_get_group(buddy));
+ m_subscribeCache[name] = c;
Log().Get(m_jid) << "Not in roster => adding to rosterX cache";
}
else {
@@ -378,10 +378,10 @@ void User::purpleBuddyChanged(PurpleBudd
m_syncTimer = purple_timeout_add_seconds(4, sync_cb, this);
}
subscribeContact c;
- c.uin=name;
- c.alias=alias;
- c.group=(std::string) purple_group_get_name(purple_buddy_get_group(buddy));
- m_subscribeCache.push_back(c);
+ c.uin = name;
+ c.alias = alias;
+ c.group = (std::string) purple_group_get_name(purple_buddy_get_group(buddy));
+ m_subscribeCache[name] = c;
}
else {
Log().Get(m_jid) << "Not in roster => sending subscribe";
============================================================
--- user.h a641c455417dbe359743d2fc3e051c67442d1203
+++ user.h 55551fef6e6dcc3792d093c0b9e62426b54c49a7
@@ -141,7 +141,7 @@ class User {
std::map<std::string,int> m_resources; // list of all resources which are connected to the transport
std::map<std::string,authRequest> m_authRequests; // list of authorization requests (holds callbacks and user data)
std::map<std::string,PurpleConversation *> m_conversations; // list of opened conversations
- std::vector<subscribeContact> m_subscribeCache; // cache for contacts for roster X
+ std::map<std::string,subscribeContact> m_subscribeCache; // cache for contacts for roster X
};
#endif
More information about the Commits
mailing list