diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-10-27 18:31:17 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-10-27 18:31:17 +0300 |
commit | 69c525336f25083947d9f246de16fb83f73ce9d8 (patch) | |
tree | 8d051cbb06adce004173d1b3a69377b483c1c401 | |
parent | 1f4c1f489f05bb135c8df93d40db9bb624be969d (diff) |
working on autoexchange, reworking prescense, other fings, trying to avoid db usage, using memory for temporary data instead
-rw-r--r-- | init.cpp | 2 | ||||
-rw-r--r-- | main.cpp | 4 | ||||
-rw-r--r-- | main.h | 8 | ||||
-rw-r--r-- | options.cpp | 2 | ||||
-rw-r--r-- | utilities.cpp | 10 |
5 files changed, 20 insertions, 6 deletions
@@ -32,6 +32,7 @@ MM_INTERFACE mmi = {0}; UTF8_INTERFACE utfi = {0}; XML_API xi = {0}; logtofile debuglog; +std::map<HANDLE, contact_data> hcontact_data; #define MIID_GPG { 0x4227c050, 0x8d97, 0x48d2, { 0x91, 0xec, 0x6a, 0x95, 0x2b, 0x3d, 0xab, 0x94 } } @@ -87,6 +88,7 @@ void init_vars() outopentag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutOpenTag", _T("<GPGenc>")); outclosetag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutCloseTag", _T("</GPGenc>")); bDebugLog = DBGetContactSettingByte(NULL, szGPGModuleName, "bDebugLog", 0); + bAutoExchange = DBGetContactSettingByte(NULL, szGPGModuleName, "bAutoExchange", 0); debuglog.init(); bJabberAPI = DBGetContactSettingByte(NULL, szGPGModuleName, "bJabberAPI", bIsMiranda09?1:0); bFileTransfers = DBGetContactSettingByte(NULL, szGPGModuleName, "bFileTransfers", 1); @@ -1529,14 +1529,14 @@ void InitCheck() ShowFirstRunDialog(); } extern bool bAutoExchange; - if(bAutoExchange && (ServiceExists(PS_ICQ_ADDCAPABILITY))) + if(bAutoExchange && (ServiceExists("ICQ"PS_ICQ_ADDCAPABILITY))) //work only for one icq instance { ICQ_CUSTOMCAP cap; cap.cbSize = sizeof(ICQ_CUSTOMCAP); cap.hIcon = 0; strcpy(cap.name, "GPG Key AutoExchange"); strcpy(cap.caps, "GPG AutoExchange"); - CallService(PS_ICQ_ADDCAPABILITY, 0, (LPARAM)&cap); + CallService("ICQ"PS_ICQ_ADDCAPABILITY, 0, (LPARAM)&cap); } } @@ -16,6 +16,14 @@ #ifndef MAIN_H #define MAIN_H +struct contact_data +{ + vector<string> msgs_to_tag; + string key_in_prescense; +}; + +extern std::map<HANDLE, contact_data> hcontact_data; + #endif diff --git a/options.cpp b/options.cpp index 948e5ac..d2a106b 100644 --- a/options.cpp +++ b/options.cpp @@ -235,7 +235,7 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA } } if(!keep) - if(MessageBox(0, _T("This key not used by any contact, do you want to remove it from publick keyring ?"), _T("Key info"), MB_YESNO) == IDYES) + if(MessageBox(0, _T("This key not used by any contact, do you want to remove it from public keyring ?"), _T("Key info"), MB_YESNO) == IDYES) { wstring cmd; string output; diff --git a/utilities.cpp b/utilities.cpp index 4a9fadc..2dc210e 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -778,7 +778,8 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface *ji, HXML node, voi 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()); +// DBWriteContactSettingString(hContact, szGPGModuleName, "KeyID_Prescense", out.substr(p1, p2-p1-1).c_str()); + hcontact_data[hContact].key_in_prescense = out.substr(p1, p2-p1-1).c_str(); } } } @@ -813,7 +814,10 @@ void AddHandlers() } extern bool bAutoExchange; if(bAutoExchange) - (*p)->getJabberInterface()->Net()->RegisterFeature(_T("GPG Key Auto Exchange"), _T("Indicates that gpg installed and configured to public key auto exchange (currently implemented in new_gpg Miranda IM plugin)")); + { + (*p)->getJabberInterface()->Net()->RegisterFeature(_T("GPG_Key_Auto_Exchange:0"), _T("Indicates that gpg installed and configured to public key auto exchange (currently implemented in new_gpg Miranda IM plugin)")); + (*p)->getJabberInterface()->Net()->AddFeatures(_T("GPG_Key_Auto_Exchange:0\0\0")); + } } } @@ -951,4 +955,4 @@ string get_random(int length) for(int i = 0; i < length; ++i)
data += chars[gen()];
return data;
-}
\ No newline at end of file +}
|