diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-10-29 04:39:53 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-10-29 04:39:53 +0300 |
commit | 600b2da3d6e94cb4f0b78a82c66c6c324a8446ee (patch) | |
tree | 362aadfefc8259e379eb9a55ef7c4af5054462e6 /utilities.cpp | |
parent | c8e55d6a751f587930ab2589f55584973b446bb0 (diff) |
modified: main.h
modified: messages.cpp
modified: options.cpp
modified: utilities.cpp
modified: utilities.h
Diffstat (limited to 'utilities.cpp')
-rw-r--r-- | utilities.cpp | 45 |
1 files changed, 41 insertions, 4 deletions
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 <JabberAccount*> Accounts; - list <JabberAccount*>::iterator p = Accounts.begin(); - for(unsigned int i = 0; i < Accounts.size(); i++, p++) + extern list<JabberAccount*> Accounts; + list<JabberAccount*>::iterator end = Accounts.end(); + for(list<JabberAccount*>::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<string>::iterator end = hcontact_data[hContact].msgs_to_send.end();
+ for(list<string>::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 |