summaryrefslogtreecommitdiff
path: root/src/modules/m_sajoin.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-16 18:23:50 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-16 18:23:50 +0000
commitab9d8fd1af3ebf028506ec543f74fd13471742dd (patch)
treed95fd9303718109daa304bd602dc69af1ebb1b05 /src/modules/m_sajoin.cpp
parent293df6a8b55e89c127e60e92711ef0ef1027bff8 (diff)
Porting to new command system
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2535 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_sajoin.cpp')
-rw-r--r--src/modules/m_sajoin.cpp56
1 files changed, 33 insertions, 23 deletions
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp
index 553211c60..bbf683226 100644
--- a/src/modules/m_sajoin.cpp
+++ b/src/modules/m_sajoin.cpp
@@ -25,43 +25,53 @@ using namespace std;
/* $ModDesc: Provides support for unreal-style SAJOIN command */
Server *Srv;
-
-void handle_sajoin(char **parameters, int pcnt, userrec *user)
+
+class cmd_sajoin : public command_t
{
- userrec* dest = Srv->FindNick(std::string(parameters[0]));
- if (dest)
+ public:
+ cmd_sajoin() : command_t("SAJOIN", 'o', 2)
{
- /* might be nicer to make checking valid channel names an api function sometime --w00t */
- if (parameters[1][0] != '#')
- {
- /* we didn't need to check this for each character ;) */
- Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
- return;
- }
+ this->source = "m_sajoin.cpp";
+ }
- for (unsigned int x = 0; x < strlen(parameters[1]); x++)
+ void Handle (char **parameters, int pcnt, userrec *user)
+ {
+ userrec* dest = Srv->FindNick(std::string(parameters[0]));
+ if (dest)
{
- if ((parameters[1][x] == ' ') || (parameters[1][x] == ','))
- {
- Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
- return;
- }
- }
+ /* might be nicer to make checking valid channel names an api function sometime --w00t */
+ if (parameters[1][0] != '#')
+ {
+ /* we didn't need to check this for each character ;) */
+ Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
+ return;
+ }
- Srv->SendOpers(std::string(user->nick)+" used SAJOIN to make "+std::string(dest->nick)+" join "+parameters[1]);
- Srv->JoinUserToChannel(dest,std::string(parameters[1]),std::string(dest->nick));
- }
-}
+ for (unsigned int x = 0; x < strlen(parameters[1]); x++)
+ {
+ if ((parameters[1][x] == ' ') || (parameters[1][x] == ','))
+ {
+ Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
+ return;
+ }
+ }
+ Srv->SendOpers(std::string(user->nick)+" used SAJOIN to make "+std::string(dest->nick)+" join "+parameters[1]);
+ Srv->JoinUserToChannel(dest,std::string(parameters[1]),std::string(dest->nick));
+ }
+ }
+};
class ModuleSajoin : public Module
{
+ cmd_sajoin* mycommand;
public:
ModuleSajoin(Server* Me)
: Module::Module(Me)
{
Srv = Me;
- Srv->AddCommand("SAJOIN",handle_sajoin,'o',2,"m_sajoin.so");
+ mycommand = new cmd_sajoin();
+ Srv->AddCommand(mycommand);
}
virtual ~ModuleSajoin()