mirror of
https://github.com/irssi/irssi.git
synced 2026-08-11 04:43:34 +02:00
Config file: ircnets -> chatnets, added type = "chat protocol" to
chatnet config. Moved reading chatnets to core. Lots of other multiprotocol updates. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1237 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
513e140bce
commit
be6ba53fa4
35 changed files with 539 additions and 448 deletions
|
|
@ -27,6 +27,8 @@
|
|||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include "chat-protocols.h"
|
||||
#include "chatnets.h"
|
||||
#include "channels.h"
|
||||
#include "channels-setup.h"
|
||||
#include "nicklist.h"
|
||||
|
|
@ -232,6 +234,7 @@ static void cmd_channel(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
|
|||
static void cmd_channel_add(const char *data)
|
||||
{
|
||||
GHashTable *optlist;
|
||||
CHATNET_REC *chatnetrec;
|
||||
CHANNEL_SETUP_REC *rec;
|
||||
char *botarg, *botcmdarg, *chatnet, *channel, *password;
|
||||
void *free_arg;
|
||||
|
|
@ -240,14 +243,23 @@ static void cmd_channel_add(const char *data)
|
|||
"channel add", &optlist, &channel, &chatnet, &password))
|
||||
return;
|
||||
|
||||
if (*chatnet == '\0' || *channel == '\0')
|
||||
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
|
||||
chatnetrec = chatnet_find(chatnet);
|
||||
if (chatnetrec == NULL) {
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||
TXT_UNKNOWN_CHATNET, chatnet);
|
||||
cmd_params_free(free_arg);
|
||||
return;
|
||||
}
|
||||
|
||||
botarg = g_hash_table_lookup(optlist, "bots");
|
||||
botcmdarg = g_hash_table_lookup(optlist, "botcmd");
|
||||
|
||||
if (*chatnet == '\0' || *channel == '\0')
|
||||
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
rec = channels_setup_find(channel, chatnet);
|
||||
rec = channel_setup_find(channel, chatnet);
|
||||
if (rec == NULL) {
|
||||
rec = g_new0(CHANNEL_SETUP_REC, 1);
|
||||
rec = CHAT_PROTOCOL(chatnetrec)->create_channel_setup();
|
||||
rec->name = g_strdup(channel);
|
||||
rec->chatnet = g_strdup(chatnet);
|
||||
} else {
|
||||
|
|
@ -260,8 +272,12 @@ static void cmd_channel_add(const char *data)
|
|||
if (botarg != NULL && *botarg != '\0') rec->botmasks = g_strdup(botarg);
|
||||
if (botcmdarg != NULL && *botcmdarg != '\0') rec->autosendcmd = g_strdup(botcmdarg);
|
||||
if (*password != '\0' && strcmp(password, "-") != 0) rec->password = g_strdup(password);
|
||||
channels_setup_create(rec);
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_CHANSETUP_ADDED, channel, chatnet);
|
||||
|
||||
signal_emit("channel add fill", 2, rec, optlist);
|
||||
|
||||
channel_setup_create(rec);
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||
TXT_CHANSETUP_ADDED, channel, chatnet);
|
||||
|
||||
cmd_params_free(free_arg);
|
||||
}
|
||||
|
|
@ -278,12 +294,12 @@ static void cmd_channel_remove(const char *data)
|
|||
if (*chatnet == '\0' || *channel == '\0')
|
||||
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
|
||||
rec = channels_setup_find(channel, chatnet);
|
||||
rec = channel_setup_find(channel, chatnet);
|
||||
if (rec == NULL)
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_CHANSETUP_NOT_FOUND, channel, chatnet);
|
||||
else {
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_CHANSETUP_REMOVED, channel, chatnet);
|
||||
channels_setup_destroy(rec);
|
||||
channel_setup_remove(rec);
|
||||
}
|
||||
cmd_params_free(free_arg);
|
||||
}
|
||||
|
|
@ -317,6 +333,10 @@ static void display_sorted_nicks(CHANNEL_REC *channel, GSList *nicklist)
|
|||
g_free(stripped);
|
||||
g_free(format);
|
||||
|
||||
if (settings_get_int("names_max_width") > 0 &&
|
||||
max_width > settings_get_int("names_max_width"))
|
||||
max_width = settings_get_int("names_max_width");
|
||||
|
||||
/* remove width of timestamp from max_width */
|
||||
format_create_dest(&dest, channel->server, channel->name,
|
||||
MSGLEVEL_CLIENTCRAP, NULL);
|
||||
|
|
@ -329,10 +349,6 @@ static void display_sorted_nicks(CHANNEL_REC *channel, GSList *nicklist)
|
|||
}
|
||||
|
||||
/* calculate columns */
|
||||
if (settings_get_int("names_max_width") > 0 &&
|
||||
max_width > settings_get_int("names_max_width"))
|
||||
max_width = settings_get_int("names_max_width");
|
||||
|
||||
cols = get_max_column_count(nicklist, get_nick_length, max_width,
|
||||
settings_get_int("names_max_columns"),
|
||||
item_extra, 3, &columns, &rows);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue