xmppmuc.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #ifndef XMPPMUC_H
  2. #define XMPPMUC_H
  3. #include <QObject>
  4. #include <QDebug>
  5. #include "QXmppMucManager.h"
  6. #include "QXmppMessage.h"
  7. class XmppMuc : public QObject
  8. {
  9. Q_OBJECT
  10. Q_PROPERTY( QXmppMucManager* mucManager READ getMucManager WRITE setMucManager NOTIFY mucManagerChanged )
  11. Q_PROPERTY( QString jidRoom READ getJidRoom WRITE setJidRoom NOTIFY jidRoomChanged )
  12. Q_PROPERTY( QString nickName READ getNickName WRITE setNickName NOTIFY nickNameChanged )
  13. Q_PROPERTY( QString password READ getPassword WRITE setPassword NOTIFY passwordChanged )
  14. Q_PROPERTY( QString subjectRoom READ getSubjectRoom WRITE subjectRoomChangedAction NOTIFY subjectRoomChanged )
  15. QXmppMucManager* m_mucManager;
  16. QXmppMucRoom* m_mucRoom;
  17. QString m_jidRoom;
  18. QString m_myNickName;
  19. QString m_myPasswd;
  20. QString m_subjectRoom;
  21. public:
  22. explicit XmppMuc(QObject *parent = 0);
  23. Q_INVOKABLE QStringList getParticipants();
  24. Q_INVOKABLE bool sendMessage( const QString text );
  25. Q_INVOKABLE QString getNameByJid( const QString mucJid ) const;
  26. Q_INVOKABLE void leaveChat();
  27. //Q_INVOKABLE void joinRoom( const QString &nickName, const QString &passwd );
  28. /*---- getter / setter ----*/
  29. QString getSubjectRoom() const { return m_subjectRoom; }
  30. QXmppMucManager* getMucManager() const { return m_mucManager; }
  31. QString getJidRoom() const { return m_jidRoom; }
  32. QString getNickName() const { return m_myNickName; }
  33. void setNickName( const QString &_myName ) { m_myNickName = _myName; }
  34. QString getPassword() const { return m_myPasswd; }
  35. void setPassword( const QString &_myPass ) { m_myPasswd = _myPass; }
  36. signals:
  37. void mucManagerChanged();
  38. void invitationMucReceived(const QString &roomJid, const QString &inviterJid, const QString &reason);
  39. void jidRoomChanged(QString arg);
  40. void messageReceived();
  41. void nickNameChanged();
  42. void passwordChanged();
  43. void participantChanged(QString nickName);
  44. void participantAdded(QString nickName);
  45. void participantRemoved(QString nickName);
  46. void messageReceived( QString nickName, QString textMessage );
  47. void subjectRoomChanged (const QString &subject);
  48. private slots:
  49. void participantChangedAction(QString jid);
  50. void participantAddedAction(QString jid);
  51. void participantRemovedAction(QString jid);
  52. void messageReceivedAction(const QXmppMessage &message);
  53. void subjectRoomChangedAction( const QString &subject );
  54. public slots:
  55. void setMucManager(QXmppMucManager* arg);
  56. void setJidRoom(QString jid);
  57. private:
  58. QString resourceAsNickName( const QString &jid ) const;
  59. };
  60. #endif // XMPPMUC_H