c_channel Class Reference

Stores informations on one channel. More...

List of all members.

Public Member Functions

 add_user ($user)
 Adds an user to to array.
 find_host_bot ()
 Finds this bot on this channel ("host_bot").
 find_irc_op ()
 Finds IRC operators on this channel.
 find_mode ($mode, $plus)
 Finds users with/out some mode on this channel.
 find_unknown ()
 Finds unknown users on this channel ("host_unknown").
 find_user_nick ($nick, $ignore_case)
 Finds user as nick on this channel.
 find_users_name ($name, $want_online, $want_offline, $ignore_case)
 Finds user(s) as name on this channel.
 init ($name, $bans, $exceptions, $invites, $reops)
 Initialization.

Public Attributes

 $bans
 Array of ban masks.
 $exceptions
 Array of exceptions (to bans).
 $invites
 Array of invites.
 $key
 Key for the channel, or an empty string.
 $limit
 Limit for the channel as string, or an empty string for none.
 $mode
 String with modes (e.g. "nt") NB: There is no '+' at the beginning!
 $name
 Channel name.
 $reops
 Array of reop hints (IRCnet-specific).
 $topic
 Channel's topic.
 $users
 Array of c_user.


Detailed Description

Stores informations on one channel.

Version:
1
Author:
VooDooMan
Date:
2005

Definition at line 189 of file library_php_2.inc.php.


Member Function Documentation

c_channel::add_user user  ) 
 

Adds an user to to array.

Version:
1
Author:
VooDooMan
Date:
2005
Parameters:
user c_user object to add
Warning:
For internal use only

Definition at line 231 of file library_php_2.inc.php.

00232     {
00233         foreach($this->users as $e)
00234             if($e->nick==$user->nick)
00235                 return;
00236         array_push($this->users,$user);
00237     }

c_channel::find_host_bot  ) 
 

Finds this bot on this channel ("host_bot").

Version:
1
Author:
VooDooMan
Date:
2005
Returns:
Returns array of c_user
Warning:
If there are two instances of this bot, or host/fullname masks matches user with "host_bot" flag, there will be more users found!

Definition at line 325 of file library_php_2.inc.php.

00326     {
00327         $res=array();
00328         foreach($this->users as $e) {
00329             if($e->host_bot)
00330                 array_push($res,$e);
00331         }
00332         return $res;
00333     }

c_channel::find_irc_op  ) 
 

Finds IRC operators on this channel.

Version:
1
Author:
VooDooMan
Date:
2005
Returns:
Returns array of c_user

Definition at line 290 of file library_php_2.inc.php.

00291     {
00292         $res=array();
00293         foreach($this->users as $e) {
00294             if($e->irc_op)
00295                 array_push($res,$e);
00296         }
00297         return $res;
00298     }

c_channel::find_mode mode,
plus
 

Finds users with/out some mode on this channel.

Version:
1
Author:
VooDooMan
Date:
2005
Parameters:
mode Mode required to include, or exclude (use "@" for op, "+" for voice)
plus If set to TRUE: find users with that mode; FALSE: find users without that mode
Returns:
Returns array of c_user

Definition at line 344 of file library_php_2.inc.php.

00345     {
00346         if(strlen($mode)!=1) {
00347             echo "Error: c_channel::find_mode() argument \$mode should be string one-character long. It is: \"".$mode."\"\n";
00348             return array();
00349         }
00350         $res=array();
00351         foreach($this->users as $e) {
00352             if(($plus && strpos($e->mode,$mode)!==FALSE) || (!$plus && strpos($e->mode,$mode)===FALSE))
00353                 array_push($res,$e);
00354         }
00355         return $res;
00356     }

c_channel::find_unknown  ) 
 

Finds unknown users on this channel ("host_unknown").

Version:
1
Author:
VooDooMan
Date:
2005
Returns:
Returns array of c_user

Definition at line 307 of file library_php_2.inc.php.

00308     {
00309         $res=array();
00310         foreach($this->users as $e) {
00311             if($e->host_unknown)
00312                 array_push($res,$e);
00313         }
00314         return $res;
00315     }

