Source: Ban.h


Annotated List
Files
Globals
Hierarchy
Index
/***************************************************************************
 *
 * File:    Ban.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 BAN_H
#define BAN_H

#include <qstring.h>
#include <qdatetime.h>
#include <qobject.h>
/**
* @author David M.
* @short Keep data for a channel ban.
*
* Class Ban represents a ban on an IRC channel. It is intended to be kept in
* a channel banlist.
*/
class Ban : public QObject
{

  public:
      /**
      * Create a new ban object with the specified attributes.
      *
      * @param mask The host mask of the ban.
      * @param nick The nick or server who set the ban
      * @param timestamp A QDateTime object representing the time
      *        on which the ban was set.
      */
      Ban(const QString& mask,const QString& nick,const QDateTime& timestamp);
      ~Ban();

      /**
      * Get the host mask of the ban object.
      *
      * @return A string containing the mask the ban was set on.
      */
      const QString& getMask() const;

      /**
      * Get the name of the user/server who set the ban.
      *
      * @return A string containing the nick of the user who set the ban,
      *                 or the name of the server, in case of a server ban.
      */
      const QString& getSetBy() const;

      /**
      * Get the date and time on which the ban was set.
      *
      * @return A QDateTime object initialized to the date and time
      *                   the ban was set on.
      */
      const QDateTime& getTimeStamp() const;
      /**
      * Determine wether the specified mask matches the ban.
      * @param mask The mask to check against the internal banmask.
      *
      * @return true if the ban matches the mask, false otherwise.
      */
      bool matches(const QString& mask) const;
      /**
      * Determine if a specifed mask matches a string. This is a static
      * method, and can therefore be used as Ban::match() from anywhere.
      *
      * @param str The full string to match against the mask (the non-wildcarded one)
      * @param mask The mask to check the string against (usually wildcarded)
      *
      * @return true if the string matches the mask, false otherwise.
      */
      static bool match(const QString& str,const QString& mask);

  private:  //## implementation
      QString _mask;
      QString _setBy;
      QDateTime _timeStamp;
};

#endif




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