From e97d67ed64ca40a146cd3329e36b060c89f3bc60 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 11 Feb 2017 22:07:42 +0300 Subject: Discord: - support for group chat topics; - version bump --- protocols/Discord/src/groupchat.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'protocols/Discord/src/groupchat.cpp') diff --git a/protocols/Discord/src/groupchat.cpp b/protocols/Discord/src/groupchat.cpp index 13c2690bd2..5525f6658f 100644 --- a/protocols/Discord/src/groupchat.cpp +++ b/protocols/Discord/src/groupchat.cpp @@ -20,12 +20,14 @@ along with this program. If not, see . enum { IDM_CANCEL, - IDM_CHANGENICK, IDM_INVITE + IDM_CHANGENICK, IDM_CHANGETOPIC, IDM_INVITE }; static gc_item sttLogListItems[] = { { LPGENW("Change &nickname"), IDM_CHANGENICK, MENU_ITEM }, + { LPGENW("Change &topic"), IDM_CHANGETOPIC, MENU_ITEM }, + { L"", 100, MENU_SEPARATOR, FALSE }, { LPGENW("&Invite a user"), IDM_INVITE, MENU_ITEM }, }; @@ -82,12 +84,23 @@ void CDiscordProto::Chat_ProcessLogMenu(GCHOOK *gch) if (pUser == NULL) return; + ENTER_STRING es = { sizeof(es) }; + switch (gch->dwData) { - case IDM_INVITE: + case IDM_CHANGETOPIC: + es.caption = TranslateT("Enter new topic:"); + es.type = ESF_RICHEDIT; + es.szModuleName = m_szModuleName; + es.szDataPrefix = "chat_topic"; + if (EnterString(&es)) { + JSONNode root; root << WCHAR_PARAM("topic", es.ptszResult); + CMStringA szUrl(FORMAT, "/channels/%S", pUser->wszUsername); + Push(new AsyncHttpRequest(this, REQUEST_PATCH, szUrl, NULL, &root)); + mir_free(es.ptszResult); + } break; case IDM_CHANGENICK: - ENTER_STRING es = { sizeof(es) }; es.caption = TranslateT("Enter your new nick name:"); es.type = ESF_COMBO; es.szModuleName = m_szModuleName; -- cgit v1.2.3