/plugins/gadu_protocol/socket-notifiers/gadu-protocol-socket-notifiers.h

https://gitlab.com/mziab/kadu · C Header · 76 lines · 42 code · 15 blank · 19 comment · 0 complexity · 0730ccca0e56643eaaec6225c163c4ff MD5 · raw file

  1. /*
  2. * %kadu copyright begin%
  3. * Copyright 2011, 2012 Bartosz Brachaczek (b.brachaczek@gmail.com)
  4. * Copyright 2011, 2012, 2013, 2014, 2015 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
  5. * %kadu copyright end%
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #pragma once
  21. #include "gadu-socket-notifiers.h"
  22. #include "gadu-protocol.h"
  23. #include "accounts/account.h"
  24. class GaduIMTokenService;
  25. class GaduUserDataService;
  26. class GaduProtocolSocketNotifiers : public GaduSocketNotifiers
  27. {
  28. Q_OBJECT
  29. public:
  30. explicit GaduProtocolSocketNotifiers(Account account, GaduProtocol *protocol);
  31. virtual ~GaduProtocolSocketNotifiers();
  32. void setGaduIMTokenService(GaduIMTokenService *imTokenService);
  33. void setGaduUserDataService(GaduUserDataService *userDataService);
  34. void watchFor(gg_session *sess);
  35. signals:
  36. void msgEventReceived(struct gg_event *e);
  37. void multilogonMsgEventReceived(struct gg_event *e);
  38. void ackEventReceived(struct gg_event *e);
  39. void typingNotifyEventReceived(struct gg_event *e);
  40. protected:
  41. virtual bool checkRead();
  42. virtual bool checkWrite();
  43. virtual void socketEvent();
  44. virtual int timeout();
  45. virtual bool handleSoftTimeout();
  46. virtual void connectionTimeout();
  47. private:
  48. Account m_account;
  49. GaduProtocol *m_protocol;
  50. gg_session *m_session;
  51. QPointer<GaduIMTokenService> m_imTokenService;
  52. QPointer<GaduUserDataService> m_userDataService;
  53. void dumpConnectionState();
  54. void handleEventNotify(struct gg_event *e);
  55. void handleEventNotify60(struct gg_event *e);
  56. void handleEventStatus(struct gg_event *e);
  57. void handleEventConnFailed(struct gg_event *e);
  58. void handleEventConnSuccess(struct gg_event *e);
  59. void handleEventDisconnect(struct gg_event *e);
  60. void handleEventMultilogonInfo(struct gg_event *e);
  61. };