The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download | Blog | Stats
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

cmd_restart Class Reference

Handle /RESTART. More...

#include <cmd_restart.h>

Inheritance diagram for cmd_restart:

Inheritance graph
[legend]
Collaboration diagram for cmd_restart:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 cmd_restart (InspIRCd *Instance)
 Constructor for restart.
CmdResult Handle (const char **parameters, int pcnt, userrec *user)
 Handle command.

Detailed Description

Handle /RESTART.

These command handlers can be reloaded by the core, and handle basic RFC1459 commands. Commands within modules work the same way, however, they can be fully unloaded, where these may not.

Definition at line 30 of file cmd_restart.h.


Constructor & Destructor Documentation

cmd_restart::cmd_restart InspIRCd Instance  )  [inline]
 

Constructor for restart.

Definition at line 35 of file cmd_restart.h.

References command_t::syntax.

00035 : command_t(Instance,"RESTART",'o',1) { syntax = "<password>"; }


Member Function Documentation

CmdResult cmd_restart::Handle const char **  parameters,
int  pcnt,
userrec user
[virtual]
 

Handle command.

Parameters:
parameters The parameters to the comamnd
pcnt The number of parameters passed to teh command
user The user issuing the command
Returns:
A value from CmdResult to indicate command success or failure.

Implements command_t.

Definition at line 24 of file cmd_restart.cpp.

References CMD_FAILURE, CMD_SUCCESS, InspIRCd::Config, DEFAULT, connection::host, userrec::ident, InspIRCd::Log(), userrec::nick, InspIRCd::Restart(), ServerConfig::restartpass, command_t::ServerInstance, and InspIRCd::WriteOpers().

00025 {
00026         ServerInstance->Log(DEFAULT,"Restart: %s",user->nick);
00027         if (!strcmp(parameters[0],ServerInstance->Config->restartpass))
00028         {
00029                 ServerInstance->WriteOpers("*** RESTART command from %s!%s@%s, restarting server.",user->nick,user->ident,user->host);
00030 
00031                 try
00032                 {
00033                         ServerInstance->Restart("Server restarting.");
00034                 }
00035                 catch (...)
00036                 {
00037                         /* We dont actually get here unless theres some fatal and unrecoverable error. */
00038                         exit(0);
00039                 }
00040         }
00041         else
00042         {
00043                 ServerInstance->WriteOpers("*** Failed RESTART Command from %s!%s@%s.",user->nick,user->ident,user->host);
00044                 return CMD_FAILURE;
00045         }
00046 
00047         return CMD_SUCCESS;
00048 }


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