Advertising Class Reference

Plugin managing ads. More...

#include <advertising.h>

Inheritance diagram for Advertising:

Plugin

List of all members.

Public Member Functions

 Advertising (BotKernel *)
 Constructor.
time_t addAdvertise (string, unsigned int, unsigned int, string, string)
 Add an advertise to the advertise list.
bool delAdvertise (string)
 Delete an advertise from the file.
bool adExists (string)
 Tell if an advertise exists.
vector< string > getAdvertiseInfos (string)
 Get advertise infos.
vector< string > getAdvertisesList ()
 Get advertises list.
void deleteOutdatedAds ()
 Delete outdated ads.
void launchAdvertise (BotKernel *, string, unsigned int)
 launch an add

Private Member Functions

void initFile ()
 Initialize the XML file.

Private Attributes

TiXmlDocument * doc
 Represent the xml document.
TiXmlNode * root
 Represent documents's root.


Detailed Description

Plugin managing ads.

This plugin makes the bot display ads on channels

Definition at line 51 of file advertising.h.


Constructor & Destructor Documentation

Advertising::Advertising ( BotKernel b  ) 


Member Function Documentation

time_t Advertising::addAdvertise ( string  channel,
unsigned int  frequency,
unsigned int  until,
string  by,
string  text 
)

Add an advertise to the advertise list.

Add an advertising to a channel, and save it int the XML file

Parameters:
channel Ad's channel
frequency Ad's frequency (in seconds)
until Number (in seconds) after witch the ad is outdated
by User who add the ad
text Ad's text
Returns:
ad's timestamp used to access to it

Definition at line 97 of file advertising.cpp.

References adExists(), doc, Tools::intToStr(), and root.

Referenced by addad().

bool Advertising::adExists ( string  id  ) 

Tell if an advertise exists.

Tell if an ad exists

Parameters:
id Ad's id
Returns:
true if exists, else false

Definition at line 148 of file advertising.cpp.

References doc.

Referenced by addAdvertise().

bool Advertising::delAdvertise ( string  id  ) 

Delete an advertise from the file.

Delete an advertise from the XML file

Parameters:
id Ad's id
Returns:
true is ad deleted, else false

Definition at line 128 of file advertising.cpp.

References doc.

Referenced by delad().

void Advertising::deleteOutdatedAds (  ) 

Delete outdated ads.

Delete outdated ads

Definition at line 208 of file advertising.cpp.

References doc, and Tools::strToInt().

Referenced by cleanList().

vector< string > Advertising::getAdvertiseInfos ( string  id  ) 

Get advertise infos.

Get advertise infos. Infos are :

  • channel
  • frequency
  • until
  • date
  • sender
  • text
    Parameters:
    id Ad's id

Definition at line 169 of file advertising.cpp.

References doc.

Referenced by adinfos(), and displayAdvertise().

vector< string > Advertising::getAdvertisesList (  ) 

Get advertises list.

Get advertises list

Returns:
A vector containing id's and texts

Definition at line 190 of file advertising.cpp.

References doc, and Tools::strToInt().

Referenced by listads().

void Advertising::initFile (  )  [private]

Initialize the XML file.

Initilaize the XML file by creating root and first childs (file empty structure)

Definition at line 68 of file advertising.cpp.

References doc, and root.

Referenced by Advertising().

void Advertising::launchAdvertise ( BotKernel b,
string  id,
unsigned int  freq 
)

launch an add

Launch an add

Parameters:
b Kernel pointer
id Ad's id
freq Ad's display frequency

Definition at line 82 of file advertising.cpp.

References BotKernel::addCountDown(), and displayAdvertise().

Referenced by Advertising().


Member Data Documentation

TiXmlDocument* Advertising::doc [private]

Represent the xml document.

Definition at line 55 of file advertising.h.

Referenced by addAdvertise(), adExists(), Advertising(), delAdvertise(), deleteOutdatedAds(), getAdvertiseInfos(), getAdvertisesList(), and initFile().

TiXmlNode* Advertising::root [private]

Represent documents's root.

Definition at line 57 of file advertising.h.

Referenced by addAdvertise(), Advertising(), and initFile().


The documentation for this class was generated from the following files:

Generated on Sun Aug 16 15:28:34 2009 for trustyRC by  doxygen 1.5.8