summaryrefslogtreecommitdiff
path: root/plugins/AVS
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2018-03-11 16:53:17 +0300
committerKirill Volinsky <mataes2007@gmail.com>2018-03-11 16:53:17 +0300
commit51dc3cf5e392c4ffc5da165e8559f8cc330bc0b7 (patch)
treedc061f32664e291d075b2ff8206577f69a99fdb1 /plugins/AVS
parent6768e966c8ac857b3e7043d5ffcbba77f5e35991 (diff)
AVS: more correct version of getting proto name
Diffstat (limited to 'plugins/AVS')
-rw-r--r--plugins/AVS/src/options.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp
index ffabf9441f..22468bc948 100644
--- a/plugins/AVS/src/options.cpp
+++ b/plugins/AVS/src/options.cpp
@@ -64,9 +64,10 @@ static void RemoveProtoPic(const char *szProto)
}
if (strstr(szProto, "Global avatar for")) {
- char szProtoname[MAX_PATH] = { 0 };
- mir_strncpy(szProtoname, szProto, mir_strlen(szProto) - mir_strlen("accounts"));
- mir_strcpy(szProtoname, strrchr(szProtoname, ' ') + 1);
+ CMStringA szProtoname;
+ szProtoname = szProto;
+ szProtoname.Delete(0, mir_strlen("Global avatar for "));
+ szProtoname.Delete(mir_strlen(szProtoname) - mir_strlen(" accounts"), mir_strlen(" accounts"));
for (auto &p : g_ProtoPictures) {
if (p->szProtoname == nullptr)
continue;
@@ -129,9 +130,10 @@ static void SetProtoPic(char *szProto)
}
}
else if (strstr(szProto, "Global avatar for")) {
- char szProtoname[MAX_PATH] = { 0 };
- mir_strncpy(szProtoname, szProto, mir_strlen(szProto) - mir_strlen("accounts"));
- mir_strcpy(szProtoname, strrchr(szProtoname, ' ') + 1);
+ CMStringA szProtoname;
+ szProtoname = szProto;
+ szProtoname.Delete(0, mir_strlen("Global avatar for "));
+ szProtoname.Delete(mir_strlen(szProtoname) - mir_strlen(" accounts"), mir_strlen(" accounts"));
for (auto &p : g_ProtoPictures) {
PROTOACCOUNT* pdescr = Proto_GetAccount(p->szProtoname);
if (pdescr == nullptr && mir_strcmp(p->szProtoname, szProto))