add type hello in chatbuf;
dialog text display work for local message
diff --git a/demo/chatbuf.proto b/demo/chatbuf.proto
index 234c931..2b7d2ac 100644
--- a/demo/chatbuf.proto
+++ b/demo/chatbuf.proto
@@ -1,14 +1,14 @@
 package SyncDemo;
 
 message ChatMessage {
-  optional string msgData = 1;
-  required string to = 2;
-  required string from = 3;
-  optional int32 timestamp = 4;
+  required string to = 1;
+  required string from = 2;
   enum ChatMessageType {
     CHAT = 0;
     HELLO = 1;
     OTHER = 2;
   }
-  required ChatMessageType type = 5;
+  required ChatMessageType type = 3 [default = CHAT];
+  optional string data = 4;
+  optional int32 timestamp = 5;
 }
diff --git a/demo/chatdialog.cpp b/demo/chatdialog.cpp
index 3bc518d..9fbe15e 100644
--- a/demo/chatdialog.cpp
+++ b/demo/chatdialog.cpp
@@ -1,6 +1,7 @@
 #include <QtGui>
 #include "chatdialog.h"
 #include <ctime>
+#include <iostream>
 
 ChatDialog::ChatDialog(QWidget *parent)
   : QDialog(parent)
@@ -8,6 +9,9 @@
   setupUi(this);
   lineEdit->setFocusPolicy(Qt::StrongFocus);
 
+  // for test only
+  m_nick = "Tester";
+  m_chatroom = "Test";
 
   connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(returnPressed()));
 }
@@ -15,16 +19,27 @@
 void
 ChatDialog::appendMessage(const SyncDemo::ChatMessage &msg) 
 {
-  if (msg.from().isEmpty || message.msgData().isEmpty())
+
+  if (msg.type() != SyncDemo::ChatMessage::CHAT) {
     return;
+  }
+
+  if (!msg.has_data()) {
+    return;
+  }
+
+  if (msg.from().empty() || msg.data().empty()) {
+    return;
+  }
 
   QTextCursor cursor(textEdit->textCursor());
   cursor.movePosition(QTextCursor::End);
   QTextTableFormat tableFormat;
   tableFormat.setBorder(0);
   QTextTable *table = cursor.insertTable(1, 2, tableFormat);
-  table->cellAt(0, 0).firstCursorPosition().insertText("<" + msg.from() + ">: ");
-  table->cellAt(0, 1).firstCursorPosition().insertText(msg.msgData());
+  QString from = QString("<%1>: ").arg(msg.from().c_str());
+  table->cellAt(0, 0).firstCursorPosition().insertText(from);
+  table->cellAt(0, 1).firstCursorPosition().insertText(msg.data().c_str());
   QScrollBar *bar = textEdit->verticalScrollBar();
   bar->setValue(bar->maximum());
 }
@@ -41,6 +56,8 @@
   if (text.isEmpty())
     return;
  
+  lineEdit->clear();
+
   SyncDemo::ChatMessage msg;
   formChatMessage(text, msg);
   
@@ -48,14 +65,14 @@
   // send message
   appendMessage(msg);
   updateTreeView();
-
+  
 }
 
 void
 ChatDialog::formChatMessage(const QString &text, SyncDemo::ChatMessage &msg) {
-  msg.set_from(m_nick);
-  msg.set_to(m_chatroom);
-  msg.set_msgData(text);
+  msg.set_from(m_nick.toStdString());
+  msg.set_to(m_chatroom.toStdString());
+  msg.set_data(text.toStdString());
   time_t seconds = time(NULL);
   msg.set_timestamp(seconds);
 }
diff --git a/demo/chatdialog.h b/demo/chatdialog.h
index 0f65426..4c24335 100644
--- a/demo/chatdialog.h
+++ b/demo/chatdialog.h
@@ -11,7 +11,7 @@
 	ChatDialog(QWidget *parent = 0);
 
 public slots:
-  void appendMessage(SyncDemo::ChatMessage &msg);
+  void appendMessage(const SyncDemo::ChatMessage &msg);
   void updateTreeView();
 
 private slots: