diff options
author | George Hazan <george.hazan@gmail.com> | 2013-07-20 20:30:07 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-07-20 20:30:07 +0000 |
commit | 5756772ef9e9fd5b4a730d8a16737996cbec55f5 (patch) | |
tree | b154b3f9e56ceb86b3385d0f59d7341f5ac9b71e /protocols/JabberG/src/jabber_thread.cpp | |
parent | 2a60812b64635ecd655131217f9cb0fa077575dc (diff) |
less cycles, simplier code
git-svn-id: http://svn.miranda-ng.org/main/trunk@5434 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_thread.cpp')
-rw-r--r-- | protocols/JabberG/src/jabber_thread.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index f030609074..01d13405db 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1098,12 +1098,9 @@ HANDLE CJabberProto::CreateTemporaryContact(const TCHAR *szJid, JABBER_LIST_ITEM p = szJid;
hContact = DBCreateContact(szJid, p, TRUE, FALSE);
- for (int i=0; i < chatItem->resourceCount; i++) {
- if ( !lstrcmp(chatItem->pResources[i].resourceName, p)) {
- setWord(hContact, "Status", chatItem->pResources[i].status);
- break;
- }
- }
+ JABBER_RESOURCE_STATUS *r = chatItem->findResource(p);
+ if (r)
+ setWord(hContact, "Status", r->status);
}
else {
TCHAR *nick = JabberNickFromJID(szJid);
@@ -1544,8 +1541,7 @@ 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++)
- {
+ for (i = 0; i < item->resourceCount; i++) {
if (item->pResources[i].priority > nMaxPriority) {
nMaxPriority = item->pResources[i].priority;
status = item->pResources[i].status;
|