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 168 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 210 of file library_php_2.inc.php.

00211     {
00212         foreach($this->users as $e)
00213             if($e->nick==$user->nick)
00214                 return;
00215         array_push($this->users,$user);
00216     }

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 304 of file library_php_2.inc.php.

00305     {
00306         $res=array();
00307         foreach($this->users as $e) {
00308             if($e->host_bot)
00309                 array_push($res,$e);
00310         }
00311         return $res;
00312     }

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 269 of file library_php_2.inc.php.

00270     {
00271         $res=array();
00272         foreach($this->users as $e) {
00273             if($e->irc_op)
00274                 array_push($res,$e);
00275         }
00276         return $res;
00277     }

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 323 of file library_php_2.inc.php.

00324     {
00325         if(strlen($mode)!=1) {
00326             echo "Error: c_channel::find_mode() argument \$mode should be string one-character long. It is: \"".$mode."\"\n";
00327             return array();
00328         }
00329         $res=array();
00330         foreach($this->users as $e) {
00331             if(($plus && strpos($e->mode,$mode)!==FALSE) || (!$plus && strpos($e->mode,$mode)===FALSE))
00332                 array_push($res,$e);
00333         }
00334         return $res;
00335     }

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 286 of file library_php_2.inc.php.

00287     {
00288         $res=array();
00289         foreach($this->users as $e) {
00290             if($e->host_unknown)
00291                 array_push($res,$e);
00292         }
00293         return $res;
00294     }

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 253 of file library_php_2.inc.php.

00254     {
00255         foreach($this->users as $e) {
00256             if((!$ignore_case && $e->nick==$nick) || ($ignore_case && strtolower($e->nick)==strtolower($nick)))
00257                 return $e;
00258         }
00259         return NULL;
00260     }

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 229 of file library_php_2.inc.php.

References $name.

00230     {
00231         if(!$want_online && !$want_offline) {
00232             echo "Warning: ".__CLASS__."::".__FUNCTION__."() three-state logic issue: Do we want online, offline, or both? You want none!\n";
00233             return array(); // optimization: it is not needed to continue
00234         }
00235         $res=array();
00236         foreach($this->users as $e) {
00237             if((($want_online && $e->online) || ($want_offline && !$e->online)) && ((!$ignore_case && $e->name==$name) || ($ignore_case && strtolower($e->name)==strtolower($name))))
00238                 array_push($res,$e);
00239         }
00240         return $res;
00241     }

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 192 of file library_php_2.inc.php.

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

00193     {
00194         $this->name=$name;
00195         $this->users=array();
00196         $this->bans=$bans;
00197         $this->exceptions=$exceptions;
00198         $this->invites=$invites;
00199         $this->reops=$reops;
00200     }


Member Data Documentation

c_channel::$bans
 

Array of ban masks.

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

Referenced by init().

c_channel::$exceptions
 

Array of exceptions (to bans).

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

Referenced by init().

c_channel::$invites
 

Array of invites.

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

Referenced by init().

c_channel::$key
 

Key for the channel, or an empty string.

Definition at line 176 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 177 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 178 of file library_php_2.inc.php.

c_channel::$name
 

Channel name.

Definition at line 169 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 174 of file library_php_2.inc.php.

Referenced by init().

c_channel::$topic
 

Channel's topic.

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

c_channel::$users
 

Array of c_user.

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


The documentation for this class was generated from the following file:
Generated on Wed Jun 15 01:58:38 2005 for Library for "php_2" scripting by  doxygen 1.4.3