blob: e48216942c57882b6b20420e5979bae219d67acc [file] [log] [blame]
Yingdi Yu04842232013-10-23 14:03:09 -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
11#ifndef CHATDIALOG_H
12#define CHATDIALOG_H
13
14#include <QDialog>
15
16#ifndef Q_MOC_RUN
17#include <ndn.cxx/data.h>
Yingdi Yuc4d08d22013-10-23 23:07:29 -070018#include <ndn.cxx/security/keychain.h>
19#include <ndn.cxx/wrapper/wrapper.h>
20#include "chatroom-policy-manager.h"
21#include "contact-item.h"
Yingdi Yu04842232013-10-23 14:03:09 -070022#endif
23
24namespace Ui {
25class ChatDialog;
26}
27
28class ChatDialog : public QDialog
29{
30 Q_OBJECT
31
32public:
33 explicit ChatDialog(const ndn::Name& chatroomPrefix,
34 const ndn::Name& localPrefix,
Yingdi Yuc4d08d22013-10-23 23:07:29 -070035 const ndn::Name& defaultIdentity,
Yingdi Yu04842232013-10-23 14:03:09 -070036 QWidget *parent = 0);
37 ~ChatDialog();
38
39 const ndn::Name&
40 getChatroomPrefix() const
41 { return m_chatroomPrefix; }
42
43 const ndn::Name&
44 getLocalPrefix() const
45 { return m_localPrefix; }
46
47 void
Yingdi Yuc4d08d22013-10-23 23:07:29 -070048 sendInvitation(ndn::Ptr<ContactItem> contact);
Yingdi Yu04842232013-10-23 14:03:09 -070049
50private:
Yingdi Yuc4d08d22013-10-23 23:07:29 -070051 void
52 setWrapper();
53
54 void
55 onInviteReplyVerified(ndn::Ptr<ndn::Data> data, const ndn::Name& identity);
56
57 void
58 onInviteTimeout(ndn::Ptr<ndn::Closure> closure,
59 ndn::Ptr<ndn::Interest> interest,
60 const ndn::Name& identity,
61 int retry);
62
63 void
64 invitationRejected(const ndn::Name& identity);
65
66 void
67 invitationAccepted(const ndn::Name& identity);
68
69 void
70 onUnverified(ndn::Ptr<ndn::Data> data);
71
72private:
Yingdi Yu04842232013-10-23 14:03:09 -070073 Ui::ChatDialog *ui;
74 ndn::Name m_chatroomPrefix;
75 ndn::Name m_localPrefix;
Yingdi Yuc4d08d22013-10-23 23:07:29 -070076 ndn::Name m_defaultIdentity;
77 ndn::Ptr<ChatroomPolicyManager> m_policyManager;
78 ndn::Ptr<ndn::security::IdentityManager> m_identityManager;
79 ndn::Ptr<ndn::security::Keychain> m_keychain;
80 ndn::Ptr<ndn::Wrapper> m_handler;
Yingdi Yu04842232013-10-23 14:03:09 -070081};
82
83#endif // ChatDIALOG_H