diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-06 10:43:34 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-06 10:43:34 +0000 |
commit | 1d994c544474da53159257d9097997c0744a48a5 (patch) | |
tree | 1933ef85eb507645ed17f32ed5d69cd1fc2e3cb2 /src/inspircd.cpp | |
parent | d4bcf45eb3ef838d878971dbcd585510729fcff1 (diff) |
Added support for SVS-style Server class methods for modules
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@400 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r-- | src/inspircd.cpp | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 78d84c22e..1e4a8abc3 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -1298,10 +1298,9 @@ int usercount(chanrec *c) /* add a channel to a user, creating the record for it if needed and linking * it to the user record */ -chanrec* add_channel(userrec *user, char* cname, char* key) +chanrec* add_channel(userrec *user, const char* cn, const char* key) { - - if ((!user) || (!cname)) + if ((!user) || (!cn)) { log(DEFAULT,"*** BUG *** add_channel was given an invalid parameter"); return 0; @@ -1310,6 +1309,9 @@ chanrec* add_channel(userrec *user, char* cname, char* key) int i = 0; chanrec* Ptr; int created = 0; + char cname[MAXBUF]; + + strncpy(cname,cn,MAXBUF); // we MUST declare this wherever we use FOREACH_RESULT int MOD_RESULT = 0; @@ -1482,7 +1484,7 @@ chanrec* add_channel(userrec *user, char* cname, char* key) /* remove a channel from a users record, and remove the record from memory * if the channel has become empty */ -chanrec* del_channel(userrec *user, char* cname, char* reason) +chanrec* del_channel(userrec *user, const char* cname, const char* reason) { if ((!user) || (!cname)) { @@ -3155,9 +3157,13 @@ void handle_restart(char **parameters, int pcnt, userrec *user) } -void kill_link(userrec *user,char* reason) +void kill_link(userrec *user,const char* r) { user_hash::iterator iter = clientlist.find(user->nick); + + char reason[MAXBUF]; + + strncpy(reason,r,MAXBUF); if (strlen(reason)>MAXQUIT) { @@ -4470,7 +4476,7 @@ void handle_oper(char **parameters, int pcnt, userrec *user) WriteServ(user->fd,"491 %s :Invalid oper credentials",user->nick); WriteOpers("*** WARNING! Failed oper attempt by %s!%s@%s!",user->nick,user->ident,user->host); } - + void handle_nick(char **parameters, int pcnt, userrec *user) { if (pcnt < 1) @@ -4549,6 +4555,27 @@ void handle_nick(char **parameters, int pcnt, userrec *user) log(DEBUG,"exit nickchange: %s",user->nick); } +void force_nickchange(userrec* user,const char* newnick) +{ + char nick[MAXBUF]; + strcpy(nick,""); + + if (user) + { + if (newnick) + { + strncpy(nick,newnick,MAXBUF); + } + if (user->registered == 7) + { + char* pars[1]; + pars[0] = nick; + handle_nick(pars,1,user); + } + } +} + + int process_parameters(char **command_p,char *parameters) { int i = 0; |