mirror of
https://github.com/osmarks/ngircd.git
synced 2024-12-12 09:50:29 +00:00
Convert more code to use Channel_HasMode
This commit is contained in:
parent
c74115f25c
commit
74514b8c23
@ -657,7 +657,7 @@ IRC_LIST( CLIENT *Client, REQUEST *Req )
|
|||||||
GLOBAL bool
|
GLOBAL bool
|
||||||
IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
|
IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
|
||||||
{
|
{
|
||||||
char modes_add[COMMAND_LEN], l[16], *ptr;
|
char modes_add[COMMAND_LEN], l[16];
|
||||||
CLIENT *from;
|
CLIENT *from;
|
||||||
CHANNEL *chan;
|
CHANNEL *chan;
|
||||||
int arg_topic;
|
int arg_topic;
|
||||||
@ -688,9 +688,8 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
|
|||||||
return CONNECTED;
|
return CONNECTED;
|
||||||
|
|
||||||
if (Req->argv[1][0] == '+') {
|
if (Req->argv[1][0] == '+') {
|
||||||
ptr = Channel_Modes(chan);
|
if (!Channel_Modes(chan)) {
|
||||||
if (!*ptr) {
|
/* OK, this channel doesn't have modes yet,
|
||||||
/* OK, this channel doesn't have modes jet,
|
|
||||||
* set the received ones: */
|
* set the received ones: */
|
||||||
Channel_SetModes(chan, &Req->argv[1][1]);
|
Channel_SetModes(chan, &Req->argv[1][1]);
|
||||||
|
|
||||||
@ -706,21 +705,15 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
|
|||||||
}
|
}
|
||||||
|
|
||||||
strcpy(modes_add, "");
|
strcpy(modes_add, "");
|
||||||
ptr = Channel_Modes(chan);
|
if (Channel_HasMode(chan, 'l')) {
|
||||||
while (*ptr) {
|
snprintf(l, sizeof(l), " %lu",
|
||||||
if (*ptr == 'l') {
|
Channel_MaxUsers(chan));
|
||||||
snprintf(l, sizeof(l), " %lu",
|
strlcat(modes_add, l, sizeof(modes_add));
|
||||||
Channel_MaxUsers(chan));
|
}
|
||||||
strlcat(modes_add, l,
|
if (Channel_HasMode(chan, 'k')) {
|
||||||
sizeof(modes_add));
|
strlcat(modes_add, " ", sizeof(modes_add));
|
||||||
}
|
strlcat(modes_add, Channel_Key(chan),
|
||||||
if (*ptr == 'k') {
|
sizeof(modes_add));
|
||||||
strlcat(modes_add, " ",
|
|
||||||
sizeof(modes_add));
|
|
||||||
strlcat(modes_add, Channel_Key(chan),
|
|
||||||
sizeof(modes_add));
|
|
||||||
}
|
|
||||||
ptr++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Inform members of this channel */
|
/* Inform members of this channel */
|
||||||
@ -734,8 +727,7 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
|
|||||||
|
|
||||||
if (arg_topic > 0) {
|
if (arg_topic > 0) {
|
||||||
/* We got a topic */
|
/* We got a topic */
|
||||||
ptr = Channel_Topic( chan );
|
if (!Channel_Topic( chan ) && Req->argv[arg_topic][0]) {
|
||||||
if (!*ptr && Req->argv[arg_topic][0]) {
|
|
||||||
/* OK, there is no topic jet */
|
/* OK, there is no topic jet */
|
||||||
Channel_SetTopic(chan, Client, Req->argv[arg_topic]);
|
Channel_SetTopic(chan, Client, Req->argv[arg_topic]);
|
||||||
IRC_WriteStrChannelPrefix(Client, chan, from, false,
|
IRC_WriteStrChannelPrefix(Client, chan, from, false,
|
||||||
|
Loading…
Reference in New Issue
Block a user