Source: Channels.h


Annotated List
Files
Globals
Hierarchy
Index
/***************************************************************************
 *
 * File:    Channels.h
 * Created: Sat Dec 4 1999
 * (C) 1999 by David M. <captjay@superlink.net>
 *
 ***************************************************************************/
/***************************************************************************
 *                                                                         *
 *   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 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#ifndef CHANNELS_H
#define CHANNELS_H

#include <qstring.h>
#include <qdict.h>
#include <qobject.h>

class Channel;

/**
* @author David M.
* @short Handle an internal list of channels.
*
* This class provides methods to access and update an internal channel list.
*
* Channels provides a public interface for read-only access to the channels' information,
* and a protected interface for updating that information.
*
*/
class Channels : QObject {
public:
  Channels();
  ~Channels();

  /**
  * Find the channel object associated with a specified
  * channel name.
  *
  * @param name The name of the channel to find.
  * @return Channel* A pointer to a Channel object, or 0 if
  *                  the channel cannot be found.
  */
  const Channel* findChannel(QString name) const;

  void list() const;

protected:
  /**
  * Find the channel object associated with a specified channel name.
  *
  * This method returns a pointer to a non-const channel object, allowing
  * updates of the channel object. A pointer obtained through the
  * findChannelForUpdate method should NEVER be deleted.
  *
  * @param name The name of the channel to find.
  */
  Channel* findChannelForUpdate(QString name);
  /**
  * Notify the channels object that a user changed nicknames.
  *
  * call this method when a user changes nicknames, so all
  * channels the user is on updates information on his new nickname.
  *
  * @param nick The user's previous nick.
  * @param newNick The user's new nickname.
  */
  void nickChange(const QString& nick, const QString& newNick);
  /**
  * Notify the channels that a user quit IRC. Call this method
  * when a user quits to make sure he is correctly removed
  * from all the Channel objects where he was listed.
  *
  * @param nick The nickname of the user who quit IRC.
  */
  void userQuit(const QString& nick);
  /**
  * Remove a channel from the internal list and free
  * memory associated with it.
  *
  * PRECONDITIONS: findChannel(name)
  *
  * POSTCONDITIONS: !findChannel(name)
  *
  * @param name The name of the channel to remove
  */
  void remChannel(QString name);
  /**
  * Add a channel object to the internal list.
  *
  * PRECONDITIONS: chan != 0; !findChannel(chan->getName())
  *
  * POSTCONDITIONS: findChannel(chan->getName())
  */
  void addChannel(Channel* chan);
  /**
  * Remove all channels from the internal list and free
  * memory associated with them.
  *
  * Call this method when you want the channel list to be emptied,
  * for instance when the client disconnects from the server.
  */
  void clear();
  friend class IRCModule;
private:
    QDict<Channel> _channelList;
};

// Class Channels 





#endif






Generated by: nightsky@centauri on Sat Jan 15 23:06:10 2000, using kdoc 2.0a30.