Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 35 additions & 8 deletions common/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ int send_queued(aClient *to)
else
{
msg = zip_buffer(to, NULL, &len, 1);

if (len == -1)
return dead_link(to,
"fatal error in zip_buffer()");
Expand Down Expand Up @@ -617,7 +617,7 @@ void sendto_common_channels(aClient *user, char *pattern, ...)
out...but I do know the 2nd part will help big client servers
fairly well... - Comstud 97/04/24
*/

if (highest_fd < 50) /* This part optimized for HUB servers... */
{
if (MyConnect(user))
Expand Down Expand Up @@ -748,6 +748,33 @@ void sendto_channel_butserv(aChannel *chptr, aClient *from, char *pattern, ...)
return;
}

/*
** sendto_channels_butserv_caps
**
** Send a message to all members of channels that 'from' is on,
** who have the specified capabilities, except 'from' itself.
*/
void sendto_channels_butserv_caps(aClient *from, int caps, char *pattern, ...)
{
Reg Link *channels, *lp;
Reg aClient *cptr;
int len = 0;
va_list va;

if (!from->user)
return 0;

// Iterate through all channels the user is on
va_start(va, pattern);
for (channels = from->user->channel; channels; channels = channels->next)
{

sendto_channel_butserv_caps(channels->value.chptr, from, CAP_AWAY_NOTIFY, 0, pattern, va);
}

va_end(va);
}

/*
* sendto_channel_butserv_caps
*
Expand All @@ -760,7 +787,7 @@ void sendto_channel_butserv_caps(aChannel *chptr, aClient *from, int caps, int e
Reg aClient *acptr, *lfrm = from;
int len = 0;

if (MyClient(from))
if (MyClient(from) && caps != CAP_AWAY_NOTIFY)
{ /* Always send to the client itself */
if ((caps == 0 || HasCap(from, caps)) && (excluded_caps == 0 || !HasCap(from, excluded_caps)))
{
Expand Down Expand Up @@ -969,7 +996,7 @@ void sendto_match_butone(aClient *one, aClient *from, char *mask, int what,
int i;
aClient *cptr,
*srch;

for (i = 0; i <= highest_fd; i++)
{
if (!(cptr = local[i]))
Expand Down Expand Up @@ -999,7 +1026,7 @@ void sendto_match_butone(aClient *one, aClient *from, char *mask, int what,
continue;
}
/* my client, does he match ? */
else if (!(IsRegisteredUser(cptr) &&
else if (!(IsRegisteredUser(cptr) &&
match_it(cptr, mask, what)))
{
continue;
Expand Down Expand Up @@ -1033,7 +1060,7 @@ void sendto_ops_butone(aClient *one, char *from, char *pattern, ...)
va_end(va);
sendto_serv_butone(one, ":%s WALLOPS :%s", from, buf);
sendto_flag(SCH_WALLOP, "!%s! %s", from, buf);

return;
}

Expand Down Expand Up @@ -1277,7 +1304,7 @@ void logfiles_close(void)
#ifdef LOG_SERVER_CHANNELS
int i;
SChan *shptr;

for (i = SCH_MAX - 1, shptr = svchans + i; i >= 0; i--, shptr--)
{
if (shptr->fd >= 0)
Expand Down Expand Up @@ -1311,7 +1338,7 @@ void logfiles_close(void)
*/
void sendto_flog(aClient *cptr, char msg, char *username, char *hostname)
{
/*
/*
** One day we will rewrite linebuf to malloc()s, but for now
** we are lazy. The longest linebuf I saw during last year
** was 216. Max auth reply can be 1024, see rfc931_work() and
Expand Down
1 change: 1 addition & 0 deletions common/send_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ EXTERN int sendto_serv_v (aClient *one, int ver, char *pattern, ...);
EXTERN void sendto_common_channels (aClient *user, char *pattern, ...);
EXTERN void sendto_channel_butserv (aChannel *chptr, aClient *from,
char *pattern, ...);
EXTERN void sendto_channels_butserv_caps(aClient *from, int caps, char *pattern, ...);
EXTERN void sendto_channel_butserv_caps(aChannel *chptr, aClient *from, int caps, int excluded_caps,
char *pattern, ...);
EXTERN void sendto_match_servs (aChannel *chptr, aClient *from,
Expand Down
9 changes: 5 additions & 4 deletions common/struct_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ typedef struct LineItem aExtData;
#define LDELAYCHASETIMELIMIT 5400 /* WARNING: *DONT* CHANGE THIS!!!! */

#define READBUF_SIZE 16384 /* used in s_bsd.c *AND* s_zip.c ! */

/*
* Make up some numbers which should reflect average leaf server connect
* queue max size.
Expand Down Expand Up @@ -439,7 +439,7 @@ struct Zdata {
#endif

struct LineItem
{
{
char *line;
struct LineItem *next;
};
Expand Down Expand Up @@ -627,7 +627,7 @@ struct stats {
u_int is_loc; /* local connections made */
u_int is_nosrv; /* user without server */
u_long is_wwcnt; /* number of nicks overwritten in whowas[] */
unsigned long long is_wwt; /* sum of elapsed time on when
unsigned long long is_wwt; /* sum of elapsed time on when
** overwriting whowas[] */
u_long is_wwMt; /* max elapsed time on when overwriting whowas[] */
u_long is_wwmt; /* min elapsed time on when overwriting whowas[] */
Expand Down Expand Up @@ -937,7 +937,7 @@ typedef enum ServerChannels {
SCH_CLIENT,
#endif
SCH_OPER,
SCH_MAX
SCH_MAX
} ServerChannels;

/* used for async dns values */
Expand Down Expand Up @@ -1014,6 +1014,7 @@ typedef enum ServerChannels {
#define CAP_IRCNET_EXTENDED_JOIN 0x0002
#define CAP_MULTI_PREFIX 0x0004
#define CAP_SASL 0x0008
#define CAP_AWAY_NOTIFY 0x0010

/* WHO parameter flags */
#define WHO_FLAG_OPERS_ONLY 0x0001
Expand Down
Loading