bool Daemon_Singleton::start() { // initialize log if (isLogging) { if (isDaemon) { std::string logfile_path = IsService () ? "/var/log" : i2p::util::filesystem::GetDataDir().string(); #ifndef _WIN32 logfile_path.append("/i2pd.log"); #else logfile_path.append("\\i2pd.log"); #endif StartLog (logfile_path); } else StartLog (""); // write to stdout } d.httpServer = new i2p::util::HTTPServer(i2p::util::config::GetArg("-httpport", 7070)); d.httpServer->Start(); LogPrint("HTTP Server started"); i2p::data::netdb.Start(); LogPrint("NetDB started"); i2p::transport::transports.Start(); LogPrint("Transports started"); i2p::tunnel::tunnels.Start(); LogPrint("Tunnels started"); i2p::client::context.Start (); LogPrint("Client started"); return true; }
Result<ExitCode> SelfTest::Run(const Settings& settings) const { auto statisticResult = GetStatistic(settings); if (statisticResult.HasError()) { return statisticResult.GetError(); } auto statistic = statisticResult.GetResultValue(); if (statistic.IsService()) { if (!statistic.HasAdministrativePrivileges()) { return EXIT_CODE_NO_ADMIN; } if (!statistic.HasSeAssignPrimaryTokenPrivilege()) { return EXIT_CODE_NO_ASSIGN_PRIMARY_TOKEN_PRIV; } if (!statistic.HasSeTcbPrivilegePrivilege()) { return EXIT_CODE_NO_TCB_PRIV; } } return Is64OS() ? EXIT_CODE_READY_FOR_64 : EXIT_CODE_READY_FOR_32; }
void DIALRecord::IsService(bool value) { if(value) DATA.value = eService; else if(IsService()) DATA.value = eTopic; }
static int do_chghost(struct Client *source_p, struct Client *target_p, const char *newhost, int is_encap) { if (!clean_host(newhost)) { sendto_realops_snomask(SNO_GENERAL, is_encap ? L_ALL : L_NETWIDE, "%s attempted to change hostname for %s to %s (invalid)", IsServer(source_p) ? source_p->name : get_oper_name(source_p), target_p->name, newhost); /* sending this remotely may disclose important * routing information -- jilles */ if (is_encap ? MyClient(target_p) : !ConfigServerHide.flatten_links) sendto_one_notice(target_p, ":*** Notice -- %s attempted to change your hostname to %s (invalid)", source_p->name, newhost); return 0; } change_nick_user_host(target_p, target_p->name, target_p->username, newhost, 0, "Changing host"); if (irccmp(target_p->host, target_p->orighost)) { SetDynSpoof(target_p); if (MyClient(target_p)) sendto_one_numeric(target_p, RPL_HOSTHIDDEN, "%s :is now your hidden host (set by %s)", target_p->host, source_p->name); } else { ClearDynSpoof(target_p); if (MyClient(target_p)) sendto_one_numeric(target_p, RPL_HOSTHIDDEN, "%s :hostname reset by %s", target_p->host, source_p->name); } if (MyClient(source_p)) sendto_one_notice(source_p, ":Changed hostname for %s to %s", target_p->name, target_p->host); if (!IsServer(source_p) && !IsService(source_p)) sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s changed hostname for %s to %s", get_oper_name(source_p), target_p->name, target_p->host); return 1; }
virtual DWORD OnStart() { if (OneInstance()) { Stop(); return -1; } AddWindowFireWall(); if (IsService()) ChangeConfig(); else { CWin32Svr::StopService(_T("i8vdisksvr")); CWin32Svr::RemoveService(_T("i8vdisksvr")); } CreateTimerQueueTimer(&hTimer, NULL, TimerRoutine, this, 5000, 1000, 0); m_pLogger->SetLogFileName(LOG_FILENAME); m_pLogger->SetAddDateBefore(false); m_pLogger->WriteLog(i8desk::LM_INFO, TEXT("=================================================================")); m_pLogger->SetAddDateBefore(true); m_pLogger->WriteLog(i8desk::LM_INFO, TEXT("Start I8VDisk Service...")); if (!m_pPlugMgr->Start()) { m_pLogger->WriteLog(i8desk::LM_INFO, TEXT("start plugmgr fail.")); Stop(); return ERROR_SUCCESS; } HideDosWindow(); return ERROR_SUCCESS; }
void checkServer(struct Client *sptr, struct Client *acptr) { char outbuf[BUFSIZE]; /* Header */ send_reply(sptr, RPL_DATASTR, " "); send_reply(sptr, RPL_CHKHEAD, "server", acptr->cli_name); send_reply(sptr, RPL_DATASTR, " "); ircd_snprintf(0, outbuf, sizeof(outbuf), " Connected at:: %s (%Tu)", myctime(acptr->cli_serv->timestamp), acptr->cli_serv->timestamp); send_reply(sptr, RPL_DATASTR, outbuf); ircd_snprintf(0, outbuf, sizeof(outbuf), " Server name:: %s", acptr->cli_name); send_reply(sptr, RPL_DATASTR, outbuf); if (cli_sslclifp(acptr) && (strlen(cli_sslclifp(acptr)) > 0)) { ircd_snprintf(0, outbuf, sizeof(outbuf), "SSL Fingerprint:: %s", cli_sslclifp(acptr)); send_reply(sptr, RPL_DATASTR, outbuf); } ircd_snprintf(0, outbuf, sizeof(outbuf), " Numeric:: %s --> %d", NumServ(acptr), base64toint(acptr->cli_yxx)); send_reply(sptr, RPL_DATASTR, outbuf); ircd_snprintf(0, outbuf, sizeof(outbuf), " Users:: %d / %d", (acptr == &me) ? UserStats.local_clients : cli_serv(acptr)->clients, base64toint(cli_serv(acptr)->nn_capacity)); send_reply(sptr, RPL_DATASTR, outbuf); if (IsBurst(acptr)) send_reply(sptr, RPL_DATASTR, " Status:: Bursting"); else if (IsBurstAck(acptr)) send_reply(sptr, RPL_DATASTR, " Status:: Awaiting EOB Ack"); else if (IsService(acptr)) send_reply(sptr, RPL_DATASTR, " Status:: Network Service"); else if (IsHub(acptr)) send_reply(sptr, RPL_DATASTR, " Status:: Network Hub"); ircd_snprintf(0, outbuf, sizeof(outbuf), " Class:: %s", get_client_class(acptr)); send_reply(sptr, RPL_DATASTR, outbuf); if (feature_bool(FEAT_CHECK_EXTENDED)) { int dlinkc = 0; struct DLink* slink = NULL; send_reply(sptr, RPL_DATASTR, " "); send_reply(sptr, RPL_DATASTR, "Downlinks::"); for (slink = cli_serv(acptr)->down; slink; slink = slink->next) { ircd_snprintf(0, outbuf, sizeof(outbuf), "[%d] - %s%s", ++dlinkc, IsBurst(slink->value.cptr) ? "*" : IsBurstAck(slink->value.cptr) ? "!" : IsService(slink->value.cptr) ? "=" : IsHub(slink->value.cptr) ? "+" : " ", cli_name(slink->value.cptr)); send_reply(sptr, RPL_DATASTR, outbuf); } if (!dlinkc) send_reply(sptr, RPL_DATASTR, "<none>"); } /* Send 'END OF CHECK' message */ send_reply(sptr, RPL_ENDOFCHECK, " "); }
/* ** m_svsguest() ** parv[0] = sender ** parv[1] = target nick ** parv[2] = guest prefix ** parv[3] = max guest number (9999) ** */ int m_svsguest(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { int randnum; int maxnum; int scount; /* search count */ char guestnick[NICKLEN]; struct Client* acptr; /* Check if received from services */ if(!IsServer(cptr) || !IsService(sptr)) { if (IsServer(cptr)) { ts_warn("Got SVSGUEST from non-service: %s", sptr->name); sendto_one(cptr, ":%s WALLOPS :ignoring SVSGUEST from non-service %s", me.name, sptr->name); } return 0; } if( parc < 4 ) /* Check for arguments count */ { ts_warn("Invalid SVSGUEST (%s) from %s", (parc==2 ) ? parv[1]: "-", parv[0]); return 0; } if ((acptr = find_person(parv[1], NULL)) && MyClient(acptr)) /* person found connected here */ { maxnum = atoi(parv[3]); randnum = 1+ (random() % (maxnum+1)); snprintf(guestnick, NICKLEN, "%s%d", parv[2], randnum); scount = 0; while((scount++<maxnum+1) && find_client(guestnick, (aClient *)NULL)) { randnum = 1+ (random() % (maxnum+1)); snprintf(guestnick, NICKLEN, "%s%d", parv[2], randnum); } if(scount<maxnum+1) /* check if we reached max guests count */ { change_nick(acptr, guestnick); } else exit_client(acptr, acptr, &me, "Maximum guests count reached!!!"); } else if (acptr) /* nick was found but is not our client */ { if ( (acptr->from != cptr)) /* this should never happen */ sendto_one(acptr, ":%s SVSGUEST %s %s %s", parv[0], parv[1], parv[2], parv[3]); } return 0; }
/* ** check_registered_service cancels message, if 'x' is not ** a registered service. */ int check_registered_service(aClient *sptr) { if (!IsService(sptr)) { sendto_one(sptr, replies[ERR_NOTREGISTERED], ME, "*"); return -1; } return 0; }
static int specialuseronhost(host *hp) { nick *np; for (np = hp->nicks; np; np = np->nextbyhost) if (IsOper(np) || IsService(np) || IsXOper(np) || NickOnServiceServer(np)) return 1; return 0; }
int csc_dorecover(void *source, int cargc, char **cargv) { nick *sender=source,*np; reguser *rup; regchanuser *rcup; regchan *rcp; chanindex *cip; unsigned long *lp; int i; modechanges changes; if (cargc<1) { chanservstdmessage(sender, QM_NOTENOUGHPARAMS, "recover"); return CMD_ERROR; } if (!(cip=cs_checkaccess(sender, cargv[0], CA_MASTERPRIV, NULL, "recover",0, 0))) return CMD_ERROR; rcp=cip->exts[chanservext]; if (cip->channel) { localsetmodeinit(&changes, cip->channel, chanservnick); /* clearchan */ localdosetmode_key(&changes, NULL, MCB_DEL); localdosetmode_simple(&changes, 0, cip->channel->flags); cs_docheckchanmodes(cip->channel, &changes); /* unbanall */ while (cip->channel->bans) { localdosetmode_ban(&changes, bantostring(cip->channel->bans), MCB_DEL); } /* remove the registered bans that match on me */ cs_unbanfn(sender, cip, nickmatchban_peerthroughhidehost, sender, 1, 0); /* deopall */ for (i=0,lp=cip->channel->users->content; i<cip->channel->users->hashsize;i++,lp++) { if (*lp!=nouser && (*lp & CUMODE_OP)) { if (!(np=getnickbynumeric(*lp)) || (!IsService(np) && (!(rup=getreguserfromnick(np)) || !(rcup=findreguseronchannel(rcp, rup)) || !(CUHasOpPriv(rcup)) || !(CUIsProtect(rcup) || CIsProtect(rcp))))) { localdosetmode_nick(&changes, np, MC_DEOP); } } } localsetmodeflush(&changes, 1); } cs_log(sender,"RECOVER %s",cip->name->content); chanservstdmessage(sender, QM_DONE); return CMD_OK; }
static int sasl_visible(struct Client *client_p) { struct Client *agent_p = NULL; if (ConfigFileEntry.sasl_service) agent_p = find_named_client(ConfigFileEntry.sasl_service); return agent_p != NULL && IsService(agent_p); }
static int glineuser(glinebuf *gbuf, nick *np, struct gline_localdata *localdata, time_t ti) { char msgbuf[512]; if (!IsOper(np) && !IsService(np) && !IsXOper(np)) { nssnprintf(msgbuf, sizeof(msgbuf), localdata->reason, np); glinebufaddbynick(gbuf, np, 0, "newsearch", msgbuf, getnettime() + localdata->duration, getnettime(), getnettime() + localdata->duration); return 1; } return 0; }
status_t Job::Execute() { status_t status = B_OK; if (!IsLaunched() || !IsService()) status = Launch(); fLaunching = false; return status; }
/* ** m_zombies() by openglx ** ** m_ircops() By Claudio ** Rewritten by HAMLET ** Lists online IRCOps ** */ int m_zombies(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { struct Client *acptr; char buf[BUFSIZE]; int zombies = 0; if (!IsPrivileged(cptr)) { sendto_one(sptr, form_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; } strcpy(buf, "========================================================================================"); sendto_one(sptr, form_str(RPL_LISTS), me.name, parv[0], buf); strcpy(buf, "\2Nick Hostname Server\2"); sendto_one(sptr, form_str(RPL_LISTS), me.name, parv[0], buf); strcpy(buf, "----------------------------------------------------------------------------------------"); sendto_one(sptr, form_str(RPL_LISTS), me.name, parv[0], buf); for (acptr = GlobalClientList; acptr; acptr = acptr->next) { if (!IsService(acptr) && !IsStealth(acptr) && IsZombie(acptr)) { if (!acptr->user) continue; /* vlinks on /IRCops * code by openglx * idea to this by Midnight_Commander */ if (acptr->user && acptr->user->vlink) { ircsprintf(buf, "\2%-29s\2 %s@%s %s", acptr->name ? acptr->name : "<unknown>", acptr->username, acptr->realhost, acptr->user->vlink->name); } else { ircsprintf(buf, "\2%-29s\2 %-23s %s@%s", acptr->name ? acptr->name : "<unknown>", acptr->username, acptr->realhost, acptr->user->server); } /* end of the vlink support code */ sendto_one(sptr, form_str(RPL_LISTS), me.name, parv[0], buf); sendto_one(sptr, form_str(RPL_LISTS), me.name, parv[0], "-"); zombies++; } } ircsprintf(buf, "Total: \2%d\2 Zombie%s connected", zombies, zombies > 1 ? "s" : ""); sendto_one(sptr, form_str(RPL_LISTS), me.name, parv[0], buf); strcpy(buf, "========================================================================================"); sendto_one(sptr, form_str(RPL_LISTS), me.name, parv[0], buf); sendto_one(sptr, form_str(RPL_ENDOFLISTS), me.name, parv[0], "ZOMBIES"); return 0; }
status_t Job::Run() { status_t status = BJob::Run(); // TODO: monitor team, don't just do this if (!IsService()) SetState(B_JOB_STATE_WAITING_TO_RUN); return status; }
status_t Job::Run() { status_t status = BJob::Run(); // Jobs can be relaunched at any time if (!IsService()) SetState(B_JOB_STATE_WAITING_TO_RUN); return status; }
void Job::TeamDeleted() { fTeam = -1; fDefaultPort = -1; if (IsService()) SetState(B_JOB_STATE_WAITING_TO_RUN); MutexLocker locker(fLaunchStatusLock); fLaunchStatus = B_NO_INIT; }
status_t Job::Execute() { status_t status = B_OK; if (!IsRunning() || !IsService()) status = Launch(); else debug_printf("Ignore launching %s\n", Name()); fLaunching = false; return status; }
static int me_sasl(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { struct Client *target_p, *agent_p; /* Let propagate if not addressed to us, or if broadcast. * Only SASL agents can answer global requests. */ if(strncmp(parv[2], me.id, 3)) return 0; if((target_p = find_id(parv[2])) == NULL) return 0; if(target_p->preClient == NULL) return 0; if((agent_p = find_id(parv[1])) == NULL) return 0; if(source_p != agent_p->servptr) /* WTF?! */ return 0; /* We only accept messages from SASL agents; these must have umode +S * (so the server must be listed in a service{} block). */ if(!IsService(agent_p)) return 0; /* Reject if someone has already answered. */ if(*target_p->preClient->sasl_agent && strncmp(parv[1], target_p->preClient->sasl_agent, IDLEN)) return 0; else if(!*target_p->preClient->sasl_agent) rb_strlcpy(target_p->preClient->sasl_agent, parv[1], IDLEN); if(*parv[3] == 'C') sendto_one(target_p, "AUTHENTICATE %s", parv[4]); else if(*parv[3] == 'D') { if(*parv[4] == 'F') sendto_one(target_p, form_str(ERR_SASLFAIL), me.name, EmptyString(target_p->name) ? "*" : target_p->name); else if(*parv[4] == 'S') { sendto_one(target_p, form_str(RPL_SASLSUCCESS), me.name, EmptyString(target_p->name) ? "*" : target_p->name); target_p->preClient->sasl_complete = 1; ServerStats.is_ssuc++; } *target_p->preClient->sasl_agent = '\0'; /* Blank the stored agent so someone else can answer */ } return 0; }
static void reconnectfakeuser(void *arg) { fakeuser *fake = arg; nick *user; if (fake->user) return; if ((user = getnickbynick(fake->nick)) && (IsOper(user) || IsService(user) || IsXOper(user))) { fake_remove(fake); return; } fake->user = registerlocaluser(fake->nick, fake->ident, fake->host, fake->realname, NULL, UMODE_INV | UMODE_DEAF, &fakeuser_handler); }
/* * m_sxline() - add info ban line * * parv[0] = sender prefix * parv[1] = info banned mask */ int m_sxline(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) { aConfItem *aconf; char *reason = NULL; char *mask; int len; if (!IsService(sptr) && !IsServer(cptr)) { sendto_one(sptr, form_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; } if(parc<3) { sendto_one(sptr, form_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "SXLINE"); return 0; } len=atoi(parv[1]); mask = parv[2]; if ((strlen(mask) > len) && (mask[len])==':') { mask[len] = '\0'; reason = mask+len+1; } else { /* Bogus */ return 0; } if (!find_sxline(mask)) /* sxline does not exist */ { aconf = make_conf(); DupString(aconf->name, mask); DupString(aconf->passwd, reason); aconf->next = sxlines; sxlines = aconf; sendto_serv_butone(cptr, ":%s SXLINE %d :%s:%s", sptr->name, len, aconf->name,aconf->passwd); } return 0; }
// Fonctions communes DWORD CMySql::Restart() { DWORD dwRetour = ERROR_SUCCESS; if (IsService()) dwRetour = CUtils::StopThisService(m_hServiceHandle); else { if ((dwRetour = Stop()) == ERROR_SUCCESS) dwRetour = Start(); } SetQueryRestart(true); return dwRetour; }
int _tmain( int, LPTSTR* ) { SERVICE_TABLE_ENTRY DispatchTable[] = { { SERVICENAME, xCmdStart }, { NULL, NULL } }; BOOL bService = TRUE; // This process should be a service :) IsService( bService ); if ( !bService ) _tprintf( _T("This is a service executable! Couldn't start directly.\n") ); // Start service return StartServiceCtrlDispatcher( DispatchTable); }
/* * m_svinfo - SVINFO message handler * parv[0] = sender prefix * parv[1] = TS_CURRENT for the server * parv[2] = TS_MIN for the server * parv[3] = clock ts */ int m_svinfo(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) { aConfItem *aconf; time_t remote_ts = 0; struct Client *acptr; if (MyConnect(sptr) && IsUnknown(sptr)) return exit_client(sptr, sptr, sptr, "Need SERVER before SVINFO"); if (!IsServer(sptr) || !MyConnect(sptr) || parc < 3) return 0; if (TS_CURRENT < atoi(parv[2]) || atoi(parv[1]) < TS_MIN) { /* * a server with the wrong TS version connected; since we're * TS_ONLY we can't fall back to the non-TS protocol so * we drop the link -orabidoo */ #ifdef HIDE_SERVERS_IPS sendto_realops("Link %s dropped, incompatible TS protocol version (%s,%s)", get_client_name(sptr,MASK_IP), parv[1], parv[2]); #else sendto_realops("Link %s dropped, incompatible TS protocol version (%s,%s)", get_client_name(sptr, TRUE), parv[1], parv[2]); #endif return exit_client(sptr, sptr, sptr, "Incompatible TS version"); } if(parc>3) { remote_ts = atol(parv[3]); if (UseIRCNTP && (remote_ts > 0)) { if(IsService(cptr) || ((aconf = find_conf_host(cptr->confs, sptr->name, CONF_HUB)) && !(acptr = find_server(ServicesServer)))) { ircntp_offset = remote_ts - time(NULL); sendto_realops("Adjusting IRCNTP offset to %d", ircntp_offset); } } } return 0; }
static void handlemaskprivmsg(int hooknum, void *args) { void **hargs = (void **)args; nick *source = hargs[0]; char *message = hargs[2]; Command *cmd; int cargc; char *cargv[50]; server *s; if(!source) return; if(!IsOper(source) || !IsService(source)) return; cargc = splitline(message, cargv, 50, 0); if(cargc < 2) return; if(strcmp(cargv[0], "XSB1")) return; s = &serverlist[homeserver(source->numeric)]; if(s->linkstate != LS_LINKED) { Error("xsb", ERR_WARNING, "Got XSB message from unlinked server (%s): %s", s->name->content, source->nick); return; } #ifndef XSB_DEBUG if(!(s->flags & SMODE_SERVICE)) { Error("xsb", ERR_WARNING, "Got XSB message from non-service server (%s): %s", s->name->content, source->nick); return; } #endif cmd = findcommandintree(cmds, cargv[1], 1); if(!cmd) return; if(cmd->maxparams < (cargc - 2)) { rejoinline(cargv[cmd->maxparams], cargc - (cmd->maxparams)); cargc = (cmd->maxparams) + 2; } (cmd->handler)(source, cargc - 2, &cargv[2]); }
static void stats_servers_verbose(struct Client* sptr, struct StatDesc* sd, int stat, char* param) { struct Client *acptr; /* lowercase 'v' is for human-readable, * uppercase 'V' is for machine-readable */ if (stat == 'v') send_reply(sptr, SND_EXPLICIT | RPL_STATSVERBOSE, "%-20s %-20s Flags Hops Numeric Lag RTT Up Down " "Clients/Max Proto %-10s :Info", "Servername", "Uplink", "LinkTS"); for (acptr = GlobalClientList; acptr; acptr = cli_next(acptr)) { if (!IsServer(acptr) && !IsMe(acptr)) continue; if (param && match(param, cli_name(acptr))) /* narrow search */ continue; send_reply(sptr, SND_EXPLICIT | RPL_STATSVERBOSE, stat == 'v' ? "%-20s %-20s %c%c%c%c %4i %s %-4i %5i %4i %4i %4i %5i %5i " "P%-2i %Tu :%s" : "%s %s %c%c%c%c %i %s %i %i %i %i %i %i %i P%i %Tu :%s", cli_name(acptr), cli_name(cli_serv(acptr)->up), IsBurst(acptr) ? 'B' : '-', IsBurstAck(acptr) ? 'A' : '-', IsHub(acptr) ? 'H' : '-', IsService(acptr) ? 'S' : '-', cli_hopcount(acptr), NumServ(acptr), base64toint(cli_yxx(acptr)), cli_serv(acptr)->lag, cli_serv(acptr)->asll_rtt, cli_serv(acptr)->asll_to, cli_serv(acptr)->asll_from, cli_serv(acptr)->clients, cli_serv(acptr)->nn_mask, cli_serv(acptr)->prot, cli_serv(acptr)->timestamp, cli_info(acptr)); } }
int csc_dodeopall(void *source, int cargc, char **cargv) { nick *sender=source,*np; reguser *rup; regchanuser *rcup; regchan *rcp; chanindex *cip; unsigned long *lp; int i; modechanges changes; if (cargc<1) { chanservstdmessage(sender, QM_NOTENOUGHPARAMS, "deopall"); return CMD_ERROR; } if (!(cip=cs_checkaccess(sender, cargv[0], CA_MASTERPRIV, NULL, "deopall",0, 0))) return CMD_ERROR; rcp=cip->exts[chanservext]; if (cip->channel) { localsetmodeinit(&changes, cip->channel, chanservnick); for (i=0,lp=cip->channel->users->content; i<cip->channel->users->hashsize;i++,lp++) { if (*lp!=nouser && (*lp & CUMODE_OP)) { if (!(np=getnickbynumeric(*lp)) || (!IsService(np) && (!(rup=getreguserfromnick(np)) || !(rcup=findreguseronchannel(rcp, rup)) || !(CUHasOpPriv(rcup)) || !(CUIsProtect(rcup) || CIsProtect(rcp))))) { localdosetmode_nick(&changes, np, MC_DEOP); } } } localsetmodeflush(&changes, 1); } cs_log(sender,"DEOPALL %s",cip->name->content); chanservstdmessage(sender, QM_DONE); return CMD_OK; }
/* ** m_lost() ** parv[0] = sender ** */ int m_lost(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { struct Client *acptr; char buf[BUFSIZE]; int lost = 0; if (!IsPrivileged(cptr)) { sendto_one(sptr, form_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; } strcpy(buf, "========================================================================================"); sendto_one(sptr, form_str(RPL_LISTS), me.name, parv[0], buf); strcpy(buf, "\2User\2"); sendto_one(sptr, form_str(RPL_LISTS), me.name, parv[0], buf); strcpy(buf, "----------------------------------------------------------------------------------------"); sendto_one(sptr, form_str(RPL_LISTS), me.name, parv[0], buf); for (acptr = GlobalClientList; acptr; acptr = acptr->next) { if (IsService(acptr) || IsStealth(acptr) || IsAnOper(acptr) || IsIdentified(acptr)) continue; if (!acptr->user || (acptr->user->channel != NULL)) continue; ircsprintf(buf, "\2%-29s\2 %-23s %s", acptr->name ? acptr->name : "<unknown>", acptr->user->away ? "(AWAY)" : "", acptr->user->server); sendto_one(sptr, form_str(RPL_LISTS), me.name, parv[0], buf); lost++; } strcpy(buf, "========================================================================================"); sendto_one(sptr, form_str(RPL_LISTS), me.name, parv[0], buf); ircsprintf(buf, "Total: \2%d\2 Lost Users", lost); sendto_one(sptr, form_str(RPL_LISTS), me.name, parv[0], buf); sendto_one(sptr, form_str(RPL_ENDOFLISTS), me.name, parv[0], "LOST."); return 0; }
void KickChannelUser(struct userNode* target, struct chanNode* channel, struct userNode *kicker, const char *why) { unsigned int n; if (!target || !channel || IsService(target) || !GetUserMode(channel, target)) return; /* This may break things, but lets see.. -Rubin */ for (n=0; n<kf_used; n++) kf_list[n](kicker, target, channel, kf_list_extra[n]); /* don't remove them from the channel, since the server will send a PART */ irc_kick(kicker, target, channel, why); if (IsLocal(target)) { /* NULL reason because we don't want a PART message to be sent by DelChannelUser. */ DelChannelUser(target, channel, NULL, 0); } }
static int m_identify(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { const char *nick; struct Client *target_p; if (parc < 2 || EmptyString(parv[1])) { sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name); return 0; } nick = parv[1][0] == '#' ? SVS_chanserv_NICK : SVS_nickserv_NICK; if ((target_p = find_named_person(nick)) && IsService(target_p)) { sendto_one(target_p, ":%s PRIVMSG %s :IDENTIFY %s", get_id(source_p, target_p), get_id(target_p, target_p), reconstruct_parv(parc - 1, &parv[1])); } else { sendto_one_numeric(source_p, ERR_SERVICESDOWN, form_str(ERR_SERVICESDOWN), nick); } return 0; }