view gui/src/qirc/IRCClientInterface.h @ 13588:52fd3b9ea848

Changed all #defines for IRC Codes to constants, as it should be. Assorted them in namespaces and gave them better readable names.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Wed, 03 Aug 2011 17:20:20 +0200
parents f0d6f2ff45de
children ee49f1a15c06
line wrap: on
line source

/* OctaveGUI - A graphical user interface for Octave
 * Copyright (C) 2011 Jacob Dawid
 * jacob.dawid@googlemail.com
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef IRCCLIENTINTERFACE_H
#define IRCCLIENTINTERFACE_H

#include <QString>
#include <QObject>
#include <QHostAddress>
#include <QTextDocument>
#include <QStringListModel>
#include "IRCCodes.h"

class IRCChannelProxyInterface
{
public:
  IRCChannelProxyInterface () { }
  virtual QTextDocument *conversationModel () = 0;
  virtual QStringListModel *userListModel () = 0;
};

/**
  * \class IRCClientInterface
  * IRC Clients need to implement this interface.
  */
class IRCClientInterface : public QObject
{
  Q_OBJECT
public:
  IRCClientInterface () { }
  virtual ~IRCClientInterface () { }

  virtual const QString& nickname () = 0;
  virtual bool isConnected () = 0;
  virtual const QHostAddress& host() = 0;
  virtual int port() = 0;
  virtual IRCChannelProxyInterface *ircChannelProxy(const QString& channel) = 0;

public slots:
  // Connection state:
  virtual void connectToHost (const QHostAddress& host, int port, const QString& initialNick) = 0;
  virtual void disconnect () = 0;
  virtual void reconnect () = 0;

  virtual void sendJoinRequest (const QString& channel) = 0;
  virtual void leaveChannel (const QString& channel, const QString& reason) = 0;

  // Messaging:
  virtual void focusChannel (const QString& channel) = 0;
  virtual void sendNicknameChangeRequest (const QString& nickname) = 0;
  virtual void sendPublicMessage (const QString& message) = 0;
  virtual void sendPrivateMessage (const QString& recipient, const QString& message) = 0;

signals:
  void newMessage (const QString& channel, const QString& sender, const QString& message);
  void connected (const QString& server);
  void disconnected ();
  void error (const QString& message);
  void notification (const QString& sender, const QString& message);
  void message (const QString& channel, const QString& sender, const QString& message);
  void nicknameChanged (const QString& oldNick, const QString& newNick);
  void userJoined (const QString& nick, const QString& channel);
  void userQuit (const QString& nick, const QString& reason);
  void loggedIn (const QString& nick);
  void userList (const QString& channel, const QStringList& list);
};

#endif // IRCCLIENTINTERFACE_H