Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

timer.c File Reference

#include "services.h"
#include "mass.h"
#include <time.h>

Go to the source code of this file.

Classes

struct  t_chain
 Timer list item. More...

struct  t_table
 Element of the timer function name table. More...


Functions

void autoremoveakill (char *mask)
 Handles automatic removal of expired akills by OperServ.

void killide (char *)
void delTimedGhost (char *)
 Handle expiration of a NickServ ghost timer by removing the enforcer.

void deleteTimedGhostChannel (char *)
void flushLogs (char *)
 Flush services logs.

int timer (long seconds, void(*func)(char *), void *args)
 Schedules a timer.

int cancel_timer (int tid)
 Cancels a timer event.

void timeralarm (void)
 Check for expired timers.

void dumptimer (char *from)
 Reports the list of timers.


Variables

t_table tt []
int curtid = 0
t_chainfirstTimerItem = NULL
 First item in the list of timers.


Detailed Description

Implementation of services timed events

Definition in file timer.c.


Function Documentation

void autoremoveakill char *  mask  ) 
 

Handles automatic removal of expired akills by OperServ.

Parameters:
mask Mask to be removed
Warning: this function calls free() on the mask passed

Definition at line 857 of file akill.c.

References mask(), OperServ, and removeAkill().

Referenced by addakill(), and loadakills().

int cancel_timer int  tid  ) 
 

Cancels a timer event.

Parameters:
tid Identifier of the timer to cancel
Destroys a timer prematurely, preventing the timed event from firing later

Definition at line 200 of file timer.c.

References firstTimerItem, and t_chain::next.

Referenced by removeAkill(), and removeAkillType().

void delTimedGhost char *  ghost  ) 
 

Handle expiration of a NickServ ghost timer by removing the enforcer.

Parameters:
ghost Nickname of timed ghost
Side Effects:
the supplied ghost pointer value is freed
Precondition:
Ghost is a pointer to a valid NUL-terminated character array bearing a legal IRC nickname.
Postcondition:
delGhost() was called with the supplied value for 'ghost' to remove an enforcer if it was present, AND the memory pointed to by 'ghost' was freed.

Definition at line 1898 of file nickserv.c.

Referenced by addNewUser(), changeNick(), checkAkillAllUsers(), and parseLine().

void dumptimer char *  from  ) 
 

Reports the list of timers.

Parameters:
from Nickname that timer list is to be sent to
Causes services to transmit the status of the timer list to the specified nickname.

This is part of the debug command /OPERSERV TIMERS

Definition at line 268 of file timer.c.

References firstTimerItem, t_table::func, t_chain::next, OperServ, and sSend().

void flushLogs char *   ) 
 

Flush services logs.

Performs a 'flush' on the log files resulting in any new services log messages being written to disk

Definition at line 103 of file signal.c.

References corelog, SLogfile::flush(), flushLogs(), and timer().

Referenced by ConnectToServer(), and parseLine().

int timer long  seconds,
void(*  func)(char *),
void *  args
 

Schedules a timer.

Parameters:
seconds How long (in seconds) to wait before executing the function
func A pointer to the function to execute of type void (*)(char *)
args This string is passed to the function when it is executed
This function creates and adds a timer structure to the list saying that the specified function should be executed.

Warning:
The function called by timer is expected to free the string passed to it. This is irregular memory management, however, so the free of that string should be clearly marked so that it can be removed in the future, when this behavior may change. Functions called should also take that change probability into consideration.

Definition at line 125 of file timer.c.

References firstTimerItem, myname, t_chain::next, oalloc(), t_chain::prev, t_chain::run, sSend(), and t_chain::tid.

Referenced by addakill(), addNewUser(), addUserToChan(), annoyNickThief(), changeNick(), checkAkillAllUsers(), checkTusers(), expireChans(), flushLogs(), killide(), loadakills(), main(), parseLine(), sync_cfg(), timed_advert_maint(), and timed_akill_queue().

void timeralarm void   ) 
 

Check for expired timers.

Checks for timers that are expired, runs the specified function on those timers and removes them from the timer list.

Side Effects:
inherits side-effects from any function placed on a timer

Definition at line 236 of file timer.c.

References t_chain::args, firstTimerItem, t_chain::func, t_chain::next, t_chain::prev, and t_chain::run.

Referenced by main().


Variable Documentation

struct t_table tt[] [static]
 

Initial value:

 {
  { "autoremoveakill",         autoremoveakill },
  { "killide",                 killide },
  { "delTimedGhost",           delTimedGhost },
  { "deleteTimedGhostChannel", deleteTimedGhostChannel },
  { "timed_akill_queue",       timed_akill_queue },
  { "timed_advert_maint",      timed_advert_maint },
  { "sync_cfg",                sync_cfg },
  { "expireNicks",             expireNicks },
  { "expireChans",             expireChans },
  { "checkTusers",             checkTusers },
  { "flushLogs",               flushLogs }
}

Definition at line 64 of file timer.c.


Generated at Sat Oct 25 20:56:12 2003 for Services using Doxygen.
Services Copyr. 1996-2001 Chip Norkus, Max Byrd, Greg Poma, Michael Graff, James Hess, Dafydd James. All rights reserved See LICENSE for licensing information.