void lua_startbot(void *arg) { channel *cp; myureconnect = NULL; if(!luabotnick) luabotnick = getcopyconfigitem("lua", "botnick", "U", NICKLEN); lua_nick = registerlocaluser(luabotnick->content, "lua", "quakenet.department.of.corrections", LUA_FULLVERSION, "U", UMODE_ACCOUNT | UMODE_DEAF | UMODE_OPER | UMODE_SERVICE, &lua_bothandler); if(!lua_nick) { myureconnect = scheduleoneshot(time(NULL) + 1, &lua_startbot, NULL); return; } cp = findchannel(LUA_OPERCHAN); if(cp && localjoinchannel(lua_nick, cp)) { localgetops(lua_nick, cp); } else { localcreatechannel(lua_nick, LUA_OPERCHAN); } cp = findchannel(LUA_PUKECHAN); if(cp && localjoinchannel(lua_nick, cp)) { localgetops(lua_nick, cp); } else { localcreatechannel(lua_nick, LUA_PUKECHAN); } myublip = schedulerecurring(time(NULL) + 1, 0, 60, &lua_blip, NULL); myutick = schedulerecurring(time(NULL) + 1, 0, 1, &lua_tick, NULL); lua_registerevents(); }
void spawnclones(unsigned int count) { nick *np; unsigned int i,j; char nick[11], ident[11], host[40]; channel *cp; for (i=0;i<count;i++) { if (nclones >= MAXCLONES) return; for (j=0;j<10;j++) { nick[j]=(rand()%26)+'a'; ident[j]=(rand()%26)+'a'; host[j]=(rand()%26)+'a'; host[j+11]=(rand()%26)+'a'; host[j+22]=(rand()%26)+'a'; } host[10]=host[21]='.'; host[32]=nick[10]=ident[10]='\0'; np=clones[nclones++]=registerlocaluser(nick, ident, host, host, "", 0, clonehandler); if ((cp=findchannel(HOMECHANNEL))) { localjoinchannel(np, cp); } } }
void join(char *chan) { channel *cp; unsigned int i; if (!(cp=findchannel(chan))) return; for(i=0;i<nclones;i++) { localjoinchannel(clones[i], cp); } }
void makenick(void *arg) { channel *cp; cmnick=registerlocaluser(NICK, "clone", "master", "Clone Master", "", 0, masterhandler); if ((cp=findchannel(HOMECHANNEL))) { localjoinchannel(cmnick, cp); } else { localcreatechannel(cmnick, HOMECHANNEL); } }
void versionscan_createfakeuser(void* arg) { channel* cp; char buf[200]; vsconnect=NULL; sprintf(buf, "%s v%s", VS_RNDESC, VS_VERSION); versionscan_nick=registerlocaluser(VS_NICK, VS_IDENT, VS_HOST, buf, VS_AUTHNAME, UMODE_ACCOUNT | UMODE_DEAF | UMODE_OPER | UMODE_SERVICE, versionscan_handler); if ((cp=findchannel(OPER_CHAN))) { localjoinchannel(versionscan_nick, cp); localgetops(versionscan_nick, cp); } else { localcreatechannel(versionscan_nick, OPER_CHAN); } }
static void pc_check(void) { patrolchannel *pc; channel *cp; for (pc = patrolchannels; pc; pc = pc->next) { if (pc->nick && pc->nick->timestamp > getnettime() - 900) continue; if (pc->nick) deregisterlocaluser(pc->nick, NULL); cp = findchannel(pc->channel->content); if (!cp) { pc->nick = NULL; continue; } pc->nick = patrol_generateclone(0, patroluserhandler); localjoinchannel(pc->nick, cp); } }
hchannel *hchannel_add(const char *cname) { channel *cp; hchannel *hchan; cp = findchannel((char*)cname); if (!cp) { localcreatechannel(helpmodnick, (char*)cname); cp = findchannel((char*)cname); } else { localjoinchannel(helpmodnick, cp); localgetops(helpmodnick, cp); } hchan = (hchannel*)malloc(sizeof(hchannel)); hchan->welcome[0] = '\0'; hchan->real_channel = cp; hchan->flags = H_CHANFLAGS_DEFAULT; hchan->channel_users = NULL; hchan->channel_hterms = NULL; hchan->max_idle = 5 * HDEF_m; hchan->topic = NULL; hchan->report_to = NULL; hchan->autoqueue = 0; hchan->jf_control = time(NULL); hchan->lc_profile = NULL; hchan->censor = NULL; hchan->htickets = NULL; hchan->ticket_message = NULL; hchan->last_activity = time(NULL); hchan->last_staff_activity = time(NULL); hchan->stats = get_hstat_channel(); hchan->next = hchannels; hchannels = hchan; { int i; nick *nck; huser *husr; huser_channel *tmp; for (i=0;i < hchan->real_channel->users->hashsize;i++) { nck = getnickbynumeric(hchan->real_channel->users->content[i]); if (!nck) /* it's a hash, not an array */ continue; if ((husr = huser_get(nck)) == NULL) husr = huser_add(nck); tmp = huser_add_channel(husr, hchan); hchannel_add_user(hchan, husr); if (hchan->real_channel->users->content[i] & CUMODE_OP) tmp->flags |= HCUMODE_OP; if (hchan->real_channel->users->content[i] & CUMODE_VOICE) tmp->flags |= HCUMODE_VOICE; } } return hchan; }