From 7b7229fd6fa8df0fbe52f82aa7b08354ddda76ba Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 2 Jun 2012 06:54:03 +0300 Subject: option to disable prescense subscription metacontacts fix --- utilities.cpp | 231 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 115 insertions(+), 116 deletions(-) (limited to 'utilities.cpp') diff --git a/utilities.cpp b/utilities.cpp index 26354ea..56f7ccb 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -716,7 +716,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU return FALSE; } } - if(nodename) + if(bPrescenseSubscription && nodename) { if(_tcsstr(nodename, _T("status"))) { @@ -1663,121 +1663,120 @@ int ImportGpGKeys(WPARAM w, LPARAM l) break; } if(found) - { - wstring cmd; - TCHAR tmp2[MAX_PATH] = {0}; - TCHAR *ptmp; - string output; - DWORD exitcode; - { - HANDLE hcnt = hContact; - ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); - _tcscpy(tmp2, ptmp); - mir_free(ptmp); - _tcscat(tmp2, _T("\\")); - _tcscat(tmp2, _T("temporary_exported.asc")); - DeleteFile(tmp2); - wfstream f(tmp2, std::ios::out); - f< output.find("<", s)) - s2 = output.find("<", s); - if(s2 != string::npos) - { - tmp2 = new char [output.substr(s,s2-s-1).length()+1]; - strcpy(tmp2, output.substr(s,s2-s-1).c_str()); - mir_utf8decode(tmp2, 0); - if(hContact) - { - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); - } - mir_free(tmp2); - if((s = output.find(")", s2)) == string::npos) - s = output.find(">", s2); - else if(s > output.find(">", s2)) - s = output.find(">", s2); - s2++; - if(output[s] == ')') - { - tmp2 = new char [output.substr(s2,s-s2).length()+1]; - strcpy(tmp2, output.substr(s2,s-s2).c_str()); - mir_utf8decode(tmp2, 0); - if(hContact) - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); - mir_free(tmp2); - s+=3; - s2 = output.find(">", s); - tmp2 = new char [output.substr(s,s2-s).length()+1]; - strcpy(tmp2, output.substr(s,s2-s).c_str()); - mir_utf8decode(tmp2, 0); - if(hContact) - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); - mir_free(tmp2); - } - else - { - tmp2 = new char [output.substr(s2,s-s2).length()+1]; - strcpy(tmp2, output.substr(s2,s-s2).c_str()); - mir_utf8decode(tmp2, 0); - if(hContact) - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); - mir_free(tmp2); - } - } - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1); - DBWriteContactSettingTString(hContact, szGPGModuleName, "GPGPubKey", toUTF16(key).c_str()); - } + { + wstring cmd; + TCHAR tmp2[MAX_PATH] = {0}; + TCHAR *ptmp; + string output; + DWORD exitcode; + { + HANDLE hcnt = hContact; + ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + _tcscpy(tmp2, ptmp); + mir_free(ptmp); + _tcscat(tmp2, _T("\\")); + _tcscat(tmp2, _T("temporary_exported.asc")); + DeleteFile(tmp2); + wfstream f(tmp2, std::ios::out); + f< output.find("<", s)) + s2 = output.find("<", s); + if(s2 != string::npos) + { + tmp2 = new char [output.substr(s,s2-s-1).length()+1]; + strcpy(tmp2, output.substr(s,s2-s-1).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + { + DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); + } + mir_free(tmp2); + if((s = output.find(")", s2)) == string::npos) + s = output.find(">", s2); + else if(s > output.find(">", s2)) + s = output.find(">", s2); + s2++; + if(output[s] == ')') + { + tmp2 = new char [output.substr(s2,s-s2).length()+1]; + strcpy(tmp2, output.substr(s2,s-s2).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + DBWriteContactSettingString(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); + mir_free(tmp2); + s+=3; + s2 = output.find(">", s); + tmp2 = new char [output.substr(s,s2-s).length()+1]; + strcpy(tmp2, output.substr(s,s2-s).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); + mir_free(tmp2); + } + else + { + tmp2 = new char [output.substr(s2,s-s2).length()+1]; + strcpy(tmp2, output.substr(s2,s-s2).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + mir_free(tmp2); + } + } + DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1); + DBWriteContactSettingTString(hContact, szGPGModuleName, "GPGPubKey", toUTF16(key).c_str()); + } DeleteFile(tmp2); break; } -- cgit v1.2.3