MCPcopy Create free account
hub / github.com/DiscordMessenger/dm / TryToSendMessage

Method TryToSendMessage

src/windows/MessageEditor.cpp:211–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209}
210
211void MessageEditor::TryToSendMessage()
212{
213 int length = GetWindowTextLength(m_edit_hwnd);
214 TCHAR* data = new TCHAR[length + 1];
215
216 GetWindowText(m_edit_hwnd, data, length + 1);
217
218 if (IsJustWhiteSpace(data))
219 {
220 delete[] data;
221 return;
222 }
223
224 if (ContainsAuthenticationToken(data))
225 {
226 if (MessageBox(g_Hwnd, TmGetTString(IDS_MAY_CONTAIN_TOKEN), TmGetTString(IDS_HOLD_UP_CONFIRM), MB_YESNO | MB_ICONQUESTION) != IDYES) {
227 delete[] data;
228 return;
229 }
230 }
231
232 SendMessageParams parms;
233 parms.m_rawMessage = data;
234 parms.m_replyTo = ReplyingTo();
235 parms.m_bEdit = m_bEditing;
236 parms.m_bReply = m_bReplying;
237 parms.m_bMention = MentionRepliedUser();
238
239 // send it as a message to the main window
240 if (!SendMessage(g_Hwnd, WM_SENDMESSAGE, 0, (LPARAM) &parms))
241 {
242 // Message was sent, so clear the box
243 SetWindowText(m_edit_hwnd, TEXT(""));
244 m_bReplying = false;
245 m_bEditing = false;
246 m_replyMessage = 0;
247 m_replyName = "";
248
249 int otherStuff = m_bBrowsingPast ? m_jumpPresentHeight : 0;
250 Expand(-m_expandedBy - otherStuff);
251 }
252 delete[] data;
253}
254
255void MessageEditor::StartBrowsingPast()
256{

Callers 2

EditWndProcMethod · 0.80
WndProcMethod · 0.80

Calls 2

IsJustWhiteSpaceFunction · 0.85

Tested by

no test coverage detected