Forwarding messages to ChatWindow

Added stringview as status feedback
This commit is contained in:
urnenfeld 2010-05-28 22:38:16 +00:00
parent ff80897441
commit 3a8af7c9f9
3 changed files with 34 additions and 18 deletions

View File

@ -50,11 +50,14 @@ ChatWindow::ChatWindow(ContactLinker* cl)
AddCommonFilter(new EditingFilter(fSendView));
fSendView->MakeFocus(true);
fStatus = new BStringView("status", "");
SetLayout(new BGroupLayout(B_HORIZONTAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
.Add(scrollViewReceive, 2)
.Add(scrollViewSend)
.Add(fStatus)
.SetInsets(5, 5, 5, 5)
);
@ -116,6 +119,14 @@ ChatWindow::ImMessage(BMessage* msg)
fReceiveView->AppendOtherMessage(message.String());
break;
}
case IM_CONTACT_STARTED_TYPING:
fStatus->SetText("Buddy is typing ...");
break;
case IM_CONTACT_STOPPED_TYPING:
fStatus->SetText("");
break;
default:
break;
}

View File

@ -7,6 +7,7 @@
#include <Window.h>
#include <TextView.h>
#include <StringView.h>
#include "Observer.h"
#include "CayaConstants.h"
@ -32,6 +33,8 @@ private:
BTextView* fSendView;
ContactLinker* fContactLinker;
CayaRenderView* fReceiveView;
BStringView* fStatus;
};
#endif // _CHAT_WINDOW_H

View File

@ -274,6 +274,8 @@ Server::ImMessage(BMessage* msg)
break;
}
case IM_MESSAGE_RECEIVED:
case IM_CONTACT_STARTED_TYPING:
case IM_CONTACT_STOPPED_TYPING:
{
BString id = msg->FindString("id");
if (id.Length() > 0) {