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

View File

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

View File

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