Yingdi Yu | 0484223 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 1 | /* -*- 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 Yu | c4d08d2 | 2013-10-23 23:07:29 -0700 | [diff] [blame^] | 18 | #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 Yu | 0484223 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 22 | #endif |
| 23 | |
| 24 | namespace Ui { |
| 25 | class ChatDialog; |
| 26 | } |
| 27 | |
| 28 | class ChatDialog : public QDialog |
| 29 | { |
| 30 | Q_OBJECT |
| 31 | |
| 32 | public: |
| 33 | explicit ChatDialog(const ndn::Name& chatroomPrefix, |
| 34 | const ndn::Name& localPrefix, |
Yingdi Yu | c4d08d2 | 2013-10-23 23:07:29 -0700 | [diff] [blame^] | 35 | const ndn::Name& defaultIdentity, |
Yingdi Yu | 0484223 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 36 | 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 Yu | c4d08d2 | 2013-10-23 23:07:29 -0700 | [diff] [blame^] | 48 | sendInvitation(ndn::Ptr<ContactItem> contact); |
Yingdi Yu | 0484223 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 49 | |
| 50 | private: |
Yingdi Yu | c4d08d2 | 2013-10-23 23:07:29 -0700 | [diff] [blame^] | 51 | 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 | |
| 72 | private: |
Yingdi Yu | 0484223 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 73 | Ui::ChatDialog *ui; |
| 74 | ndn::Name m_chatroomPrefix; |
| 75 | ndn::Name m_localPrefix; |
Yingdi Yu | c4d08d2 | 2013-10-23 23:07:29 -0700 | [diff] [blame^] | 76 | 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 Yu | 0484223 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 81 | }; |
| 82 | |
| 83 | #endif // ChatDIALOG_H |