summaryrefslogtreecommitdiff
path: root/plugins/New_GPG/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-03-17 18:42:52 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-03-17 18:42:52 +0300
commit95d8d59b4e837afcb5eb8f0e7111139919d2e50c (patch)
treefd69c28e0fc3d0034be4a7a13bfdd453fe3afaa9 /plugins/New_GPG/src
parent415be2e734d96a84ecc908879dd6eb333d00d52e (diff)
NewGPG: fix for hardcoded utf8 constants
Diffstat (limited to 'plugins/New_GPG/src')
-rw-r--r--plugins/New_GPG/src/constants.h3
-rwxr-xr-xplugins/New_GPG/src/main.cpp16
-rwxr-xr-xplugins/New_GPG/src/messages.cpp2
3 files changed, 12 insertions, 9 deletions
diff --git a/plugins/New_GPG/src/constants.h b/plugins/New_GPG/src/constants.h
index 0eef3b79a2..edeef95068 100644
--- a/plugins/New_GPG/src/constants.h
+++ b/plugins/New_GPG/src/constants.h
@@ -2,4 +2,7 @@
#define CONSTANTS_H
#define MODULENAME "GPG"
#define PREF_METANODB 0x2000
+
+#define RUS_QUOTE "\xD0\xB2\xD0\x82\xD1\x9A"
+#define RUS_ANGLE "\xD0\xB2\xD0\x82\xD1\x9C"
#endif
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp
index 5f63adcc85..a1a6436d14 100755
--- a/plugins/New_GPG/src/main.cpp
+++ b/plugins/New_GPG/src/main.cpp
@@ -308,7 +308,7 @@ void ImportKey(MCONTACT hContact, std::wstring new_key)
string::size_type s = output.find("gpg: key ") + mir_strlen("gpg: key ");
string::size_type s2 = output.find(":", s);
g_plugin.setString(hcnt, "KeyID", output.substr(s, s2 - s).c_str());
- s = output.find("“", s2);
+ s = output.find(RUS_QUOTE, s2);
if (s == string::npos) {
s = output.find("\"", s2);
s += 1;
@@ -318,7 +318,7 @@ void ImportKey(MCONTACT hContact, std::wstring new_key)
bool uncommon = false;
if ((s2 = output.find("(", s)) == string::npos) {
if ((s2 = output.find("<", s)) == string::npos) {
- s2 = output.find("”", s);
+ s2 = output.find(RUS_ANGLE, s);
uncommon = true;
}
}
@@ -371,7 +371,7 @@ void ImportKey(MCONTACT hContact, std::wstring new_key)
string::size_type s = output.find("gpg: key ") + mir_strlen("gpg: key ");
string::size_type s2 = output.find(":", s);
g_plugin.setString(metaGetMostOnline(hContact), "KeyID", output.substr(s, s2 - s).c_str());
- s = output.find("“", s2);
+ s = output.find(RUS_QUOTE, s2);
if (s == string::npos) {
s = output.find("\"", s2);
s += 1;
@@ -381,7 +381,7 @@ void ImportKey(MCONTACT hContact, std::wstring new_key)
bool uncommon = false;
if ((s2 = output.find("(", s)) == string::npos) {
if ((s2 = output.find("<", s)) == string::npos) {
- s2 = output.find("”", s);
+ s2 = output.find(RUS_ANGLE, s);
uncommon = true;
}
}
@@ -432,17 +432,17 @@ void ImportKey(MCONTACT hContact, std::wstring new_key)
string::size_type s = output.find("gpg: key ") + mir_strlen("gpg: key ");
string::size_type s2 = output.find(":", s);
g_plugin.setString(hContact, "KeyID", output.substr(s, s2 - s).c_str());
- s = output.find("“", s2);
+ s = output.find(RUS_QUOTE, s2);
if (s == string::npos) {
s = output.find("\"", s2);
s += 1;
}
- else
- s += 3;
+ else s += 3;
+
bool uncommon = false;
if ((s2 = output.find("(", s)) == string::npos) {
if ((s2 = output.find("<", s)) == string::npos) {
- s2 = output.find("”", s);
+ s2 = output.find(RUS_ANGLE, s);
uncommon = true;
}
}
diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp
index 797afd030f..14ba256481 100755
--- a/plugins/New_GPG/src/messages.cpp
+++ b/plugins/New_GPG/src/messages.cpp
@@ -435,7 +435,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l)
s2 = output.find(":", s1);
g_plugin.setString(ccs->hContact, "KeyID", output.substr(s1, s2 - s1).c_str());
s2 += 2;
- s1 = output.find("“", s2);
+ s1 = output.find(RUS_QUOTE, s2);
if (s1 == string::npos) {
s1 = output.find("\"", s2);
s1 += 1;