diff options
Diffstat (limited to 'utilities.cpp')
-rw-r--r-- | utilities.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/utilities.cpp b/utilities.cpp index 9cba16a..dbff3b0 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -614,8 +614,24 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface *ji, HXML node, voi if(out.find("key ID ") != string::npos) { //need to get hcontact here, i can get jid from hxml, and get handle from jid, maybe exists better way ? - string::size_type p = out.find("key ID ") + strlen("key ID "); - string::size_type p2 = out.find("\n", p); + string::size_type p1 = out.find("key ID ") + strlen("key ID "); + string::size_type p2 = out.find("\n", p1); + if(p1 != string::npos && p2 != string::npos) + { + HANDLE hContact = NULL; + { + extern list <JabberAccount*> Accounts; + list <JabberAccount*>::iterator p = Accounts.begin(); + for(unsigned int i = 0; i < Accounts.size(); i++, p++) + { + if(!(*p)) + break; + hContact = (*p)->getJabberInterface()->Sys()->ContactFromJID(xi.getAttrValue(node, _T("from"))); + if(hContact) + DBWriteContactSettingString(hContact, szGPGModuleName, "KeyID_Prescense", out.substr(p1, p2-p1-1).c_str()); + } + } + } } } return FALSE; |