Fixing an bug in direct trust
diff --git a/src/chatdialog.cpp b/src/chatdialog.cpp
index f88f972..6a3f70c 100644
--- a/src/chatdialog.cpp
+++ b/src/chatdialog.cpp
@@ -691,6 +691,7 @@
 void
 ChatDialog::settingUpdated(QString nick, QString chatroom, QString originPrefix)
 {
+  _LOG_DEBUG("called");
   QString randString = getRandomString();
   bool needWrite = false;
   bool needFresh = false;
@@ -917,7 +918,7 @@
       boost::this_thread::sleep(boost::posix_time::milliseconds(100));
 #endif
     }
-  _LOG_DEBUG("now the prefix is " << m_localPrefix.toUri());
+  _LOG_DEBUG("now the prefix is " << m_newLocalPrefix.toUri());
   _LOG_DEBUG("in use prefix is " << m_user.getOriginPrefix().toStdString());
   QString originPrefix = QString::fromStdString(m_newLocalPrefix.toUri());
     
diff --git a/src/contactpanel.cpp b/src/contactpanel.cpp
index 8e7de21..e978738 100644
--- a/src/contactpanel.cpp
+++ b/src/contactpanel.cpp
@@ -307,8 +307,25 @@
   if(NULL != keyPtr && security::PolicyManager::verifySignature(invitation->getSignedBlob(), invitation->getSignatureBits(), *keyPtr))
     {
       Ptr<security::IdentityCertificate> certificate = Ptr<security::IdentityCertificate>::Create();
-      // hack: incomplete certificate, we don't send it to the wire nor store it anywhere
+      // hack: incomplete certificate, we don't send it to the wire nor store it anywhere, we only use it to carry information
       certificate->setName(invitation->getInviterCertificateName());
+      bool findCert = false;
+      vector<Ptr<ContactItem> >::const_iterator it = m_contactList.begin();
+      for(; it != m_contactList.end(); it++)
+        {
+          if((*it)->getNameSpace() == invitation->getInviterNameSpace())
+            {
+              certificate->setNotBefore((*it)->getSelfEndorseCertificate().getNotBefore());
+              certificate->setNotAfter((*it)->getSelfEndorseCertificate().getNotAfter());
+              findCert = true;
+              break;
+            }
+        }
+      if(findCert == false)
+        {
+          _LOG_ERROR("No SelfEndorseCertificate found!");
+          return;
+        }
       certificate->setPublicKeyInfo(*keyPtr);
       popChatInvitation(invitation, invitation->getInviterNameSpace(), certificate);
       return;