summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-10-31 20:19:16 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-10-31 20:19:16 +0300
commit61cb1c1445b8ebfef08c864f0062baa68390dd1a (patch)
treebbf322e7c5de321b4b8f5fb3399747ce70eda682
parent6699ce4d4d565c7812bf48490ab336987d146ea0 (diff)
fixes #3234 (WhatsApp: реализовать возможность переименовать сессию)
-rw-r--r--protocols/WhatsApp/res/whatsapp.rc4
-rw-r--r--protocols/WhatsApp/src/generate.cpp3
-rw-r--r--protocols/WhatsApp/src/iq.cpp3
-rw-r--r--protocols/WhatsApp/src/options.cpp4
-rw-r--r--protocols/WhatsApp/src/proto.cpp1
-rw-r--r--protocols/WhatsApp/src/resource.h4
6 files changed, 12 insertions, 7 deletions
diff --git a/protocols/WhatsApp/res/whatsapp.rc b/protocols/WhatsApp/res/whatsapp.rc
index c11b674959..eb7f75d60f 100644
--- a/protocols/WhatsApp/res/whatsapp.rc
+++ b/protocols/WhatsApp/res/whatsapp.rc
@@ -56,8 +56,10 @@ BEGIN
EDITTEXT IDC_NICK,87,5,211,12,ES_AUTOHSCROLL
LTEXT "Default group:",IDC_STATIC,5,24,79,10
EDITTEXT IDC_DEFGROUP,87,23,211,12,ES_AUTOHSCROLL
+ LTEXT "Device name:",IDC_STATIC,5,43,79,10
+ EDITTEXT IDC_DEVICE_NAME,87,41,211,12,ES_AUTOHSCROLL
CONTROL "Do not open chat windows on creation",IDC_HIDECHATS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,43,294,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,64,294,10
END
IDD_GROUPCHAT_INVITE DIALOGEX 0, 0, 215, 170
diff --git a/protocols/WhatsApp/src/generate.cpp b/protocols/WhatsApp/src/generate.cpp
index 1be7d0f7e2..6985e8b17a 100644
--- a/protocols/WhatsApp/src/generate.cpp
+++ b/protocols/WhatsApp/src/generate.cpp
@@ -35,7 +35,6 @@ protobuf_c_text_to_string_internal(CMStringA &str,
const ProtobufCMessage *m,
const ProtobufCMessageDescriptor *d)
{
- int i;
size_t j, quantifier_offset;
double float_var;
const ProtobufCFieldDescriptor *f;
@@ -43,7 +42,7 @@ protobuf_c_text_to_string_internal(CMStringA &str,
const ProtobufCEnumValue *enumv;
f = d->fields;
- for (i = 0; i < d->n_fields; i++) {
+ for (unsigned i = 0; i < d->n_fields; i++) {
/* Decide if something needs to be done for this field. */
switch (f[i].label) {
case PROTOBUF_C_LABEL_OPTIONAL:
diff --git a/protocols/WhatsApp/src/iq.cpp b/protocols/WhatsApp/src/iq.cpp
index 2a038cb61a..dc20e034e3 100644
--- a/protocols/WhatsApp/src/iq.cpp
+++ b/protocols/WhatsApp/src/iq.cpp
@@ -317,6 +317,7 @@ LBL_Error:
Wa__ClientPayload__DevicePairingRegistrationData pairingData;
Wa__DeviceProps companion;
Wa__DeviceProps__AppVersion appVersion;
+ T2Utf devName(m_wszDeviceName);
MFileVersion v;
Miranda_GetFileVersion(&v);
@@ -331,7 +332,7 @@ LBL_Error:
appVersion.tertiary = v[2]; appVersion.has_tertiary = true;
appVersion.quaternary = v[3]; appVersion.has_quaternary = true;
- companion.os = "Miranda NG";
+ companion.os = devName.get();
companion.version = &appVersion;
companion.platformtype = WA__DEVICE_PROPS__PLATFORM_TYPE__DESKTOP; companion.has_platformtype = true;
companion.requirefullsync = false; companion.has_requirefullsync = true;
diff --git a/protocols/WhatsApp/src/options.cpp b/protocols/WhatsApp/src/options.cpp
index 0b9aaef264..40b1bd4b74 100644
--- a/protocols/WhatsApp/src/options.cpp
+++ b/protocols/WhatsApp/src/options.cpp
@@ -12,7 +12,7 @@ Copyright 2019-22 George Hazan
class COptionsDlg : public CProtoDlgBase<WhatsAppProto>
{
CCtrlCheck chkHideChats;
- CCtrlEdit edtGroup, edtNick;
+ CCtrlEdit edtGroup, edtNick, edtDevName;
ptrW m_wszOldGroup;
public:
@@ -21,10 +21,12 @@ public:
chkHideChats(this, IDC_HIDECHATS),
edtNick(this, IDC_NICK),
edtGroup(this, IDC_DEFGROUP),
+ edtDevName(this, IDC_DEVICE_NAME),
m_wszOldGroup(mir_wstrdup(ppro->m_wszDefaultGroup))
{
CreateLink(edtNick, ppro->m_wszNick);
CreateLink(edtGroup, ppro->m_wszDefaultGroup);
+ CreateLink(edtDevName, ppro->m_wszDeviceName);
if (bFullDlg)
CreateLink(chkHideChats, ppro->m_bHideGroupchats);
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp
index 5b1a575fff..e28d53a8a2 100644
--- a/protocols/WhatsApp/src/proto.cpp
+++ b/protocols/WhatsApp/src/proto.cpp
@@ -46,6 +46,7 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const wchar_t *username) :
m_arCollections(10, CompareCollections),
m_wszNick(this, "Nick"),
+ m_wszDeviceName(this, "DeviceName", L"Miranda NG"),
m_wszDefaultGroup(this, "DefaultGroup", L"WhatsApp"),
m_bUsePopups(this, "UsePopups", true),
m_bHideGroupchats(this, "HideChats", true)
diff --git a/protocols/WhatsApp/src/resource.h b/protocols/WhatsApp/src/resource.h
index 79cce313c0..8b20f44e5c 100644
--- a/protocols/WhatsApp/src/resource.h
+++ b/protocols/WhatsApp/src/resource.h
@@ -9,10 +9,10 @@
#define IDC_HIDECHATS 1000
#define IDC_DEFGROUP 1001
#define IDC_QRPIC 1002
-#define IDC_DEFGROUP2 1002
#define IDC_CLIST 1003
#define IDC_NEWJID 1004
#define IDC_NICK 1005
+#define IDC_DEVICE_NAME 1006
// Next default values for new objects
//
@@ -20,7 +20,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 104
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1006
+#define _APS_NEXT_CONTROL_VALUE 1007
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif