From 600b2da3d6e94cb4f0b78a82c66c6c324a8446ee Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Fri, 29 Oct 2010 04:39:53 +0300 Subject: modified: main.h modified: messages.cpp modified: options.cpp modified: utilities.cpp modified: utilities.h --- utilities.cpp | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) (limited to 'utilities.cpp') diff --git a/utilities.cpp b/utilities.cpp index 2dc210e..d281283 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -798,9 +798,9 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface *ji, HXML node, voi void AddHandlers() { - extern list Accounts; - list ::iterator p = Accounts.begin(); - for(unsigned int i = 0; i < Accounts.size(); i++, p++) + extern list Accounts; + list::iterator end = Accounts.end(); + for(list::iterator p = Accounts.begin(); p != end; p++) { if(!(*p)) break; @@ -812,7 +812,6 @@ void AddHandlers() { (*p)->setPrescenseHandler((*p)->getJabberInterface()->Net()->AddPresenceHandler((JABBER_HANDLER_FUNC)PrescenseHandler)); } - extern bool bAutoExchange; if(bAutoExchange) { (*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)")); @@ -845,6 +844,21 @@ bool isContactHaveKey(HANDLE hContact) return false; } +bool isGPGConfigured() +{ + TCHAR *id = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", _T("")); + char *key = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); + if(id[0] && key[0]) + { + mir_free(id); + mir_free(key); + return true; + } + mir_free(id); + mir_free(key); + return false; +} + #define NEWTSTR_MALLOC(A) (A==NULL)?NULL:strcpy((char*)mir_alloc(sizeof(char)*(strlen(A)+1)),A) const bool StriStr(const char *str, const char *substr) @@ -956,3 +970,26 @@ string get_random(int length) data += chars[gen()]; return data; } + +void send_encrypted_msgs_thread(HANDLE hContact) +{ + while(true) + { + char *key = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", ""); + if(!key[0]) + boost::this_thread::sleep(boost::posix_time::seconds(1)); + else if(!hcontact_data[hContact].msgs_to_send.empty()) + { + list::iterator end = hcontact_data[hContact].msgs_to_send.end(); + for(list::iterator p = hcontact_data[hContact].msgs_to_send.begin(); p != end; ++p) + { + CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)p->c_str()); + HistoryLog(hContact, (char*)p->c_str(), EVENTTYPE_MESSAGE, DBEF_SENT); + boost::this_thread::sleep(boost::posix_time::seconds(1)); + } + return; + } + else + return; + } +} \ No newline at end of file -- cgit v1.2.3