PageRenderTime 42ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/quassel-0.7.3/src/core/ircserverhandler.h

#
C Header | 141 lines | 80 code | 18 blank | 43 comment | 0 complexity | bca309a1574899134c984fa518242912 MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0
  1. /***************************************************************************
  2. * Copyright (C) 2005-10 by the Quassel Project *
  3. * devel@quassel-irc.org *
  4. * *
  5. * This program is free software; you can redistribute it and/or modify *
  6. * it under the terms of the GNU General Public License as published by *
  7. * the Free Software Foundation; either version 2 of the License, or *
  8. * (at your option) version 3. *
  9. * *
  10. * This program is distributed in the hope that it will be useful, *
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  13. * GNU General Public License for more details. *
  14. * *
  15. * You should have received a copy of the GNU General Public License *
  16. * along with this program; if not, write to the *
  17. * Free Software Foundation, Inc., *
  18. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
  19. ***************************************************************************/
  20. #ifndef IRCSERVERHANDLER_H
  21. #define IRCSERVERHANDLER_H
  22. #include "corebasichandler.h"
  23. #include "netsplit.h"
  24. class IrcServerHandler : public CoreBasicHandler {
  25. Q_OBJECT
  26. public:
  27. IrcServerHandler(CoreNetwork *parent);
  28. ~IrcServerHandler();
  29. void handleServerMsg(QByteArray rawMsg);
  30. public slots:
  31. void handleInvite(const QString &prefix, const QList<QByteArray> &params);
  32. void handleJoin(const QString &prefix, const QList<QByteArray> &params);
  33. void handleKick(const QString &prefix, const QList<QByteArray> &params);
  34. void handleMode(const QString &prefix, const QList<QByteArray> &params);
  35. void handleNick(const QString &prefix, const QList<QByteArray> &params);
  36. void handleNotice(const QString &prefix, const QList<QByteArray> &params);
  37. void handlePart(const QString &prefix, const QList<QByteArray> &params);
  38. void handlePing(const QString &prefix, const QList<QByteArray> &params);
  39. void handlePong(const QString &prefix, const QList<QByteArray> &params);
  40. void handlePrivmsg(const QString &prefix, const QList<QByteArray> &params);
  41. void handleQuit(const QString &prefix, const QList<QByteArray> &params);
  42. void handleTopic(const QString &prefix, const QList<QByteArray> &params);
  43. void handleCap(const QString &prefix, const QList<QByteArray> &params); // CAP framework
  44. void handleAuthenticate(); // SASL auth - no params
  45. void handle001(const QString &prefix, const QList<QByteArray> &params); // RPL_WELCOME
  46. void handle005(const QString &prefix, const QList<QByteArray> &params); // RPL_ISUPPORT
  47. void handle221(const QString &prefix, const QList<QByteArray> &params); // RPL_UMODEIS
  48. void handle250(const QString &prefix, const QList<QByteArray> &params); // RPL_STATSDLINE
  49. void handle265(const QString &prefix, const QList<QByteArray> &params); // RPL_LOCALUSERS
  50. void handle266(const QString &prefix, const QList<QByteArray> &params); // RPL_GLOBALUSERS
  51. void handle301(const QString &prefix, const QList<QByteArray> &params); // RPL_AWAY
  52. void handle305(const QString &prefix, const QList<QByteArray> &params); // RPL_UNAWAY
  53. void handle306(const QString &prefix, const QList<QByteArray> &params); // RPL_NOWAWAY
  54. void handle307(const QString &prefix, const QList<QByteArray> &params); // RPL_WHOISSERVICE
  55. void handle310(const QString &prefix, const QList<QByteArray> &params); // RPL_SUSERHOST
  56. void handle311(const QString &prefix, const QList<QByteArray> &params); // RPL_WHOISUSER
  57. void handle312(const QString &prefix, const QList<QByteArray> &params); // RPL_WHOISSERVER
  58. void handle313(const QString &prefix, const QList<QByteArray> &params); // RPL_WHOISOPERATOR
  59. void handle314(const QString &prefix, const QList<QByteArray> &params); // RPL_WHOWASUSER
  60. void handle315(const QString &prefix, const QList<QByteArray> &params); // RPL_ENDOFWHO
  61. void handle317(const QString &prefix, const QList<QByteArray> &params); // RPL_WHOISIDLE
  62. void handle318(const QString &prefix, const QList<QByteArray> &params); // RPL_ENDOFWHOIS
  63. void handle319(const QString &prefix, const QList<QByteArray> &params); // RPL_WHOISCHANNELS
  64. void handle320(const QString &prefix, const QList<QByteArray> &params); // RPL_WHOISVIRT (is identified to services)
  65. void handle322(const QString &prefix, const QList<QByteArray> &params); // RPL_LIST
  66. void handle323(const QString &prefix, const QList<QByteArray> &params); // RPL_LISTEND
  67. void handle324(const QString &prefix, const QList<QByteArray> &params); // RPL_CHANNELMODEIS
  68. void handle328(const QString &prefix, const QList<QByteArray> &params); // RPL_??? (channel homepage)
  69. void handle329(const QString &prefix, const QList<QByteArray> &params); // RPL_??? (channel creation time)
  70. void handle330(const QString &prefix, const QList<QByteArray> &params); // RPL_WHOISACCOUNT (quakenet/snircd/undernet)
  71. void handle331(const QString &prefix, const QList<QByteArray> &params); // RPL_NOTOPIC
  72. void handle332(const QString &prefix, const QList<QByteArray> &params); // RPL_TOPIC
  73. void handle333(const QString &prefix, const QList<QByteArray> &params); // Topic set by...
  74. void handle341(const QString &prefix, const QList<QByteArray> &params); // RPL_INVITING
  75. void handle352(const QString &prefix, const QList<QByteArray> &params); // RPL_WHOREPLY
  76. void handle353(const QString &prefix, const QList<QByteArray> &params); // RPL_NAMREPLY
  77. void handle369(const QString &prefix, const QList<QByteArray> &params); // RPL_ENDOFWHOWAS
  78. void handle432(const QString &prefix, const QList<QByteArray> &params); // ERR_ERRONEUSNICKNAME
  79. void handle433(const QString &prefix, const QList<QByteArray> &params); // ERR_NICKNAMEINUSE
  80. void handle437(const QString &prefix, const QList<QByteArray> &params); // ERR_UNAVAILRESOURCE
  81. void defaultHandler(QString cmd, const QString &prefix, const QList<QByteArray> &params);
  82. private slots:
  83. //! Joins after a netsplit
  84. /** This slot handles a bulk-join after a netsplit is over
  85. * \param channel The channel the users joined
  86. * \param users The list of users that joind the channel
  87. * \param modes The list of modes the users get set
  88. * \param quitMessage The message we received when the netsplit occured
  89. */
  90. void handleNetsplitJoin(const QString &channel, const QStringList &users, const QStringList &modes, const QString &quitMessage);
  91. //! Quits after a netsplit
  92. /** This slot handles a bulk-quit after a netsplit occured
  93. * \param channel The channel the users quitted
  94. * \param users The list of users that got split
  95. * \param quitMessage The message we received when the netsplit occured
  96. */
  97. void handleNetsplitQuit(const QString &channel, const QStringList &users, const QString &quitMessage);
  98. //! Netsplit finished
  99. /** This slot deletes the netsplit object that sent the finished() signal
  100. */
  101. void handleNetsplitFinished();
  102. void handleEarlyNetsplitJoin(const QString &channel, const QStringList &users, const QStringList &modes);
  103. //! Destroy any existing netsplits
  104. /** This slot deletes all netsplit objects
  105. * Used to get rid of existing netsplits on network reconnect
  106. */
  107. void destroyNetsplits();
  108. private:
  109. void tryNextNick(const QString &errnick, bool erroneus = false);
  110. bool checkParamCount(const QString &methodName, const QList<QByteArray> &params, int minParams);
  111. // holds the target for numeric replies or is invalid otherwise
  112. inline const QString &target() const { return _target; }
  113. bool _whois;
  114. QString _target;
  115. // structure to organize netsplits
  116. // key: quit message
  117. // value: the corresponding netsplit object
  118. QHash<QString, Netsplit*> _netsplits;
  119. #ifdef HAVE_QCA2
  120. QByteArray decrypt(const QString &target, const QByteArray &message, bool isTopic = false);
  121. #endif
  122. };
  123. #endif