/me now formats /me properly

/me waves arms in the air like a maniac
/me knocks over a nearby cup of coffee
/me gasps when the coffee spills onto the adjacent laptop
/me cries out “Fore! Wait, four! Wait, fire!” when the laptop bursts
into flames
/me burns to a crisp
This commit is contained in:
Jaidyn Ann 2021-07-31 20:39:13 -05:00
parent 4a6808f15f
commit 803a2f20bd
2 changed files with 14 additions and 1 deletions

View File

@ -166,11 +166,15 @@ Conversation::ImMessage(BMessage* msg)
BString args = CommandArgs(body); BString args = CommandArgs(body);
ChatCommand* cmd = _GetServer()->CommandById(name, fLooper->GetInstance()); ChatCommand* cmd = _GetServer()->CommandById(name, fLooper->GetInstance());
if (cmd == NULL) { if (cmd == NULL && name != "me") {
_WarnUser(BString(B_TRANSLATE("That isn't a valid command. " _WarnUser(BString(B_TRANSLATE("That isn't a valid command. "
"Try /help for a list."))); "Try /help for a list.")));
break; break;
} }
else {
fMessenger.SendMessage(msg);
break;
}
BString error(""); BString error("");
if (cmd->Parse(args, &error, this) == false) if (cmd->Parse(args, &error, this) == false)

View File

@ -82,6 +82,7 @@ ConversationView::AttachedToWindow()
} }
NotifyInteger(INT_WINDOW_FOCUSED, 0); NotifyInteger(INT_WINDOW_FOCUSED, 0);
fSendView->MakeFocus(true); fSendView->MakeFocus(true);
fSendView->Invalidate();
} }
@ -433,6 +434,14 @@ ConversationView::_AppendMessage(BMessage* msg)
continue; continue;
} }
if (body.StartsWith("/me ")) {
BString meMsg = "** ";
meMsg << sender_name.String() << " ";
meMsg << body.RemoveFirst("/me ");
fReceiveView->AppendGeneric(meMsg.String());
continue;
}
fReceiveView->AppendMessage(sender_name.String(), body.String(), fReceiveView->AppendMessage(sender_name.String(), body.String(),
userColor, (time_t)timeInt); userColor, (time_t)timeInt);
} }