| 209 | } |
| 210 | |
| 211 | void 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 | |
| 255 | void MessageEditor::StartBrowsingPast() |
| 256 | { |
no test coverage detected