degesch: refactoring
This commit is contained in:
parent
7f57bed563
commit
4bac248c50
27
degesch.c
27
degesch.c
|
@ -2809,12 +2809,21 @@ irc_make_channel (struct server *s, char *name)
|
||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct channel_user *
|
||||||
irc_remove_user_from_channel (struct user *user, struct channel *channel)
|
irc_channel_get_user (struct channel *channel, struct user *user)
|
||||||
{
|
{
|
||||||
LIST_FOR_EACH (struct channel_user, iter, channel->users)
|
LIST_FOR_EACH (struct channel_user, iter, channel->users)
|
||||||
if (iter->user == user)
|
if (iter->user == user)
|
||||||
irc_channel_unlink_user (channel, iter);
|
return iter;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
irc_remove_user_from_channel (struct user *user, struct channel *channel)
|
||||||
|
{
|
||||||
|
struct channel_user *channel_user = irc_channel_get_user (channel, user);
|
||||||
|
if (channel_user)
|
||||||
|
irc_channel_unlink_user (channel, channel_user);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -3966,16 +3975,10 @@ mode_processor_do_user (struct mode_processor *self)
|
||||||
{
|
{
|
||||||
const char *nickname;
|
const char *nickname;
|
||||||
struct user *user;
|
struct user *user;
|
||||||
|
struct channel_user *channel_user;
|
||||||
if (!(nickname = mode_processor_next_param (self))
|
if (!(nickname = mode_processor_next_param (self))
|
||||||
|| !(user = str_map_find (&self->s->irc_users, nickname)))
|
|| !(user = str_map_find (&self->s->irc_users, nickname))
|
||||||
return;
|
|| !(channel_user = irc_channel_get_user (self->channel, user)))
|
||||||
|
|
||||||
// TODO: factor out, also use in unlink_user or whatever
|
|
||||||
struct channel_user *channel_user = NULL;
|
|
||||||
LIST_FOR_EACH (struct channel_user, iter, self->channel->users)
|
|
||||||
if (iter->user == user)
|
|
||||||
channel_user = iter;
|
|
||||||
if (!channel_user)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const char *all_prefixes = self->s->irc_chanuser_prefixes;
|
const char *all_prefixes = self->s->irc_chanuser_prefixes;
|
||||||
|
|
Loading…
Reference in New Issue