diff options
author | George Hazan <george.hazan@gmail.com> | 2013-08-02 22:24:11 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-08-02 22:24:11 +0000 |
commit | fe09f8b1b3e119ee88332a79bdfb143b907c2805 (patch) | |
tree | ef4c19d6156da0fa58c6427d24b6c0cb10f77ad8 /protocols/JabberG/src/jabber_thread.cpp | |
parent | c55fd3e3c7312d6a76bc8037df78c07cc269935f (diff) |
static array of resources replaced with LIST<>
git-svn-id: http://svn.miranda-ng.org/main/trunk@5559 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_thread.cpp')
-rw-r--r-- | protocols/JabberG/src/jabber_thread.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index deb993b7a5..e7047594cc 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1528,7 +1528,7 @@ void CJabberProto::UpdateJidDbSettings(const TCHAR *jid) if ( !hContact) return;
int status = ID_STATUS_OFFLINE;
- if ( !item->resourceCount) {
+ if ( !item->arResources.getCount()) {
// set offline only if jid has resources
if (_tcschr(jid, '/') == NULL)
status = item->itemResource.status;
@@ -1541,25 +1541,27 @@ void CJabberProto::UpdateJidDbSettings(const TCHAR *jid) // Determine status to show for the contact based on the remaining resources
int nSelectedResource = -1, i = 0;
int nMaxPriority = -999; // -128...+127 valid range
- for (i = 0; i < item->resourceCount; i++) {
- if (item->pResources[i].priority > nMaxPriority) {
- nMaxPriority = item->pResources[i].priority;
- status = item->pResources[i].status;
+ for (i = 0; i < item->arResources.getCount(); i++) {
+ JABBER_RESOURCE_STATUS *r = item->arResources[i];
+ if (r->priority > nMaxPriority) {
+ nMaxPriority = r->priority;
+ status = r->status;
nSelectedResource = i;
}
- else if (item->pResources[i].priority == nMaxPriority) {
- if ((status = JabberCombineStatus(status, item->pResources[i].status)) == item->pResources[i].status)
+ else if (r->priority == nMaxPriority) {
+ if ((status = JabberCombineStatus(status, r->status)) == r->status)
nSelectedResource = i;
}
}
item->itemResource.status = status;
if (nSelectedResource != -1) {
- Log("JabberUpdateJidDbSettings: updating jid %S to rc %S", item->jid, item->pResources[nSelectedResource].resourceName);
- if (item->pResources[nSelectedResource].statusMessage)
- db_set_ts(hContact, "CList", "StatusMsg", item->pResources[nSelectedResource].statusMessage);
+ JABBER_RESOURCE_STATUS *r = item->arResources[nSelectedResource];
+ Log("JabberUpdateJidDbSettings: updating jid %S to rc %S", item->jid, r->resourceName);
+ if (r->statusMessage)
+ db_set_ts(hContact, "CList", "StatusMsg", r->statusMessage);
else
db_unset(hContact, "CList", "StatusMsg");
- UpdateMirVer(hContact, &item->pResources[nSelectedResource]);
+ UpdateMirVer(hContact, r);
}
else delSetting(hContact, DBSETTING_DISPLAY_UID);
@@ -1714,13 +1716,13 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) hContact = HContactFromJID(from);
if (hContact && db_get_b(hContact, "CList", "NotOnList", 0) == 1) {
// remove selfcontact, if where is no more another resources
- if (item->resourceCount == 1 && ResourceInfoFromJID(info->fullJID))
+ if (item->arResources.getCount() == 1 && ResourceInfoFromJID(info->fullJID))
ListRemoveResource(LIST_ROSTER, info->fullJID);
}
// set status only if no more available resources
- if ( !item->resourceCount) {
+ if ( !item->arResources.getCount()) {
item->itemResource.status = ID_STATUS_OFFLINE;
replaceStrT(item->itemResource.statusMessage, xmlGetText( xmlGetChild(node , "status")));
}
|