unrealircd- supernets unrealircd source & configuration |
git clone git://git.acid.vegas/unrealircd.git |
Log | Files | Refs | Archive | README | LICENSE |
cycle.c (1957B)
1 /* 2 * Unreal Internet Relay Chat Daemon, src/modules/cycle.c 3 * (C) 2000-2001 Carsten V. Munk and the UnrealIRCd Team 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 1, or (at your option) 8 * any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 */ 19 20 #include "unrealircd.h" 21 22 CMD_FUNC(cmd_cycle); 23 24 /* Place includes here */ 25 #define MSG_CYCLE "CYCLE" 26 27 ModuleHeader MOD_HEADER 28 = { 29 "cycle", /* Name of module */ 30 "5.0", /* Version */ 31 "command /cycle", /* Short description of module */ 32 "UnrealIRCd Team", 33 "unrealircd-6", 34 }; 35 36 /* This is called on module init, before Server Ready */ 37 MOD_INIT() 38 { 39 CommandAdd(modinfo->handle, MSG_CYCLE, cmd_cycle, MAXPARA, CMD_USER); 40 MARK_AS_OFFICIAL_MODULE(modinfo); 41 return MOD_SUCCESS; 42 } 43 44 /* Is first run when server is 100% ready */ 45 MOD_LOAD() 46 { 47 return MOD_SUCCESS; 48 49 } 50 51 /* Called when module is unloaded */ 52 MOD_UNLOAD() 53 { 54 return MOD_SUCCESS; 55 } 56 57 /* 58 * cmd_cycle() - Stskeeps 59 * parv[1] = channels 60 */ 61 62 CMD_FUNC(cmd_cycle) 63 { 64 char channels[BUFSIZE]; 65 const char *parx[3]; 66 int n; 67 68 if (parc < 2) 69 return; 70 71 /* First PART the user... */ 72 parv[2] = "cycling"; 73 strlcpy(channels, parv[1], sizeof(channels)); 74 do_cmd(client, recv_mtags, "PART", 3, parv); 75 if (IsDead(client)) 76 return; 77 78 /* Then JOIN the user again... */ 79 parx[0] = NULL; 80 parx[1] = channels; 81 parx[2] = NULL; 82 do_cmd(client, recv_mtags, "JOIN", 2, parx); 83 }