diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-09-16 06:07:04 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-09-16 06:07:04 +0300 |
commit | 47318893c6ac81644b8c81bc6f58610cd624568d (patch) | |
tree | fd214d63a797392b3a7ba3aa80ef5cb9b795fcbc /utilities.cpp | |
parent | 73815a8f028cee1caf3e7ce597fbb409cc0c5396 (diff) |
added autoassigning existing key for contact with gpg sign in prescense, import from keyserver later
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; |