summaryrefslogtreecommitdiff
path: root/src/utilities.cpp
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2012-10-11 03:31:47 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2012-10-11 03:31:47 +0300
commit1566618e519c30245d30f8f56674488e2a257db2 (patch)
tree92909226c0d69a46192248448c4e5c8d56904ab7 /src/utilities.cpp
parenta0e20c23391844bca0ab2e05561104a90c63cc18 (diff)
modified: src/icons.cpp
modified: src/init.cpp modified: src/main.cpp modified: src/options.cpp modified: src/utilities.cpp
Diffstat (limited to 'src/utilities.cpp')
-rwxr-xr-xsrc/utilities.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/utilities.cpp b/src/utilities.cpp
index ef808b4..566bc87 100755
--- a/src/utilities.cpp
+++ b/src/utilities.cpp
@@ -196,7 +196,7 @@ INT_PTR SendKey(WPARAM w, LPARAM l)
char *szMessage;
{
LPSTR proto = (LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- PROTOACCOUNT *acc = (PROTOACCOUNT*)CallService(MS_PROTO_GETCONTACTBASEPROTO, 0, (LPARAM)proto);
+ PROTOACCOUNT *acc = (PROTOACCOUNT*)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)proto);
std::string acc_str;
if(acc)
{
@@ -206,7 +206,12 @@ INT_PTR SendKey(WPARAM w, LPARAM l)
acc_str += ")" ;
acc_str += "_GPGPubKey";
}
- szMessage = UniGetContactSettingUtf(hContact, szGPGModuleName, acc_str.empty()?"GPGPubKey":acc_str.c_str(), "");
+ szMessage = UniGetContactSettingUtf(NULL, szGPGModuleName, acc_str.empty()?"GPGPubKey":acc_str.c_str(), "");
+ if(!szMessage[0])
+ {
+ mir_free(szMessage);
+ szMessage = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); //try to get default key as fallback in any way
+ }
}
if(szMessage[0])
{
@@ -1353,7 +1358,7 @@ INT_PTR ExportGpGKeys(WPARAM w, LPARAM l)
int exported_keys = 0;
if(!file.is_open())
return 1; //TODO: handle error
- for(HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ for(HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
{
char *k = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", "");
if(!k[0])
@@ -1621,7 +1626,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
if(acc.length())
{
const char * uid = (const char*)CallProtoService(acc.c_str(), PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0);
- for(HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, (LPARAM)acc.c_str()); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, (LPARAM)acc.c_str()))
+ for(HANDLE hContact = db_find_first(acc.c_str()); hContact; hContact = db_find_next(hContact, acc.c_str()))
{
DBVARIANT dbv = {0};
DBCONTACTGETSETTING dbcgs = {0};