mirror of
https://github.com/irssi/irssi.git
synced 2026-08-11 04:43:34 +02:00
Channel mode handling changed - there's no more mode_xxx fields in
channel structure, but instead just one mode string field. Also handling half-ops (+h) should work right. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@617 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
7cbd164e75
commit
67cc9af1bd
15 changed files with 351 additions and 232 deletions
|
|
@ -62,6 +62,7 @@ CHANNEL_REC *channel_create(IRC_SERVER_REC *server, const char *channel, int aut
|
|||
rec->name = g_strdup(channel);
|
||||
rec->server = server;
|
||||
rec->createtime = time(NULL);
|
||||
rec->mode = g_strdup("");
|
||||
|
||||
if (*channel == '+')
|
||||
rec->no_modes = TRUE;
|
||||
|
|
@ -126,34 +127,6 @@ CHANNEL_REC *channel_find(IRC_SERVER_REC *server, const char *channel)
|
|||
}
|
||||
|
||||
|
||||
char *channel_get_mode(CHANNEL_REC *channel)
|
||||
{
|
||||
GString *mode;
|
||||
char *ret;
|
||||
|
||||
g_return_val_if_fail(channel != NULL, NULL);
|
||||
|
||||
mode = g_string_new(NULL);
|
||||
|
||||
if (channel->mode_secret) g_string_append_c(mode, 's');
|
||||
if (channel->mode_private) g_string_append_c(mode, 'p');
|
||||
if (channel->mode_moderate) g_string_append_c(mode, 'm');
|
||||
if (channel->mode_invite) g_string_append_c(mode, 'i');
|
||||
if (channel->mode_nomsgs) g_string_append_c(mode, 'n');
|
||||
if (channel->mode_optopic) g_string_append_c(mode, 't');
|
||||
if (channel->mode_anonymous) g_string_append_c(mode, 'a');
|
||||
if (channel->mode_reop) g_string_append_c(mode, 'r');
|
||||
if (channel->mode_key) g_string_append_c(mode, 'k');
|
||||
if (channel->limit > 0) g_string_append_c(mode, 'l');
|
||||
|
||||
if (channel->mode_key) g_string_sprintfa(mode, " %s", channel->key);
|
||||
if (channel->limit > 0) g_string_sprintfa(mode, " %d", channel->limit);
|
||||
|
||||
ret = mode->str;
|
||||
g_string_free(mode, FALSE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define get_join_key(key) \
|
||||
(((key) == NULL || *(key) == '\0') ? "x" : (key))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue