1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-05 18:33:12 +02:00

sendto_serv_butone_token_opt

This commit is contained in:
stskeeps
2000-06-04 14:51:38 +00:00
parent afcea0d1ec
commit c2d9acd82e
3 changed files with 99 additions and 1 deletions
+2 -1
View File
@@ -346,4 +346,5 @@
- Fixed a bug that prolly was fixed by Potvin, but was "not fixed correctly"
- Fixed a crash problem in register_user and most likely fixed the "strange
vhost" thing, (was a dumb bug, mising ircsprintf)
- Fixed the *** NickServ sets mode +creep SVS2MODE bug..
- Fixed the *** NickServ sets mode +creep SVS2MODE bug..
- sendto_serv_butone_token_opt ()..
+10
View File
@@ -175,6 +175,16 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
#define SetLog(x) ((x)->status = STAT_LOG)
#define SetService(x) ((x)->status = STAT_SERVICE)
/* opt.. */
#define OPT_SJOIN 0x0001
#define OPT_NOT_SJOIN 0x0002
#define OPT_NICKv2 0x0004
#define OPT_NOT_NICKv2 0x0008
#define OPT_SJOIN2 0x0010
#define OPT_NOT_SJOIN2 0x0020
#define OPT_UMODE2 0x0040
#define OPT_NOT_UMODE2 0x0080
#define FLAGS_PINGSENT 0x0001 /* Unreplied ping sent */
#define FLAGS_DEADSOCKET 0x0002 /* Local socket is dead--Exiting soon */
#define FLAGS_KILLED 0x0004 /* Prevents "QUIT" from being sent for this */
+87
View File
@@ -554,6 +554,93 @@ void sendto_serv_butone_token(aClient *one, char *prefix, char *command,
return;
}
/*
* sendto_server_butone_token_opt
*
* Send a message to all connected servers except the client 'one'.
* with capab to tokenize, opt
*/
void sendto_serv_butone_token_opt(aClient *one, int opt, char *prefix, char *command,
char *token, char *pattern, ...)
{
va_list vl;
int i;
aClient *cptr;
#ifndef NO_FDLIST
int j;
#endif
char *p;
static char tcmd[1024];
static char ccmd[1024];
static char buff[1024];
static char pref[100];
va_start(vl, pattern);
pref[0] = '\0';
if (strchr(prefix, '.'))
ircsprintf(pref, "@%s", find_server_aln(prefix));
strcpy(tcmd, token);
strcpy(ccmd, command);
strcat(tcmd, " ");
strcat(ccmd, " ");
ircvsprintf(buff, pattern, vl);
strcat(tcmd, buff);
strcat(ccmd, buff);
#ifdef NO_FDLIST
for (i = 0; i <= highest_fd; i++)
#else
for (i = serv_fdlist.entry[j = 1]; j <= serv_fdlist.last_entry;
i = serv_fdlist.entry[++j])
#endif
{
if (!(cptr = local[i]) || (one && cptr == one->from))
continue;
#ifdef NO_FDLIST
if (IsServer(cptr))
#endif
if ((opt & OPT_NOT_SJOIN) && SupportSJOIN(cptr))
continue;
if ((opt & OPT_NOT_NICKv2) && SupportNICKv2(cptr))
continue;
if ((opt & OPT_NOT_SJOIN2) && SupportSJOIN2(cptr))
continue;
if ((opt & OPT_NOT_UMODE2) && SupportUMODE2(cptr))
continue;
if ((opt & OPT_NICKv2) && !SupportNICKv2(cptr))
continue;
if ((opt & OPT_SJOIN) && !SupportSJOIN(cptr))
continue;
if ((opt & OPT_SJOIN2) && !SupportSJOIN2(cptr))
continue;
if ((opt & OPT_UMODE2) && !SupportUMODE2(cptr))
continue;
if (IsToken(cptr))
{
if ((pref[0] != '\0') && SupportALN(cptr))
sendto_one(cptr, "%s %s", pref, tcmd);
else
sendto_one(cptr, ":%s %s", prefix,
tcmd);
}
else
{
if ((pref[0] != '\0') && SupportALN(cptr))
sendto_one(cptr, "%s %s", pref, ccmd);
else
sendto_one(cptr, ":%s %s", prefix,
ccmd);
}
}
va_end(vl);
return;
}
/*
* sendto_serv_butone_quit
*