From 47318893c6ac81644b8c81bc6f58610cd624568d Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Thu, 16 Sep 2010 06:07:04 +0300 Subject: added autoassigning existing key for contact with gpg sign in prescense, import from keyserver later --- utilities.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'utilities.cpp') 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 Accounts; + list ::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; -- cgit v1.2.3