Fix the bug of pressing cancel button in invitation dialog
diff --git a/src/chatdialog.cpp b/src/chatdialog.cpp
index 6aa1349..9046f2c 100644
--- a/src/chatdialog.cpp
+++ b/src/chatdialog.cpp
@@ -277,7 +277,7 @@
 ChatDialog::onInviteReplyVerified(ndn::Ptr<ndn::Data> data, const ndn::Name& identity, bool isIntroducer)
 {
   string content(data->content().buf(), data->content().size());
-  if(content.empty())
+  if(content == string("nack"))
     invitationRejected(identity);
   else
     invitationAccepted(identity, data, content, isIntroducer);
diff --git a/src/contactpanel.cpp b/src/contactpanel.cpp
index 57d8c80..4d281d6 100644
--- a/src/contactpanel.cpp
+++ b/src/contactpanel.cpp
@@ -623,7 +623,7 @@
 void
 ContactPanel::rejectInvitation(const ChronosInvitation& invitation)
 {
-  string empty;
+  string empty("nack");
   m_handler->publishDataByIdentity (invitation.getInterestName(), empty);
 }
 
diff --git a/src/invitationdialog.cpp b/src/invitationdialog.cpp
index 1522314..4129ba0 100644
--- a/src/invitationdialog.cpp
+++ b/src/invitationdialog.cpp
@@ -61,11 +61,12 @@
   ui->msgLabel->clear();
   ui->chatroomLine->clear();
 
+  emit invitationRejected(*m_invitation); 
+
   m_invitation = NULL;
   m_identityCertificate = NULL;
   m_inviterAlias.clear();
 
-  emit invitationRejected(*m_invitation); 
   this->close();
 }