c_channel::find_user_nick nick,
ignore_case
 

Finds user as nick on this channel.

Version:
1
Author:
VooDooMan
Date:
2005
Parameters:
nick Nick of user
ignore_case Set this TRUE for case-insensitive comparsion
Returns:
Returns c_user or NULL
Return values:
NULL Returns NULL if no such nick has been found on this channel

Definition at line 274 of file library_php_2.inc.php.

00275     {
00276         foreach($this->users as $e) {
00277             if((!$ignore_case && $e->nick==$nick) || ($ignore_case && strtolower($e->nick)==strtolower($nick)))
00278                 return $e;
00279         }
00280         return NULL;
00281     }

c_channel::find_users_name name,
want_online,
want_offline,
ignore_case
 

Finds user(s) as name on this channel.

Version:
1
Author:
VooDooMan
Date:
2005
Parameters:
name Name of user as in logic.txt
want_online Set this to TRUE if you want to get online users
want_offline Set this to TRUE if you want to get offline users
ignore_case Set this to TRUE for case-insensitivity
Returns:
Returns array of found users, array of c_user

Definition at line 250 of file library_php_2.inc.php.

References $name.

00251     {
00252         if(!$want_online && !$want_offline) {
00253             echo "Warning: ".__CLASS__."::".__FUNCTION__."() three-state logic issue: Do we want online, offline, or both? You want none!\n";
00254             return array(); // optimization: it is not needed to continue
00255         }
00256         $res=array();
00257         foreach($this->users as $e) {
00258             if((($want_online && $e->online) || ($want_offline && !$e->online)) && ((!$ignore_case && $e->name==$name) || ($ignore_case && strtolower($e->name)==strtolower($name))))
00259                 array_push($res,$e);
00260         }
00261         return $res;
00262     }

c_channel::init name,
bans,
exceptions,
invites,
reops
 

Initialization.

Version:
1
Author:
VooDooMan
Date:
2005
Parameters:
name Name of channel
bans Array of ban masks
exceptions Array of exceptions (to bans)
invites Array of invites
reops Array of reop hints (IRCnet-specific)

Definition at line 213 of file library_php_2.inc.php.

References $bans, $exceptions, $invites, $name, and $reops.

00214     {
00215         $this->name=$name;
00216         $this->users=array();
00217         $this->bans=$bans;
00218         $this->exceptions=$exceptions;
00219         $this->invites=$invites;
00220         $this->reops=$reops;
00221     }


Member Data Documentation

c_channel::$bans
 

Array of ban masks.

Definition at line 192 of file library_php_2.inc.php.

Referenced by init().

c_channel::$exceptions
 

Array of exceptions (to bans).

Definition at line 193 of file library_php_2.inc.php.

Referenced by init().

c_channel::$invites
 

Array of invites.

Definition at line 194 of file library_php_2.inc.php.

Referenced by init().

c_channel::$key
 

Key for the channel, or an empty string.

Definition at line 197 of file library_php_2.inc.php.

c_channel::$limit
 

Limit for the channel as string, or an empty string for none.

Definition at line 198 of file library_php_2.inc.php.

c_channel::$mode
 

String with modes (e.g. "nt") NB: There is no '+' at the beginning!

Definition at line 199 of file library_php_2.inc.php.

c_channel::$name
 

Channel name.

Definition at line 190 of file library_php_2.inc.php.

Referenced by find_users_name(), and init().

c_channel::$reops
 

Array of reop hints (IRCnet-specific).

Definition at line 195 of file library_php_2.inc.php.

Referenced by init().

c_channel::$topic
 

Channel's topic.

Definition at line 200 of file library_php_2.inc.php.

c_channel::$users
 

Array of c_user.

Definition at line 191 of file library_php_2.inc.php.


The documentation for this class was generated from the following file:
Generated on Sun Jul 24 16:21:26 2005 for Library for "php_2" scripting by  doxygen 1.4.3