PageRenderTime 31ms CodeModel.GetById 7ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://gitlab.com/mziab/kadu
C Header | 66 lines | 34 code | 13 blank | 19 comment | 0 complexity | 8576b278101b1fcd839e565a04bcc90e MD5 | raw file
Possible License(s): LGPL-2.1, GPL-3.0, BSD-3-Clause, CC-BY-3.0, GPL-2.0
  1. /*
  2. * %kadu copyright begin%
  3. * Copyright 2011, 2012 Bartosz Brachaczek (b.brachaczek@gmail.com)
  4. * Copyright 2011, 2013, 2014 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. #ifndef GADU_SOCKET_NOTIFIERS_H
  21. #define GADU_SOCKET_NOTIFIERS_H
  22. #include <QtCore/QObject>
  23. class QSocketNotifier;
  24. class QTimer;
  25. class GaduSocketNotifiers : public QObject
  26. {
  27. Q_OBJECT
  28. int Socket;
  29. bool Started;
  30. QSocketNotifier *ReadNotifier;
  31. QSocketNotifier *WriteNotifier;
  32. QTimer *TimeoutTimer;
  33. void createSocketNotifiers();
  34. void deleteSocketNotifiers();
  35. private slots:
  36. void socketTimeout();
  37. void dataReceived();
  38. void dataSent();
  39. protected:
  40. void watchFor(int socket);
  41. virtual bool checkRead() = 0;
  42. virtual bool checkWrite() = 0;
  43. virtual void socketEvent() = 0;
  44. virtual int timeout() = 0;
  45. virtual bool handleSoftTimeout() = 0;
  46. virtual void connectionTimeout() = 0;
  47. public:
  48. GaduSocketNotifiers(QObject *parent = 0);
  49. virtual ~GaduSocketNotifiers();
  50. void disable();
  51. void enable();
  52. };
  53. #endif // GADU_SOCKET_NOTIFIERS_H