213 |
|
dlink_node *node = NULL; |
214 |
|
char ubuf[IRCD_BUFSIZE] = ""; |
215 |
|
|
216 |
< |
if (MyConnect(source_p)) |
217 |
< |
send_umode(source_p, source_p, 0, ubuf); |
218 |
< |
else |
219 |
< |
send_umode(NULL, source_p, 0, ubuf); |
220 |
< |
|
216 |
> |
send_umode(source_p, MyConnect(source_p), 0, ubuf); |
217 |
|
watch_check_hash(source_p, RPL_LOGON); |
218 |
|
|
219 |
|
if (ubuf[0] == '\0') |
656 |
|
return p - nickname <= NICKLEN; |
657 |
|
} |
658 |
|
|
659 |
< |
/* send_umode() |
660 |
< |
* send the MODE string for user (user) to connection client_p |
661 |
< |
* -avalon |
662 |
< |
* |
663 |
< |
* inputs - client_p |
668 |
< |
* - source_p |
669 |
< |
* - int old |
670 |
< |
* - suplied umode_buf |
671 |
< |
* output - NONE |
659 |
> |
/*! \brief Builds a mode change string to buffer pointed by \a buf |
660 |
> |
* \param client_p Pointer to client |
661 |
> |
* \param send Whether to send a MODE message to client_p |
662 |
> |
* \param old Old user mode to compare against when building new mode buffer |
663 |
> |
* \param buf Pointer to buffer to build string in |
664 |
|
*/ |
665 |
|
void |
666 |
< |
send_umode(struct Client *client_p, struct Client *source_p, |
667 |
< |
unsigned int old, char *umode_buf) |
666 |
> |
send_umode(struct Client *client_p, unsigned int send, |
667 |
> |
unsigned int old, char *buf) |
668 |
|
{ |
669 |
< |
char *m = umode_buf; |
669 |
> |
char *m = buf; |
670 |
|
int what = 0; |
671 |
|
|
672 |
|
/* |
675 |
|
*/ |
676 |
|
for (const struct user_modes *tab = umode_tab; tab->c; ++tab) |
677 |
|
{ |
678 |
< |
if ((tab->flag & old) && !HasUMode(source_p, tab->flag)) |
678 |
> |
if ((tab->flag & old) && !HasUMode(client_p, tab->flag)) |
679 |
|
{ |
680 |
|
if (what == MODE_DEL) |
681 |
|
*m++ = tab->c; |
686 |
|
*m++ = tab->c; |
687 |
|
} |
688 |
|
} |
689 |
< |
else if (!(tab->flag & old) && HasUMode(source_p, tab->flag)) |
689 |
> |
else if (!(tab->flag & old) && HasUMode(client_p, tab->flag)) |
690 |
|
{ |
691 |
|
if (what == MODE_ADD) |
692 |
|
*m++ = tab->c; |
701 |
|
|
702 |
|
*m = '\0'; |
703 |
|
|
704 |
< |
if (*umode_buf && client_p) |
704 |
> |
if (send && *buf) |
705 |
|
sendto_one(client_p, ":%s!%s@%s MODE %s :%s", |
706 |
|
client_p->name, client_p->username, |
707 |
< |
client_p->host, client_p->name, umode_buf); |
707 |
> |
client_p->host, client_p->name, buf); |
708 |
|
} |
709 |
|
|
710 |
|
/* send_umode_out() |
718 |
|
{ |
719 |
|
char buf[IRCD_BUFSIZE] = ""; |
720 |
|
|
721 |
< |
send_umode(MyClient(source_p) ? source_p : NULL, source_p, old, buf); |
721 |
> |
send_umode(source_p, MyClient(source_p), old, buf); |
722 |
|
|
723 |
|
if (buf[0]) |
724 |
|
sendto_server(source_p, 0, 0, ":%s MODE %s :%s", |