diff options
author | George Hazan <ghazan@miranda.im> | 2021-11-28 17:34:41 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-11-28 17:34:51 +0300 |
commit | 1a5dc583b048727752b8f72df676ec408908041f (patch) | |
tree | 5204a5dbcbe84ed7cff02bff9e6ee32ff8598c3f /src/core/stdmsg | |
parent | 4f961df4a3bb6577a0024e341adb9fed6d965edf (diff) |
user typing notification for Discord group chats
Diffstat (limited to 'src/core/stdmsg')
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 37 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.h | 4 |
2 files changed, 22 insertions, 19 deletions
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index a115908a84..12746815e4 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -442,11 +442,11 @@ void CMsgDialog::OnType(CTimer*) }
else {
if (m_nTypeSecs) {
- wchar_t szBuf[256];
- wchar_t *szContactName = Clist_GetContactDisplayName(m_hContact);
HICON hTyping = Skin_LoadIcon(SKINICON_OTHER_TYPING);
- mir_snwprintf(szBuf, TranslateT("%s is typing a message..."), szContactName);
+ wchar_t szBuf[256];
+ mir_snwprintf(szBuf, TranslateT("%s is typing a message..."),
+ (m_pUserTyping) ? m_pUserTyping->pszNick : Clist_GetContactDisplayName(m_hContact));
m_nTypeSecs--;
SendMessage(m_pOwner->m_hwndStatus, SB_SETTEXT, 0, (LPARAM)szBuf);
@@ -1427,28 +1427,33 @@ void CMsgDialog::NotifyTyping(int mode) if (!m_szProto)
return;
- int protoStatus = Proto_GetStatus(m_szProto);
- DWORD protoCaps = CallProtoService(m_szProto, PS_GETCAPS, PFLAGNUM_1, 0);
DWORD typeCaps = CallProtoService(m_szProto, PS_GETCAPS, PFLAGNUM_4, 0);
-
if (!(typeCaps & PF4_SUPPORTTYPING))
return;
+ int protoStatus = Proto_GetStatus(m_szProto);
if (protoStatus < ID_STATUS_ONLINE)
return;
- if (protoCaps & PF1_VISLIST && db_get_w(m_hContact, m_szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE)
- return;
+ if (isChat()) {
+ m_nTypeMode = mode;
+ Chat_DoEventHook(m_si, GC_USER_TYPNOTIFY, 0, 0, m_nTypeMode);
+ }
+ else {
+ DWORD protoCaps = CallProtoService(m_szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ if (protoCaps & PF1_VISLIST && db_get_w(m_hContact, m_szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE)
+ return;
- if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && db_get_w(m_hContact, m_szProto, "ApparentMode", 0) != ID_STATUS_ONLINE)
- return;
+ if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && db_get_w(m_hContact, m_szProto, "ApparentMode", 0) != ID_STATUS_ONLINE)
+ return;
- if (!g_dat.bTypingUnknown && !Contact_OnList(m_hContact))
- return;
+ if (!g_dat.bTypingUnknown && !Contact_OnList(m_hContact))
+ return;
- // End user check
- m_nTypeMode = mode;
- CallService(MS_PROTO_SELFISTYPING, m_hContact, m_nTypeMode);
+ // End user check
+ m_nTypeMode = mode;
+ CallService(MS_PROTO_SELFISTYPING, m_hContact, m_nTypeMode);
+ }
}
void CMsgDialog::RemakeLog()
@@ -1679,5 +1684,5 @@ void CMsgDialog::UpdateTitle() void CMsgDialog::UserTyping(int nSecs)
{
- m_nTypeSecs = (nSecs > 0) ? nSecs : 0;
+ setTyping((nSecs > 0) ? nSecs : 0);
}
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index a2c4f226cc..b5ddbf823d 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -94,14 +94,12 @@ class CMsgDialog : public CSrmmBaseDialog HFONT m_hFont = nullptr;
- int m_nTypeSecs = 0, m_nTypeMode = 0;
int m_limitAvatarH = 0;
- DWORD m_nLastTyping = 0;
DWORD m_lastMessage = 0;
HANDLE m_hTimeZone = 0;
WORD m_wStatus = ID_STATUS_OFFLINE, m_wOldStatus = ID_STATUS_OFFLINE;
WORD m_wMinute = 0;
- bool m_bIsMeta = false, m_bShowTyping = false, m_bWindowCascaded = false, m_bNoActivate = false;
+ bool m_bIsMeta = false, m_bWindowCascaded = false, m_bNoActivate = false;
public:
CMsgDialog(CTabbedWindow *pOwner, MCONTACT hContact);
|