void vsendto_one(struct Client *to, char *pattern, va_list vl) { va_list vlcopy; va_copy(vlcopy,vl); vsprintf_irc(sendbuf, pattern, vlcopy); sendbufto_one(to); }
void tosock(int sockfd, char *format, ...) { char buf[MAXLINE * 2]; va_list args; va_start(args, format); vsprintf_irc(buf, format, args); va_end(args); /* send the string to the socket */ writesocket(sockfd, buf); } /* tosock() */
void RecordCommand(char *format, ...) { va_list args; char buffer[MAXLINE * 2]; va_start(args, format); vsprintf_irc(buffer, format, args); va_end(args); /* log the command */ stripformatsymbols( buffer ); putlog(LOG2, buffer); /* send it to opers with usermode +s */ SendUmode(OPERUMODE_S, buffer); } /* RecordCommand() */
/* * Envio un comando a otro servidor o usuario */ void sendcmdto_one(struct Client *to, struct Client *from, char *cmd, char *token, const char *pattern, ...) { va_list vl; /* Evito que el mensaje vuelva al origen */ if(cli_from(from)==cli_from(to)) return; #if !defined(NO_PROTOCOL9) if (Protocol(cli_from(to)) > 9) { #endif if (IsUser(from)) { if(IsUser(to)) sprintf_irc(sendbuf, "%s%s %s %s%s ", NumNick(from), token, NumNick(to)); else sprintf_irc(sendbuf, "%s%s %s %s ", NumNick(from), token, NumServ(to)); } else { if(IsUser(to)) sprintf_irc(sendbuf, "%s %s %s%s ", NumServ(from), token, NumNick(to)); else sprintf_irc(sendbuf, "%s %s %s ", NumServ(from), token, NumServ(to)); } #if !defined(NO_PROTOCOL9) } else sprintf_irc(sendbuf, ":%s %s %s ", from->name, cmd, to->name); #endif if(!pattern || !*pattern) sendbuf[strlen(sendbuf)-1]='\0'; else { va_start(vl, pattern); vsprintf_irc(sendbuf + strlen(sendbuf), pattern, vl); va_end(vl); } sendbufto_one(to); }
/* toserv() sends 'str' to hub server */ void toserv(char *format, ...) { char buf[MAXLINE * 2]; int ii; va_list args; if (HubSock == NOSOCKET) return; va_start(args, format); vsprintf_irc(buf, format, args); va_end(args); /* send the string to the server */ ii = writesocket(HubSock, buf); /* * If format contains a trailing \n, but buf was too large * to fit 'format', make sure the \n gets through */ if ((format[strlen(format) - 1] == '\n') && (buf[ii - 1] != '\n')) writesocket(HubSock, "\r\n"); } /* toserv() */
static void vsendto_prefix_one(struct Client *to, struct Client *from, char *pattern, va_list vlorig) { va_list vl; va_copy(vl,vlorig); if (to && from && MyUser(to) && IsUser(from)) { static char sender[HOSTLEN + NICKLEN + USERLEN + 5]; char *par; int flag = 0; Reg3 anUser *user = from->cli_user; par = va_arg(vl, char *); strcpy(sender, from->name); #if defined(ESNET_NEG) if (user && !(to->cli_connect->negociacion & USER_TOK)) #else if (user) #endif { if (user->username) { strcat(sender, "!"); strcat(sender, user->username); } if (user->host && !MyConnect(from)) { strcat(sender, "@"); #if defined(BDD_VIP) strcat(sender, get_visiblehost(from, NULL)); #else strcat(sender, user->host); #endif flag = 1; } } /* * Flag is used instead of strchr(sender, '@') for speed and * also since username/nick may have had a '@' in them. -avalon */ #if defined(ESNET_NEG) if (!flag && MyConnect(from) && user->host && !(to->cli_connect->negociacion & USER_TOK)) #else if (!flag && MyConnect(from) && user->host) #endif { strcat(sender, "@"); #if defined(BDD_VIP) strcat(sender, get_visiblehost(from, NULL)); #else if (IsUnixSocket(from)) strcat(sender, user->host); else strcat(sender, from->sockhost); #endif } *sendbuf = ':'; strcpy(&sendbuf[1], sender); /* Assuming 'pattern' always starts with ":%s ..." */ vsprintf_irc(sendbuf + strlen(sendbuf), &pattern[3], vl); } else