Add has_common_channel(), which is needed by umode +G.

This commit is contained in:
B.Greenham 2010-02-25 19:15:13 -05:00
parent 61ffa214b4
commit c279d43b75
2 changed files with 22 additions and 0 deletions

View File

@ -243,6 +243,8 @@ extern void del_invite(struct Channel *chptr, struct Client *who);
const char *channel_modes(struct Channel *chptr, struct Client *who);
extern int has_common_channel(struct Client *client1, struct Client *client2);
extern struct Channel *find_bannickchange_channel(struct Client *client_p);
extern struct Channel *find_nonickchange_channel(struct Client *client_p);

View File

@ -1110,6 +1110,26 @@ set_channel_topic(struct Channel *chptr, const char *topic, const char *topic_in
}
}
/* has_common_channel()
*
* input - pointer to client
* - pointer to another client
* output - 1 if the two have a channel in common, 0 elsewise
* side effects - none
*/
int
has_common_channel(struct Client *client1, struct Client *client2)
{
rb_dlink_node *ptr;
RB_DLINK_FOREACH(ptr, client1->user->channel.head)
{
if(IsMember(client2, ((struct membership *)ptr->data)->chptr))
return 1;
}
return;
}
/* channel_modes()
*
* inputs - pointer to channel