blob: 5c4cfc322af1a2d0e9eaf7804c084e74e0d3d082 [file] [log] [blame]
Yingdi Yu9e0dc292013-10-10 11:39:45 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2013, Regents of the University of California
4 * Yingdi Yu
5 *
6 * BSD license, See the LICENSE file for more information
7 *
8 * Author: Yingdi Yu <yingdi@cs.ucla.edu>
9 */
10
Yingdi Yudef90612013-10-09 22:34:42 -070011#include "contactpanel.h"
12#include "ui_contactpanel.h"
13
Yingdi Yu01a942b2013-10-10 15:00:58 -070014
15#include <QStringList>
16#include <QItemSelectionModel>
17#include <QModelIndex>
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070018#include <QDir>
Yingdi Yu01a942b2013-10-10 15:00:58 -070019
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070020#ifndef Q_MOC_RUN
Yingdi Yu53eb8a72013-10-23 11:50:51 -070021#include <ndn.cxx/security/keychain.h>
22#include <ndn.cxx/security/identity/osx-privatekey-storage.h>
23#include <ndn.cxx/security/identity/identity-manager.h>
24#include <ndn.cxx/security/identity/basic-identity-storage.h>
25#include <ndn.cxx/security/cache/ttl-certificate-cache.h>
26#include <ndn.cxx/security/encryption/basic-encryption-manager.h>
Yingdi Yu100267f2013-10-21 15:01:40 -070027#include <ndn.cxx/common.h>
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070028#include <boost/filesystem.hpp>
Yingdi Yu53eb8a72013-10-23 11:50:51 -070029#include <boost/random/random_device.hpp>
30#include <boost/random/uniform_int_distribution.hpp>
31#include "invitation-policy-manager.h"
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070032#include "logging.h"
33#include "exception.h"
34#endif
35
36namespace fs = boost::filesystem;
37using namespace ndn;
Yingdi Yu53eb8a72013-10-23 11:50:51 -070038
Yingdi Yu79c25a22013-10-21 13:38:38 -070039using namespace std;
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070040
41INIT_LOGGER("ContactPanel");
42
Yingdi Yu53eb8a72013-10-23 11:50:51 -070043Q_DECLARE_METATYPE(ndn::security::IdentityCertificate)
44
Yingdi Yu0b82a4e2013-10-18 11:29:25 -070045ContactPanel::ContactPanel(Ptr<ContactManager> contactManager, QWidget *parent)
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070046 : QDialog(parent)
47 , ui(new Ui::ContactPanel)
Yingdi Yu0b82a4e2013-10-18 11:29:25 -070048 , m_contactManager(contactManager)
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070049 , m_contactListModel(new QStringListModel)
Yingdi Yu53eb8a72013-10-23 11:50:51 -070050 , m_profileEditor(new ProfileEditor(m_contactManager))
Yingdi Yu0b82a4e2013-10-18 11:29:25 -070051 , m_addContactPanel(new AddContactPanel(contactManager))
Yingdi Yu79c25a22013-10-21 13:38:38 -070052 , m_setAliasDialog(new SetAliasDialog(contactManager))
Yingdi Yu100267f2013-10-21 15:01:40 -070053 , m_startChatDialog(new StartChatDialog)
Yingdi Yu53eb8a72013-10-23 11:50:51 -070054 , m_invitationDialog(new InvitationDialog)
55 , m_settingDialog(new SettingDialog)
Yingdi Yu100267f2013-10-21 15:01:40 -070056 , m_menuInvite(new QAction("&Chat", this))
Yingdi Yu79c25a22013-10-21 13:38:38 -070057 , m_menuAlias(new QAction("&Set Alias", this))
Yingdi Yudef90612013-10-09 22:34:42 -070058{
Yingdi Yu53eb8a72013-10-23 11:50:51 -070059 qRegisterMetaType<ndn::security::IdentityCertificate>("IdentityCertificate");
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070060
Yingdi Yuc4d08d22013-10-23 23:07:29 -070061 ui->setupUi(this);
62 refreshContactList();
Yingdi Yu01a942b2013-10-10 15:00:58 -070063
Yingdi Yuc4d08d22013-10-23 23:07:29 -070064 openDB();
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070065
Yingdi Yuc4d08d22013-10-23 23:07:29 -070066 setKeychain();
67 m_handler = Ptr<Wrapper>(new Wrapper(m_keychain));
Yingdi Yu53eb8a72013-10-23 11:50:51 -070068
Yingdi Yuc4d08d22013-10-23 23:07:29 -070069 setLocalPrefix();
Yingdi Yu53eb8a72013-10-23 11:50:51 -070070
Yingdi Yuc4d08d22013-10-23 23:07:29 -070071 // Set Identity, TODO: through user interface
72 m_defaultIdentity = m_keychain->getDefaultIdentity();
73 m_settingDialog->setIdentity(m_defaultIdentity.toUri());
74 setInvitationListener();
75
76 ui->ContactList->setModel(m_contactListModel);
77
78 QItemSelectionModel* selectionModel = ui->ContactList->selectionModel();
Yingdi Yuc26af3c2013-10-17 17:03:46 -070079
Yingdi Yuc4d08d22013-10-23 23:07:29 -070080 connect(selectionModel, SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
81 this, SLOT(updateSelection(const QItemSelection &, const QItemSelection &)));
Yingdi Yu01a942b2013-10-10 15:00:58 -070082
Yingdi Yuc4d08d22013-10-23 23:07:29 -070083 connect(ui->ContactList, SIGNAL(customContextMenuRequested(const QPoint&)),
84 this, SLOT(showContextMenu(const QPoint&)));
Yingdi Yud59b5932013-10-16 13:16:49 -070085
Yingdi Yuc4d08d22013-10-23 23:07:29 -070086 connect(ui->EditProfileButton, SIGNAL(clicked()),
87 this, SLOT(openProfileEditor()));
Yingdi Yud59b5932013-10-16 13:16:49 -070088
Yingdi Yuc4d08d22013-10-23 23:07:29 -070089 connect(ui->AddContactButton, SIGNAL(clicked()),
90 this, SLOT(openAddContactPanel()));
Yingdi Yu53eb8a72013-10-23 11:50:51 -070091
Yingdi Yuc4d08d22013-10-23 23:07:29 -070092 connect(ui->settingButton, SIGNAL(clicked()),
93 this, SLOT(openSettingDialog()));
Yingdi Yu53eb8a72013-10-23 11:50:51 -070094
Yingdi Yuc4d08d22013-10-23 23:07:29 -070095 connect(m_addContactPanel, SIGNAL(newContactAdded()),
96 this, SLOT(refreshContactList()));
Yingdi Yu53eb8a72013-10-23 11:50:51 -070097
Yingdi Yuc4d08d22013-10-23 23:07:29 -070098 connect(m_setAliasDialog, SIGNAL(aliasChanged()),
99 this, SLOT(refreshContactList()));
Yingdi Yu53eb8a72013-10-23 11:50:51 -0700100
Yingdi Yuc4d08d22013-10-23 23:07:29 -0700101 connect(m_startChatDialog, SIGNAL(chatroomConfirmed(const QString&, const QString&, bool)),
102 this, SLOT(startChatroom(const QString&, const QString&, bool)));
Yingdi Yu53eb8a72013-10-23 11:50:51 -0700103
Yingdi Yuc4d08d22013-10-23 23:07:29 -0700104 connect(m_invitationDialog, SIGNAL(invitationAccepted(const ndn::Name&, const ndn::security::IdentityCertificate&, QString, QString)),
105 this, SLOT(acceptInvitation(const ndn::Name&, const ndn::security::IdentityCertificate&, QString, QString)));
106 connect(m_invitationDialog, SIGNAL(invitationRejected(const ndn::Name&)),
107 this, SLOT(rejectInvitation(const ndn::Name&)));
Yingdi Yu53eb8a72013-10-23 11:50:51 -0700108
Yingdi Yuc4d08d22013-10-23 23:07:29 -0700109 connect(m_settingDialog, SIGNAL(identitySet(const QString&)),
110 this, SLOT(updateDefaultIdentity(const QString&)));
111
112 connect(this, SIGNAL(newInvitationReady()),
113 this, SLOT(openInvitationDialog()));
Yingdi Yu100267f2013-10-21 15:01:40 -0700114
Yingdi Yu79c25a22013-10-21 13:38:38 -0700115
116
Yingdi Yudef90612013-10-09 22:34:42 -0700117}
118
119ContactPanel::~ContactPanel()
120{
Yingdi Yuc4d08d22013-10-23 23:07:29 -0700121 delete ui;
122 delete m_contactListModel;
123 delete m_profileEditor;
124 delete m_addContactPanel;
Yingdi Yu79c25a22013-10-21 13:38:38 -0700125
Yingdi Yuc4d08d22013-10-23 23:07:29 -0700126 delete m_menuInvite;
127
128 map<Name, ChatDialog*>::iterator it = m_chatDialogs.begin();
129 for(; it != m_chatDialogs.end(); it++)
130 delete it->second;
Yingdi Yudef90612013-10-09 22:34:42 -0700131}
Yingdi Yu9e0dc292013-10-10 11:39:45 -0700132
Yingdi Yu01a942b2013-10-10 15:00:58 -0700133void
Yingdi Yu53eb8a72013-10-23 11:50:51 -0700134ContactPanel::openDB()
135{
136 QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
137 QString path = (QDir::home().path());
138 path.append(QDir::separator()).append(".chronos").append(QDir::separator()).append("chronos.db");
139 db.setDatabaseName(path);
140 bool ok = db.open();
141}
142
143void
144ContactPanel::setKeychain()
145{
146 Ptr<security::OSXPrivatekeyStorage> privateStorage = Ptr<security::OSXPrivatekeyStorage>::Create();
147 Ptr<security::IdentityManager> identityManager = Ptr<security::IdentityManager>(new security::IdentityManager(Ptr<security::BasicIdentityStorage>::Create(), privateStorage));
148 Ptr<security::CertificateCache> certificateCache = Ptr<security::CertificateCache>(new security::TTLCertificateCache());
149 Ptr<InvitationPolicyManager> policyManager = Ptr<InvitationPolicyManager>(new InvitationPolicyManager(10, certificateCache));
150 Ptr<security::EncryptionManager> encryptionManager = Ptr<security::EncryptionManager>(new security::BasicEncryptionManager(privateStorage, "/tmp/encryption.db"));
151
152 vector<Ptr<ContactItem> >::const_iterator it = m_contactList.begin();
153 for(; it != m_contactList.end(); it++)
154 policyManager->addTrustAnchor((*it)->getSelfEndorseCertificate());
155
156 m_keychain = Ptr<security::Keychain>(new security::Keychain(identityManager, policyManager, encryptionManager));
157}
158
159void
160ContactPanel::setLocalPrefix()
161{
162 Ptr<Interest> interest = Ptr<Interest>(new Interest(Name("/local/ndn/prefix")));
163 interest->setChildSelector(Interest::CHILD_RIGHT);
164
165 Ptr<Closure> closure = Ptr<Closure>(new Closure(boost::bind(&ContactPanel::onLocalPrefixVerified,
166 this,
167 _1),
168 boost::bind(&ContactPanel::onLocalPrefixTimeout,
169 this,
170 _1,
171 _2),
172 boost::bind(&ContactPanel::onLocalPrefixVerified,
173 this,
174 _1)));
175
176 m_handler->sendInterest(interest, closure);
177}
178
179void
180ContactPanel::onLocalPrefixVerified(Ptr<Data> data)
181{
182 string originPrefix(data->content().buf(), data->content().size());
183 string prefix = QString::fromStdString (originPrefix).trimmed ().toUtf8().constData();
184 string randomSuffix = getRandomString();
Yingdi Yu53eb8a72013-10-23 11:50:51 -0700185 m_localPrefix = Name(prefix);
Yingdi Yuc4d08d22013-10-23 23:07:29 -0700186 m_localPrefix.append(randomSuffix);
Yingdi Yu53eb8a72013-10-23 11:50:51 -0700187}
188
189void
190ContactPanel::onLocalPrefixTimeout(Ptr<Closure> closure, Ptr<Interest> interest)
191{ throw LnException("No local prefix is found!"); }
192
193void
194ContactPanel::onUnverified(Ptr<Data> data)
195{}
196
197void
198ContactPanel::onTimeout(Ptr<Closure> closure, Ptr<Interest> interest)
199{}
200
201void
202ContactPanel::onInvitationCertVerified(Ptr<Data> data,
203 const Name& interestName,
204 int inviterIndex)
205{
206 Ptr<security::IdentityCertificate> certificate = Ptr<security::IdentityCertificate>(new security::IdentityCertificate(*data));
207
208 const int end = interestName.size();
209
210 string signature = interestName.get(end-1).toBlob();
211 Blob signatureBlob(signature.c_str(), signature.size());
212 string signedName = interestName.getSubName(0, end - 1).toUri();
213 Blob signedBlob(signedName.c_str(), signedName.size());
214
215 if(security::PolicyManager::verifySignature(signedBlob, signatureBlob, certificate->getPublicKeyInfo()))
216 {
217 Name keyName = certificate->getPublicKeyName();
218 Name inviterNameSpace = keyName.getSubName(0, keyName.size() - 1);
219 popChatInvitation(interestName, inviterIndex, inviterNameSpace, certificate);
220 }
221}
222
223void
224ContactPanel::popChatInvitation(const Name& interestName,
225 int inviterIndex,
226 const Name& inviterNameSpace,
227 Ptr<security::IdentityCertificate> certificate)
228{
229 string chatroomTag("chatroom");
230 int i = 0;
231 for(; i < inviterIndex; i++)
232 if(interestName.get(i).toUri() == chatroomTag)
233 break;
234 if(i+1 >= inviterIndex)
235 return;
236
237 string chatroom = interestName.get(i+1).toUri();
238 string inviter = inviterNameSpace.toUri();
Yingdi Yu53eb8a72013-10-23 11:50:51 -0700239 m_invitationDialog->setMsg(inviter, chatroom);
240 m_invitationDialog->setIdentityCertificate(certificate);
241 m_invitationDialog->setInterestName(interestName);
Yingdi Yuc4d08d22013-10-23 23:07:29 -0700242 emit newInvitationReady();
Yingdi Yu53eb8a72013-10-23 11:50:51 -0700243}
244
245static std::string chars("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789");
246
247string
248ContactPanel::getRandomString()
249{
250 string randStr;
251 boost::random::random_device rng;
252 boost::random::uniform_int_distribution<> index_dist(0, chars.size() - 1);
253 for (int i = 0; i < 10; i ++)
254 {
255 randStr += chars[index_dist(rng)];
256 }
257 return randStr;
258}
259
260
261void
262ContactPanel::setInvitationListener()
263{
264 Name prefix("/ndn/broadcast/chronos/invitation");
265 prefix.append(m_defaultIdentity);
Yingdi Yuc4d08d22013-10-23 23:07:29 -0700266 _LOG_DEBUG("prefix: " << prefix.toUri());
267 m_inviteListenPrefix = prefix;
Yingdi Yu53eb8a72013-10-23 11:50:51 -0700268 m_handler->setInterestFilter (prefix,
269 boost::bind(&ContactPanel::onInvitation,
270 this,
271 _1));
272
273}
274
275void
276ContactPanel::onInvitation(Ptr<Interest> interest)
277{
Yingdi Yuc4d08d22013-10-23 23:07:29 -0700278 _LOG_DEBUG("receive interest!" << interest->getName().toUri());
Yingdi Yu53eb8a72013-10-23 11:50:51 -0700279 const Name& interestName = interest->getName();
280 const int end = interestName.size();
281
282 string inviter("inviter");
283 int j = end-2;
284 for(; j >= 0; j--)
285 if(interestName.get(j).toUri() == inviter)
286 break;
287
288 //No certificate name found
289 if(j < 0)
290 return;
291
292 Name certName = interestName.getSubName(j+1, end-2-j);
293 string keyString("KEY");
294 string idString("ID-CERT");
295 int m = certName.size() - 1;
296 int keyIndex = -1;
297 int idIndex = -1;
298 for(; m >= 0; m--)
299 if(certName.get(m).toUri() == idString)
300 {
301 idIndex = m;
302 break;
303 }
304
305 for(; m >=0; m--)
306 if(certName.get(m).toUri() == keyString)
307 {
308 keyIndex = m;
309 break;
310 }
311
312 //Not a qualified certificate name
313 if(keyIndex < 0 && idIndex < 0)
314 return;
315
316 Ptr<Interest> newInterest = Ptr<Interest>(new Interest(certName));
317 Ptr<Closure> closure = Ptr<Closure>(new Closure(boost::bind(&ContactPanel::onInvitationCertVerified,
318 this,
319 _1,
320 interestName,
321 j),
322 boost::bind(&ContactPanel::onTimeout,
323 this,
324 _1,
325 _2),
326 boost::bind(&ContactPanel::onUnverified,
327 this,
328 _1)));
329 m_handler->sendInterest(newInterest, closure);
330}
331
332void
Yingdi Yu01a942b2013-10-10 15:00:58 -0700333ContactPanel::updateSelection(const QItemSelection &selected,
334 const QItemSelection &deselected)
335{
336 QModelIndexList items = selected.indexes();
337 QString text = m_contactListModel->data(items.first(), Qt::DisplayRole).toString();
Yingdi Yu79c25a22013-10-21 13:38:38 -0700338 string alias = text.toUtf8().constData();
339
Yingdi Yu79c25a22013-10-21 13:38:38 -0700340 int i = 0;
341 for(; i < m_contactList.size(); i++)
342 {
343 if(alias == m_contactList[i]->getAlias())
344 break;
345 }
346
347 QString name = QString::fromUtf8(m_contactList[i]->getName().c_str());
348 QString institution = QString::fromUtf8(m_contactList[i]->getInstitution().c_str());
349 QString nameSpace = QString::fromUtf8(m_contactList[i]->getNameSpace().toUri().c_str());
350 ui->NameData->setText(name);
351 ui->NameSpaceData->setText(nameSpace);
352 ui->InstitutionData->setText(institution);
Yingdi Yu100267f2013-10-21 15:01:40 -0700353
354 m_currentSelectedContactAlias = alias;
355 m_currentSelectedContactNamespace = m_contactList[i]->getNameSpace().toUri();
Yingdi Yu79c25a22013-10-21 13:38:38 -0700356 // _LOG_DEBUG("current Alias: " << m_currentSelectedContact);
Yingdi Yu01a942b2013-10-10 15:00:58 -0700357}
Yingdi Yu9e0dc292013-10-10 11:39:45 -0700358
Yingdi Yu0a6b6c52013-10-15 17:54:00 -0700359void
Yingdi Yu53eb8a72013-10-23 11:50:51 -0700360ContactPanel::updateDefaultIdentity(const QString& identity)
Yingdi Yuc4d08d22013-10-23 23:07:29 -0700361{
362 m_defaultIdentity = Name(identity.toUtf8().constData());
363 Name prefix("/ndn/broadcast/chronos/invitation");
364 prefix.append(m_defaultIdentity);
365
366 _LOG_DEBUG("reset invite listen prefix: " << prefix.toUri());
367
368 m_handler->clearInterestFilter(m_inviteListenPrefix);
369 m_handler->setInterestFilter(prefix,
370 boost::bind(&ContactPanel::onInvitation,
371 this,
372 _1));
373 m_inviteListenPrefix = prefix;
374}
Yingdi Yu53eb8a72013-10-23 11:50:51 -0700375
376void
Yingdi Yu0a6b6c52013-10-15 17:54:00 -0700377ContactPanel::openProfileEditor()
Yingdi Yud59b5932013-10-16 13:16:49 -0700378{ m_profileEditor->show(); }
Yingdi Yu0a6b6c52013-10-15 17:54:00 -0700379
Yingdi Yud59b5932013-10-16 13:16:49 -0700380void
381ContactPanel::openAddContactPanel()
382{ m_addContactPanel->show(); }
Yingdi Yu0a6b6c52013-10-15 17:54:00 -0700383
Yingdi Yu79c25a22013-10-21 13:38:38 -0700384void
Yingdi Yuc4d08d22013-10-23 23:07:29 -0700385ContactPanel::openInvitationDialog()
386{ m_invitationDialog->show(); }
387
388void
Yingdi Yu79c25a22013-10-21 13:38:38 -0700389ContactPanel::refreshContactList()
390{
391 m_contactList = m_contactManager->getContactItemList();
392 QStringList contactNameList;
393 for(int i = 0; i < m_contactList.size(); i++)
394 contactNameList << QString::fromUtf8(m_contactList[i]->getAlias().c_str());
395
396 m_contactListModel->setStringList(contactNameList);
397}
398
399void
400ContactPanel::showContextMenu(const QPoint& pos)
401{
402 QMenu menu(ui->ContactList);
403 menu.addAction(m_menuInvite);
Yingdi Yu100267f2013-10-21 15:01:40 -0700404 connect(m_menuInvite, SIGNAL(triggered()),
405 this, SLOT(openStartChatDialog()));
Yingdi Yu79c25a22013-10-21 13:38:38 -0700406 menu.addAction(m_menuAlias);
407 connect(m_menuAlias, SIGNAL(triggered()),
408 this, SLOT(openSetAliasDialog()));
409 menu.exec(ui->ContactList->mapToGlobal(pos));
410
411}
412
413void
414ContactPanel::openSetAliasDialog()
415{
Yingdi Yu100267f2013-10-21 15:01:40 -0700416 m_setAliasDialog->setTargetIdentity(m_currentSelectedContactNamespace);
Yingdi Yu79c25a22013-10-21 13:38:38 -0700417 m_setAliasDialog->show();
418}
419
Yingdi Yu100267f2013-10-21 15:01:40 -0700420void
Yingdi Yu53eb8a72013-10-23 11:50:51 -0700421ContactPanel::openSettingDialog()
422{
423 m_settingDialog->setIdentity(m_defaultIdentity.toUri());
424 m_settingDialog->show();
425}
426
427void
Yingdi Yu100267f2013-10-21 15:01:40 -0700428ContactPanel::openStartChatDialog()
429{
430 TimeInterval ti = time::NowUnixTimestamp();
431 ostringstream oss;
432 oss << ti.total_seconds();
433
434 Name chatroom("/ndn/broadcast/chronos");
435 chatroom.append(string("chatroom-") + oss.str());
436
437 m_startChatDialog->setInvitee(m_currentSelectedContactNamespace, chatroom.toUri());
438 m_startChatDialog->show();
439}
440
441void
442ContactPanel::startChatroom(const QString& chatroom, const QString& invitee, bool isIntroducer)
443{
444 _LOG_DEBUG("room: " << chatroom.toUtf8().constData());
445 _LOG_DEBUG("invitee: " << invitee.toUtf8().constData());
446 _LOG_DEBUG("introducer: " << std::boolalpha << isIntroducer);
Yingdi Yuc4d08d22013-10-23 23:07:29 -0700447
448 Name chatroomName("/ndn/broadcast/chronos");
449 chatroomName.append(chatroom.toUtf8().constData());
450
451 ChatDialog* chatDialog = new ChatDialog(chatroomName, m_localPrefix, m_defaultIdentity);
452 m_chatDialogs.insert(pair <Name, ChatDialog*> (chatroomName, chatDialog));
453
454 //TODO: send invitation
455 Name inviteeNamespace(invitee.toUtf8().constData());
456 Ptr<ContactItem> inviteeItem = m_contactManager->getContact(inviteeNamespace);
457
458 chatDialog->sendInvitation(inviteeItem);
459
460 chatDialog->show();
Yingdi Yu100267f2013-10-21 15:01:40 -0700461}
462
Yingdi Yu53eb8a72013-10-23 11:50:51 -0700463void
464ContactPanel::startChatroom2(const QString& chatroom, const QString& inviter)
465{
466 _LOG_DEBUG("room: " << chatroom.toUtf8().constData());
467 _LOG_DEBUG("inviter: " << inviter.toUtf8().constData());
468}
469
470void
471ContactPanel::acceptInvitation(const Name& interestName,
472 const security::IdentityCertificate& identityCertificate,
473 QString inviter,
474 QString chatroom)
475{
476 string prefix = m_localPrefix.toUri();
Yingdi Yuc4d08d22013-10-23 23:07:29 -0700477 _LOG_DEBUG("interestName " << interestName);
478 _LOG_DEBUG("prefix " << prefix);
Yingdi Yu53eb8a72013-10-23 11:50:51 -0700479 m_handler->publishDataByIdentity (interestName, prefix);
480 //TODO:: open chat dialog
Yingdi Yuc4d08d22013-10-23 23:07:29 -0700481 _LOG_DEBUG("ok");
Yingdi Yu53eb8a72013-10-23 11:50:51 -0700482 startChatroom2(chatroom, inviter);
483}
484
485void
486ContactPanel::rejectInvitation(const ndn::Name& interestName)
487{
488 string empty;
489 m_handler->publishDataByIdentity (interestName, empty);
490}
491
Yingdi Yu100267f2013-10-21 15:01:40 -0700492
Yingdi Yu9e0dc292013-10-10 11:39:45 -0700493#if WAF
494#include "contactpanel.moc"
495#include "contactpanel.cpp.moc"
496#endif