/* * m_quit * parv[0] = sender prefix * parv[1] = comment */ int m_quit(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) #ifdef TIDY_QUIT { buf[0] = '\0'; if ((parc > 1) && parv[1]) { if (strlen(parv[1]) > (MAX_QUIT_LENGTH - 2)) parv[1][MAX_QUIT_LENGTH - 2] = '\0'; /* Don't add quotes to a null message */ if (MyConnect(sptr) && *parv[1]) { strncpy_irc(buf, "\"", 2); strncat(buf, strip_colour(parv[1]), MAX_QUIT_LENGTH - 2); strncat(buf, "\"", 1); } else strncpy_irc(buf, parv[1], BUFSIZE); } sptr->flags |= FLAGS_NORMALEX; #ifdef ANTI_SPAM_EXIT_MESSAGE /* Your quit message is suppressed if: * * You haven't been connected to the server for long enough */ if( !IsServer(sptr) && MyConnect(sptr) && (sptr->firsttime + ANTI_SPAM_EXIT_MESSAGE_TIME) > CurrentTime) strcpy(buf, "Client Quit"); else if (MyConnect(sptr) && IsPerson(sptr)) { /* Or you are in a channel to which you cannot send */ struct SLink *chptr; for (chptr = sptr->user->channel; chptr; chptr = chptr->next) { if (can_send(sptr, chptr->value.chptr) != 0) { strcpy(buf, "Client Quit"); break; } } } #endif if (IsPerson(sptr)) { sendto_local_ops_flag(UMODE_CCONN, "Client exiting: %s (%s@%s) [%s] [%s] [%s]", sptr->name, sptr->username, sptr->host, #ifdef WINTRHAWK buf, #else (sptr->flags & FLAGS_NORMALEX) ? "Client Quit" : comment, #endif /* WINTRHAWK */ sptr->sockhost, sptr->servptr ? sptr->servptr->name : "<null>"); } return IsServer(sptr) ? 0 : exit_client(cptr, sptr, sptr, buf); }
/* log_user_exit() * * inputs - pointer to connecting client * output - NONE * side effects - Current exiting client is logged to * either SYSLOG or to file. */ void log_user_exit(struct Client *source_p) { time_t on_for = CurrentTime - source_p->firsttime; #ifdef SYSLOG_USERS if (IsPerson(source_p)) { ilog(L_INFO, "%s (%3ld:%02ld:%02ld): %s!%s@%s %ld/%ld\n", myctime(source_p->firsttime), (signed long) on_for / 3600, (signed long) (on_for % 3600)/60, (signed long) on_for % 60, source_p->name, source_p->username, source_p->host, source_p->localClient->sendK, source_p->localClient->receiveK); } #else { char linebuf[BUFSIZ]; /* * This conditional makes the logfile active only after * it's been created - thus logging can be turned off by * removing the file. * -Taner */ if (IsPerson(source_p)) { if (user_log_fb == NULL) { if ((ConfigLoggingEntry.userlog[0] != '\0') && (user_log_fb = fbopen(ConfigLoggingEntry.userlog, "r")) != NULL) { fbclose(user_log_fb); user_log_fb = fbopen(ConfigLoggingEntry.userlog, "a"); } } if (user_log_fb != NULL) { size_t nbytes = ircsprintf(linebuf, "%s (%3ld:%02ld:%02ld): %s!%s@%s %d/%d\n", myctime(source_p->firsttime), (signed long) on_for / 3600, (signed long) (on_for % 3600)/60, (signed long) on_for % 60, source_p->name, source_p->username, source_p->host, source_p->localClient->sendK, source_p->localClient->receiveK); fbputs(linebuf, user_log_fb, nbytes); } } } #endif }
/* send_message_remote() * * inputs - pointer to client from message is being sent * - pointer to client to send to * - pointer to preformatted buffer * - length of input buffer * output - none * side effects - Despite the function name, this only sends to directly * connected clients. * */ static void send_message_remote(struct Client *to, struct Client *from, char *buf, int len) { if (!MyConnect(to)) { sendto_realops_flags(UMODE_ALL, L_ALL, "server send message to %s [%s] dropped from %s(Not local server)", to->name, to->from->name, from->name); return; } /* Optimize by checking if (from && to) before everything */ /* we set to->from up there.. */ if (!MyClient(from) && IsPerson(to) && (to == from->from)) { if (IsServer(from)) { sendto_realops_flags(UMODE_ALL, L_ALL, "Send message to %s [%s] dropped from %s(Fake Dir)", to->name, to->from->name, from->name); return; } sendto_realops_flags(UMODE_ALL, L_ALL, "Ghosted: %s[%s@%s] from %s[%s@%s] (%s)", to->name, to->username, to->host, from->name, from->username, from->host, to->from->name); sendto_server(NULL, CAP_TS6, NOCAPS, ":%s KILL %s :%s (%s[%s@%s] Ghosted %s)", me.id, to->name, me.name, to->name, to->username, to->host, to->from->name); sendto_server(NULL, NOCAPS, CAP_TS6, ":%s KILL %s :%s (%s[%s@%s] Ghosted %s)", me.name, to->name, me.name, to->name, to->username, to->host, to->from->name); SetKilled(to); if (IsPerson(from)) sendto_one(from, form_str(ERR_GHOSTEDCLIENT), me.name, from->name, to->name, to->username, to->host, to->from); exit_client(NULL, to, &me, "Ghosted client"); return; } send_message(to, buf, len); }
char *get_client_name(aClient *sptr, int showip) { static char nbuf[HOSTLEN * 2 + USERLEN + 5]; if (MyConnect(sptr)) { #ifdef UNIXPORT if (IsUnixSocket(sptr)) { if (showip) sprintf(nbuf, "%s[%s]", sptr->name, sptr->sockhost); else sprintf(nbuf, "%s[%s]", sptr->name, me.sockhost); } else #endif { if (showip) (void)sprintf(nbuf, "%s[%.*s@%s]", sptr->name, USERLEN, (!(sptr->flags & FLAGS_GOTID)) ? "" : sptr->auth, sptr->user ? sptr->user->sip : #ifdef INET6 inetntop(AF_INET6, (char *)&sptr->ip, ipv6string, sizeof(ipv6string)) #else inetntoa((char *)&sptr->ip) #endif ); else { if (mycmp(sptr->name, sptr->sockhost)) /* Show username for clients and * ident for others. */ sprintf(nbuf, "%s[%.*s@%s]", sptr->name, USERLEN, IsPerson(sptr) ? sptr->user->username : sptr->auth, IsPerson(sptr) ? sptr->user->host : sptr->sockhost); else return sptr->name; } } return nbuf; } return sptr->name; }
int m_servlist(aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; char *mask; mask = IsParam(1) ? parv[1] : NULL; for (acptr = client; acptr; acptr = acptr->next) { if (!IsPerson(acptr) || !IsServices(acptr)) continue; if (mask && _match(mask, acptr->name)) continue; sendto_one(sptr, TEXT_SERVLIST, me.name, sptr->name, acptr->name, acptr->user->username, GetHost(acptr), acptr->srvptr->name, acptr->srvptr->hopcount, acptr->info); } sendto_one(sptr, TEXT_SERVLISTEND, me.name, sptr->name, mask ? mask : "*"); return 0; }
void unload_all_unused_snomasks() { long removed_sno = 0; int i; for (i = 0; i < UMODETABLESZ; i++) { if (Snomask_Table[i].unloaded) { removed_sno |= Snomask_Table[i].mode; Snomask_Table[i].flag = '\0'; Snomask_Table[i].unloaded = 0; } } if (!removed_sno) /* Nothing was unloaded */ return; for (i = 0; i <= LastSlot; i++) { aClient *cptr = local[i]; long oldsno; if (!cptr || !IsPerson(cptr)) continue; oldsno = cptr->user->snomask; cptr->user->snomask &= ~(removed_sno); if (oldsno != cptr->user->snomask) sendto_one(cptr, rpl_str(RPL_SNOMASK), me.name, cptr->name, get_snostr(cptr->user->snomask)); } }
/* ** m_admin ** parv[0] = sender prefix ** parv[1] = servername */ DLLFUNC CMD_FUNC(m_admin) { ConfigItem_admin *admin; /* Users may want to get the address in case k-lined, etc. -- Barubary * Only allow remote ADMINs if registered -- Barubary */ if (IsPerson(sptr) || IsServer(cptr)) if (hunt_server(cptr, sptr, ":%s ADMIN :%s", 1, parc, parv) != HUNTED_ISME) return 0; if (!conf_admin_tail) { sendto_one(sptr, err_str(ERR_NOADMININFO), me.name, parv[0], me.name); return 0; } sendto_one(sptr, rpl_str(RPL_ADMINME), me.name, parv[0], me.name); /* cycle through the list backwards */ for (admin = conf_admin_tail; admin; admin = (ConfigItem_admin *) admin->prev) { if (!admin->next) sendto_one(sptr, rpl_str(RPL_ADMINLOC1), me.name, parv[0], admin->line); else if (!admin->next->next) sendto_one(sptr, rpl_str(RPL_ADMINLOC2), me.name, parv[0], admin->line); else sendto_one(sptr, rpl_str(RPL_ADMINEMAIL), me.name, parv[0], admin->line); } return 0; }
/* * ms_wallops (write to *all* opers currently online) * parv[1] = message text */ static int ms_wallops(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { const char *prefix = ""; if (MyClient(source_p) && !IsOperMassNotice(source_p)) { sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "mass_notice"); return 0; } if (IsPerson(source_p)) { if (!strncmp(parv[1], "OPERWALL - ", 11) || !strncmp(parv[1], "LOCOPS - ", 9) || !strncmp(parv[1], "SLOCOPS - ", 10) || !strncmp(parv[1], "ADMINWALL - ", 12)) prefix = "WALLOPS - "; } sendto_wallops_flags(UMODE_WALLOP, source_p, "%s%s", prefix, parv[1]); sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s WALLOPS :%s", use_id(source_p), parv[1]); return 0; }
/* send_linebuf_remote() * * inputs - client to attach to, sender, linebuf * outputs - * side effects - client has linebuf attached */ static void send_linebuf_remote(struct Client *to, struct Client *from, buf_head_t *linebuf) { if(to->from) to = to->from; /* test for fake direction */ if(!MyClient(from) && IsPerson(to) && (to == from->from)) { if(IsServer(from)) { sendto_realops_flags(UMODE_ALL, L_ALL, "Send message to %s[%s] dropped from %s(Fake Dir)", to->name, to->from->name, from->name); return; } sendto_realops_flags(UMODE_ALL, L_ALL, "Ghosted: %s[%s@%s] from %s[%s@%s] (%s)", to->name, to->username, to->host, from->name, from->username, from->host, to->from->name); kill_client_serv_butone(NULL, to, "%s (%s[%s@%s] Ghosted %s)", me.name, to->name, to->username, to->host, to->from->name); to->flags |= FLAGS_KILLED; exit_client(NULL, to, &me, "Ghosted client"); return; } _send_linebuf(to, linebuf); return; }
void SnomaskDel(Snomask *sno) { if (loop.ircd_rehashing) sno->unloaded = 1; else { int i; for (i = 0; i <= LastSlot; i++) { aClient *cptr = local[i]; long oldsno; if (!cptr || !IsPerson(cptr)) continue; oldsno = cptr->user->snomask; cptr->user->snomask &= ~sno->mode; if (oldsno != cptr->user->snomask) sendto_one(cptr, rpl_str(RPL_SNOMASK), me.name, cptr->name, get_snostr(cptr->user->snomask)); } sno->flag = '\0'; } if (sno->owner) { ModuleObject *snoobj; for (snoobj = sno->owner->objects; snoobj; snoobj = snoobj->next) { if (snoobj->type == MOBJ_SNOMASK && snoobj->object.snomask == sno) { DelListItem(snoobj, sno->owner->objects); MyFree(snoobj); break; } } sno->owner = NULL; } return; }
void unload_all_unused_umodes() { long removed_umode = 0; int i; aClient *cptr; for (i = 0; i < UMODETABLESZ; i++) { if (Usermode_Table[i].unloaded) removed_umode |= Usermode_Table[i].mode; } if (!removed_umode) /* Nothing was unloaded */ return; for (cptr = client; cptr; cptr = cptr->next) { long oldumode = 0; if (!IsPerson(cptr)) continue; oldumode = cptr->umodes; cptr->umodes &= ~(removed_umode); if (MyClient(cptr)) send_umode_out(cptr, cptr, oldumode); } for (i = 0; i < UMODETABLESZ; i++) { if (Usermode_Table[i].unloaded) { AllUmodes &= ~(Usermode_Table[i].mode); SendUmodes &= ~(Usermode_Table[i].mode); Usermode_Table[i].flag = '\0'; Usermode_Table[i].unloaded = 0; } } make_umodestr(); }
/* * dead_link - Adds client to a list of clients that need an exit_client() * */ void dead_link(struct Client *client_p) { dlink_node *m; const char *notice; if(IsClosing(client_p)) return; linebuf_donebuf(&client_p->localClient->buf_recvq); linebuf_donebuf(&client_p->localClient->buf_sendq); if(client_p->flags & FLAGS_SENDQEX) notice = "Max SendQ exceeded"; else notice = "Dead link"; if (!IsPerson(client_p) && !IsUnknown(client_p) && !IsClosing(client_p)) { sendto_realops_flags(FLAGS_ALL, L_ADMIN, notice, get_client_name(client_p, HIDE_IP)); sendto_realops_flags(FLAGS_ALL, L_OPER, notice, get_client_name(client_p, MASK_IP)); } Debug((DEBUG_ERROR, notice, get_client_name(to, HIDE_IP))); assert(dlinkFind(&abort_list, client_p) == NULL); m = make_dlink_node(); dlinkAdd(client_p, m, &abort_list); SetDead(client_p); /* You are dead my friend */ }
/* log_failed_oper() * * inputs - pointer to client that failed to oper up * - oper name * output - none * side effects - ffailed_operlog is written to, if its present */ void log_failed_oper(struct Client *source_p, const char *name) { if (ConfigLoggingEntry.failed_operlog[0] == '\0') return; if (IsPerson(source_p)) { FBFILE *oper_fb; if ((oper_fb = fbopen(ConfigLoggingEntry.failed_operlog, "r")) != NULL) { fbclose(oper_fb); oper_fb = fbopen(ConfigLoggingEntry.failed_operlog, "a"); } if (oper_fb != NULL) { char linebuf[BUFSIZE]; size_t nbytes = ircsprintf(linebuf, "%s FAILED OPER (%s) by (%s!%s@%s)\n", myctime(CurrentTime), name, source_p->name, source_p->username, source_p->host); fbputs(linebuf, oper_fb, nbytes); fbclose(oper_fb); } } }
/* * Attempt to send a sequence of bytes to the connection. * Returns * * < 0 Some fatal error occurred, (but not EWOULDBLOCK). * This return is a request to close the socket and * clean up the link. * * >= 0 No real error occurred, returns the number of * bytes actually transferred. EWOULDBLOCK and other * possibly similar conditions should be mapped to * zero return. Upper level routine will have to * decide what to do with those unwritten bytes... * * *NOTE* alarm calls have been preserved, so this should * work equally well whether blocking or non-blocking * mode is used... */ int deliver_it(aClient *cptr, char *str, int len) { int retval; aClient *acpt = cptr->acpt; #ifdef DEBUGMODE writecalls++; #endif if (IsDead(cptr) || (!IsServer(cptr) && !IsPerson(cptr) && !IsHandshake(cptr) && !IsUnknown(cptr))) { str[len]='\0'; sendto_ops("* * * DEBUG ERROR * * * !!! Calling deliver_it() for %s, status %d %s, with message: %s", cptr->name, cptr->status, IsDead(cptr)?"DEAD":"", str); return -1; } retval = socket_write(cptr->sock, str, len); /* * Convert WOULDBLOCK to a return of "0 bytes moved". This * should occur only if socket was non-blocking. Note, that * all is Ok, if the 'write' just returns '0' instead of an * error and errno=EWOULDBLOCK. */ #ifdef DEBUGMODE if (retval < 0) { writeb[0]++; Debug((DEBUG_ERROR,"write error (%s) to %s", strerror(errno), cptr->name)); } else if (retval == 0) writeb[1]++; else if (retval < 16) writeb[2]++; else if (retval < 32) writeb[3]++; else if (retval < 64) writeb[4]++; else if (retval < 128) writeb[5]++; else if (retval < 256) writeb[6]++; else if (retval < 512) writeb[7]++; else if (retval < 1024) writeb[8]++; else writeb[9]++; #endif if (retval > 0) { cptr->sendB += retval; me.sendB += retval; if (cptr->sendB > 1023) { cptr->sendK += (cptr->sendB >> 10); cptr->sendB &= 0x03ff; /* 2^10 = 1024, 3ff = 1023 */ }
static int ovr_ircop_only(Cmdoverride *ovr, aClient *cptr, aClient *sptr, int parc, char *parv[]) { if (IsPerson(sptr) && !IsOper(sptr)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name); return -1; } return CallCmdoverride(ovr, cptr, sptr, parc, parv); }
/* * find_person - find person by (nick)name. * inputs - pointer to name * output - return client pointer * side effects - */ struct Client *find_person(char *name) { struct Client *c2ptr; c2ptr = find_client(name); if (c2ptr && IsPerson(c2ptr)) return (c2ptr); return (NULL); }
/* ** me_certfp ** parv[1] = certfp string */ static int me_certfp(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { if (!IsPerson(source_p)) return 0; rb_free(source_p->certfp); source_p->certfp = NULL; if (!EmptyString(parv[1])) source_p->certfp = rb_strdup(parv[1]); return 0; }
static int me_locops(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { if(!IsPerson(source_p)) return 0; if(find_shared_conf("*", "*", source_p->servptr->name, SHARED_LOCOPS)) sendto_wallops_flags(UMODE_LOCOPS, source_p, "SLOCOPS - %s", parv[1]); return 0; }
/* * do_admin * * inputs - pointer to client to report to * output - none * side effects - admin info is sent to client given */ static void do_admin(struct Client *source_p) { if(IsPerson(source_p)) admin_spy(source_p); sendto_one_numeric(source_p, RPL_ADMINME, form_str(RPL_ADMINME), me.name); if(AdminInfo.name != NULL) sendto_one_numeric(source_p, RPL_ADMINLOC1, form_str(RPL_ADMINLOC1), AdminInfo.name); if(AdminInfo.description != NULL) sendto_one_numeric(source_p, RPL_ADMINLOC2, form_str(RPL_ADMINLOC2), AdminInfo.description); if(AdminInfo.email != NULL) sendto_one_numeric(source_p, RPL_ADMINEMAIL, form_str(RPL_ADMINEMAIL), AdminInfo.email); }
/* * build_nicklist() * * input - pointer to client * - pointer to addbuffer * - pointer to remove buffer * - pointer to list of nicks * output - * side effects - addbuf/delbuf are modified to give valid nicks */ static void build_nicklist(struct Client *source_p, char *addbuf, char *delbuf, char *nicks) { char *name; char *p; int lenadd; int lendel; int del; struct Client *target_p; *addbuf = *delbuf = '\0'; del = lenadd = lendel = 0; /* build list of clients to add into addbuf, clients to remove in delbuf */ for(name = strtoken(&p, nicks, ","); name; name = strtoken(&p, (char *)NULL, ","), del = 0) { if(*name == '-') { del = 1; name++; } if(((target_p = find_client(name)) == NULL) || !IsPerson(target_p)) { sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, name); continue; } /* we're deleting a client */ if(del) { if(*delbuf) (void)strcat(delbuf, ","); (void)strncat(delbuf, name, BUFSIZE - lendel - 1); lendel += strlen(name) + 1; } /* adding a client */ else { if(*addbuf) (void)strcat(addbuf, ","); (void)strncat(addbuf, name, BUFSIZE - lenadd - 1); lenadd += strlen(name) + 1; } } }
static void sendnick_TS(aClient *cptr, aClient *acptr) { ServicesTag *servicestag; static char ubuf[30]; int *s, flag, i; if (IsPerson(acptr)) { send_umode(NULL, acptr, 0, SEND_UMODES, ubuf); if (!*ubuf) /* trivial optimization - Dianora */ { ubuf[0] = '+'; ubuf[1] = '\0'; } if (IsNickIPStr(cptr)) { sendto_one(cptr, "NICK %s %d %ld %s %s %s %s %lu %s :%s", acptr->name, acptr->hopcount + 1, acptr->tsinfo, ubuf, acptr->user->username, acptr->user->host, acptr->user->server, acptr->user->servicestamp, cipntoa(acptr), acptr->info); } else { sendto_one(cptr, "NICK %s %d %ld %s %s %s %s %lu %u :%s", acptr->name, acptr->hopcount + 1, acptr->tsinfo, ubuf, acptr->user->username, acptr->user->host, acptr->user->server, acptr->user->servicestamp, (acptr->ip_family == AF_INET) ? htonl(acptr->ip.ip4.s_addr) : 1, acptr->info); } for(servicestag = acptr->user->servicestag; servicestag; servicestag = servicestag->next) { ubuf[0] = '+'; i = 1; for (s = user_modes; (flag = *s); s += 2) if(servicestag->umode & flag) { ubuf[i++] = *(s + 1); } ubuf[i++] = '\0'; sendto_one(cptr, "SVSTAG %s %ld %d %s :%s", acptr->name, acptr->tsinfo, servicestag->raw, ubuf, servicestag->tag); } #ifdef USER_HOSTMASKING if(acptr->flags & FLAGS_SPOOFED) sendto_one(cptr, "SVSHOST %s %s", acptr->name, acptr->user->mhost); #endif } }
/* * me_realhost * parv[1] = real host * * Yes this contains a little race condition if someone does a whois * in between the UID and REALHOST and use_whois_actually is enabled. * I don't think that's a big problem as the whole thing is a * race condition. */ static int me_realhost(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { if (!IsPerson(source_p)) return 0; del_from_hostname_hash(source_p->orighost, source_p); rb_strlcpy(source_p->orighost, parv[1], sizeof source_p->orighost); if (irccmp(source_p->host, source_p->orighost)) SetDynSpoof(source_p); else ClearDynSpoof(source_p); add_to_hostname_hash(source_p->orighost, source_p); return 0; }
static void redirect_all_clients(void) { int i, count = 0; aClient *acptr; for (i = LastSlot; i >= 0; i--) { if ((acptr = local[i]) && IsPerson(acptr) && !IsAnOper(acptr)) { do_jumpserver_exit_client(acptr); count++; } } sendto_realops("JUMPSERVER: Redirected %d client%s", count, count == 1 ? "" : "s"); /* Language fun... ;p */ }
/* ** m_sendsno - Written by Syzop, bit based on SENDUMODE from Stskeeps ** parv[0] = sender prefix ** parv[1] = target snomask ** parv[2] = message text ** Servers can use this to: ** :server.unreal.net SENDSNO e :Hiiiii */ DLLFUNC int m_sendsno(aClient *cptr, aClient *sptr, int parc, char *parv[]) { char *sno, *msg, *p; long snomask = 0; int i; #ifndef NO_FDLIST int j; #endif aClient *acptr; if ((parc < 3) || BadPtr(parv[2])) { sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "SENDSNO"); return 0; } sno = parv[1]; msg = parv[2]; /* Forward to others... */ sendto_serv_butone_token(cptr, sptr->name, MSG_SENDSNO, TOK_SENDSNO, "%s :%s", parv[1], parv[2]); for (p = sno; *p; p++) { for(i = 0; i <= Snomask_highest; i++) { if (Snomask_Table[i].flag == *p) { snomask |= Snomask_Table[i].mode; break; } } } #ifdef NO_FDLIST for(i = 0; i <= LastSlot; i++) #else for (i = oper_fdlist.entry[j = 1]; j <= oper_fdlist.last_entry; i = oper_fdlist.entry[++j]) #endif if ((acptr = local[i]) && IsPerson(acptr) && IsAnOper(acptr) && (acptr->user->snomask & snomask)) { sendto_one(acptr, ":%s NOTICE %s :%s", me.name, acptr->name, msg); } return 0; }
/* ms_resv() * parv[0] = sender prefix * parv[1] = target server * parv[2] = channel/nick to resv * parv[3] = reason */ static void ms_resv (struct Client *client_p, struct Client *source_p, int parc, char *parv[]) { if ((parc != 4) || EmptyString (parv[3])) return; sendto_match_servs (source_p, parv[1], CAP_CLUSTER, "RESV %s %s :%s", parv[1], parv[2], parv[3]); if (!match (parv[1], me.name)) return; if (!IsPerson (source_p)) return; parse_resv (source_p, parv[2], parv[3], 1); }
/* ms_unresv() * parv[0] = sender prefix * parv[1] = target server * parv[2] = resv to remove */ static void ms_unresv (struct Client *client_p, struct Client *source_p, int parc, char *parv[]) { if ((parc != 3) || EmptyString (parv[2])) return; sendto_match_servs (source_p, parv[1], CAP_CLUSTER, "UNRESV %s %s", parv[1], parv[2]); if (!match (me.name, parv[1])) return; if (!IsPerson (source_p)) return; remove_resv (source_p, parv[2], 1); }
int find_invex(aChannel *chptr, aClient *sptr) { /* This routine is basically a copy-paste of is_banned_with_nick, with modifications, for invex */ Ban *inv; char *s; static char realhost[NICKLEN + USERLEN + HOSTLEN + 24]; static char cloakhost[NICKLEN + USERLEN + HOSTLEN + 24]; static char virthost[NICKLEN + USERLEN + HOSTLEN + 24]; static char nuip[NICKLEN + USERLEN + HOSTLEN + 24]; Extban *extban; if (!IsPerson(sptr) || !chptr->invexlist) return 0; ban_realhost = realhost; ban_ip = ban_virthost = ban_cloakhost = NULL; if (GetIP(sptr)) { make_nick_user_host_r(nuip, sptr->name, sptr->user->username, GetIP(sptr)); ban_ip = nuip; } if (*sptr->user->cloakedhost) { make_nick_user_host_r(cloakhost, sptr->name, sptr->user->username, sptr->user->cloakedhost); ban_cloakhost = cloakhost; } if (IsSetHost(sptr) && strcmp(sptr->user->realhost, sptr->user->virthost)) { make_nick_user_host_r(virthost, sptr->name, sptr->user->username, sptr->user->virthost); ban_virthost = virthost; } make_nick_user_host_r(realhost, sptr->name, sptr->user->username, sptr->user->realhost); for (inv = chptr->invexlist; inv; inv = inv->next) if (ban_check_mask(sptr, chptr, inv->banstr, BANCHK_JOIN, 0)) return 1; return 0; }
/* ** m_rakill; ** parv[0] = sender prefix ** parv[1] = hostmask ** parv[2] = username ** parv[3] = comment */ DLLFUNC int m_rakill(aClient *cptr, aClient *sptr, int parc, char *parv[]) { char *tkllayer[6] = { me.name, /*0 server.name */ "-", /*1 - */ "G", /*2 G */ NULL, /*3 user */ NULL, /*4 host */ NULL /*5 whoremoved */ }; if (parc < 2 && IsPerson(sptr)) { sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "RAKILL"); return 0; } if (IsServer(sptr) && parc < 3) return 0; if (!IsServer(cptr)) { if (!IsOper(sptr)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name); } else { sendto_one(sptr, ":%s NOTICE %s :*** RAKILL is depreciated and should not be used. Please use /gline -user@host instead", me.name, sptr->name); } return 0; } tkllayer[3] = parv[2]; tkllayer[4] = parv[1]; tkllayer[5] = sptr->name; m_tkl(&me, &me, 6, tkllayer); loop.do_bancheck = 1; return 0; }
/* * Modified from comstud by codemastr */ DLLFUNC CMD_FUNC(m_botmotd) { aMotd *temp; ConfigItem_tld *ptr; char userhost[HOSTLEN + USERLEN + 6]; if (hunt_server_token(cptr, sptr, MSG_BOTMOTD, TOK_BOTMOTD, ":%s", 1, parc, parv) != HUNTED_ISME) return 0; if (!IsPerson(sptr)) return 0; strlcpy(userhost,make_user_host(sptr->user->username, sptr->user->realhost), sizeof userhost); ptr = Find_tld(sptr, userhost); if (ptr) { if (ptr->botmotd) temp = ptr->botmotd; else temp = botmotd; } else temp = botmotd; if (!temp) { sendto_one(sptr, ":%s NOTICE %s :BOTMOTD File not found", me.name, sptr->name); return 0; } sendto_one(sptr, ":%s NOTICE %s :- %s Bot Message of the Day - ", me.name, sptr->name, me.name); while (temp) { sendto_one(sptr, ":%s NOTICE %s :- %s", me.name, sptr->name, temp->line); temp = temp->next; } sendto_one(sptr, ":%s NOTICE %s :End of /BOTMOTD command.", me.name, sptr->name); return 0; }
void PeepsWindow::AddPerson(const entry_ref &ref, bool highlight) { // Check to see if it's actually a Person file if(!IsPerson(ref)) return; GroupData *gdata; // Add person to data list PersonData *pdata=new PersonData(ref); gPeopleData.AddItem(pdata); // add group(s) and an item for each group if(strlen(pdata->Group())==0) { // Ungrouped case gdata=gGroupData.AddGroup(TRANSLATE("Ungrouped")); if(!fPeopleList->HasItem(gdata->GetInstance())) fPeopleList->AddItem(gdata->GetInstance()); gdata->AddPerson(pdata); fPeopleList->AddUnder(pdata->CreateInstance(TRANSLATE("Ungrouped")),gdata->GetInstance()); return; } GroupParser gp(pdata->Group()); for(int32 i=0; i<gp.CountGroups(); i++) { gdata=gGroupData.AddGroup(gp.GroupAt(i)); gdata->AddPerson(pdata); if(!fPeopleList->HasItem(gdata->GetInstance())) fPeopleList->AddItem(gdata->GetInstance()); fPeopleList->AddUnder(pdata->CreateInstance(gp.GroupAt(i)),gdata->GetInstance()); } if(highlight) { SelectPerson(pdata->Name()); } }