Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -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 |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 4 | * Yingdi Yu |
Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 5 | * |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 6 | * BSD license, See the LICENSE file for more information |
Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 7 | * |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 8 | * Author: Yingdi Yu <yingdi@cs.ucla.edu> |
Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 9 | */ |
| 10 | |
Zhenkai Zhu | 6d589aa | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 11 | #ifndef CHATDIALOG_H |
| 12 | #define CHATDIALOG_H |
Alexander Afanasyev | f829f4d | 2013-05-07 15:59:36 -0700 | [diff] [blame] | 13 | |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 14 | #include <QDialog> |
Alexander Afanasyev | f829f4d | 2013-05-07 15:59:36 -0700 | [diff] [blame] | 15 | |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 16 | #ifndef Q_MOC_RUN |
| 17 | #include <ndn.cxx/data.h> |
Yingdi Yu | eda39aa | 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" |
Alexander Afanasyev | f829f4d | 2013-05-07 15:59:36 -0700 | [diff] [blame] | 22 | #endif |
| 23 | |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 24 | namespace Ui { |
| 25 | class ChatDialog; |
| 26 | } |
Zhenkai Zhu | 6d589aa | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 27 | |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 28 | class ChatDialog : public QDialog |
Zhenkai Zhu | 6d589aa | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 29 | { |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 30 | Q_OBJECT |
Zhenkai Zhu | 6d589aa | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 31 | |
| 32 | public: |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 33 | explicit ChatDialog(const ndn::Name& chatroomPrefix, |
| 34 | const ndn::Name& localPrefix, |
Yingdi Yu | eda39aa | 2013-10-23 23:07:29 -0700 | [diff] [blame^] | 35 | const ndn::Name& defaultIdentity, |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 36 | QWidget *parent = 0); |
Zhenkai Zhu | 82a6275 | 2012-06-04 17:11:04 -0700 | [diff] [blame] | 37 | ~ChatDialog(); |
Zhenkai Zhu | b45e38a | 2012-06-01 15:44:36 -0700 | [diff] [blame] | 38 | |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 39 | const ndn::Name& |
| 40 | getChatroomPrefix() const |
| 41 | { return m_chatroomPrefix; } |
Zhenkai Zhu | 3a008fc | 2012-06-08 17:36:39 -0700 | [diff] [blame] | 42 | |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 43 | const ndn::Name& |
| 44 | getLocalPrefix() const |
| 45 | { return m_localPrefix; } |
| 46 | |
| 47 | void |
Yingdi Yu | eda39aa | 2013-10-23 23:07:29 -0700 | [diff] [blame^] | 48 | sendInvitation(ndn::Ptr<ContactItem> contact); |
Zhenkai Zhu | 10ccb5a | 2012-06-04 21:55:14 -0700 | [diff] [blame] | 49 | |
Zhenkai Zhu | b45e38a | 2012-06-01 15:44:36 -0700 | [diff] [blame] | 50 | private: |
Yingdi Yu | eda39aa | 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 | 5b98913 | 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 | eda39aa | 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; |
Zhenkai Zhu | 6d589aa | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 81 | }; |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 82 | |
| 83 | #endif // ChatDIALOG_H |