summaryrefslogtreecommitdiff
path: root/utilities.cpp
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2012-10-11 03:19:22 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2012-10-11 03:19:22 +0300
commit1e64a4b3a4571c2e5b16d1129439bb2ef12919cd (patch)
tree6319ab14a934b82686ecb0e4daaded412a412121 /utilities.cpp
parent5e78e462baec888a1eecd0f74dd3adb62e6a6843 (diff)
fixed sendkey
Diffstat (limited to 'utilities.cpp')
-rwxr-xr-xutilities.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/utilities.cpp b/utilities.cpp
index ef808b4..d18b9b1 100755
--- a/utilities.cpp
+++ b/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])
{