mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
revert core changes
This commit is contained in:
parent
7b09cac9ec
commit
8b1afbd355
@ -73,22 +73,12 @@ const char *get_irssi_dir(void)
|
||||
return irssi_dir;
|
||||
}
|
||||
|
||||
void set_irssi_dir(char *const s)
|
||||
{
|
||||
irssi_dir = s;
|
||||
}
|
||||
|
||||
/* return full path for ~/.irssi/config */
|
||||
const char *get_irssi_config(void)
|
||||
{
|
||||
return irssi_config_file;
|
||||
}
|
||||
|
||||
void set_irssi_config(char *const s)
|
||||
{
|
||||
irssi_config_file = s;
|
||||
}
|
||||
|
||||
static void sig_reload_config(int signo)
|
||||
{
|
||||
reload_config = TRUE;
|
||||
|
@ -16,9 +16,6 @@ extern int irssi_init_finished; /* TRUE after "irssi init finished" signal is se
|
||||
extern int reload_config; /* TRUE after received SIGHUP. */
|
||||
extern time_t client_start_time;
|
||||
|
||||
void set_irssi_dir(char *const);
|
||||
void set_irssi_config(char *const);
|
||||
|
||||
void core_preinit(const char *path);
|
||||
|
||||
void core_register_options(void);
|
||||
|
@ -29,9 +29,6 @@
|
||||
#include "irc-servers.h"
|
||||
#include "irc-channels.h"
|
||||
|
||||
static void set_topic_info(CHANNEL_REC *const, char const *const,
|
||||
time_t const);
|
||||
|
||||
static void check_join_failure(IRC_SERVER_REC *server, const char *channel)
|
||||
{
|
||||
CHANNEL_REC *chanrec;
|
||||
@ -130,51 +127,27 @@ static void channel_change_topic(IRC_SERVER_REC *server, const char *channel,
|
||||
|
||||
chanrec = channel_find(SERVER(server), channel);
|
||||
if (chanrec == NULL) return;
|
||||
|
||||
g_free_and_null(chanrec->topic);
|
||||
g_free_and_null(chanrec->topic_by);
|
||||
chanrec->topic_time = 0;
|
||||
|
||||
/* the topic may be sent out encoded, so we need to
|
||||
/* the topic may be send out encoded, so we need to
|
||||
recode it back or /topic <tab> will not work properly */
|
||||
recoded = recode_in(SERVER(server), topic, channel);
|
||||
if (recoded == NULL || *recoded == '\0') {
|
||||
signal_emit("channel topic changed", 1, chanrec);
|
||||
if (topic != NULL) {
|
||||
g_free_not_null(chanrec->topic);
|
||||
chanrec->topic = recoded == NULL ? NULL : g_strdup(recoded);
|
||||
}
|
||||
g_free(recoded);
|
||||
return;
|
||||
}
|
||||
|
||||
chanrec->topic = recoded;
|
||||
set_topic_info(chanrec, setby, settime);
|
||||
|
||||
signal_emit("channel topic changed", 1, chanrec);
|
||||
}
|
||||
|
||||
static void channel_change_topic_info(IRC_SERVER_REC *server,
|
||||
const char *channel, const char *setby, time_t settime)
|
||||
{
|
||||
CHANNEL_REC *chanrec;
|
||||
|
||||
chanrec = channel_find(SERVER(server), channel);
|
||||
if (chanrec == NULL) return;
|
||||
|
||||
g_free_and_null(chanrec->topic_by);
|
||||
chanrec->topic_time = 0;
|
||||
|
||||
set_topic_info(chanrec, setby, settime);
|
||||
|
||||
signal_emit("channel topic changed", 1, chanrec);
|
||||
}
|
||||
|
||||
static void set_topic_info(CHANNEL_REC *const chanrec, char const *const setby,
|
||||
time_t const settime)
|
||||
{
|
||||
g_free_not_null(chanrec->topic_by);
|
||||
chanrec->topic_by = g_strdup(setby);
|
||||
if (chanrec->topic_by != NULL) {
|
||||
|
||||
if (chanrec->topic_by == NULL) {
|
||||
/* ensure invariant topic_time > 0 <=> topic_by != NULL.
|
||||
this could be triggered by a topic command without sender */
|
||||
chanrec->topic_time = 0;
|
||||
} else {
|
||||
chanrec->topic_time = settime;
|
||||
}
|
||||
|
||||
signal_emit("channel topic changed", 1, chanrec);
|
||||
}
|
||||
|
||||
static void event_topic_get(IRC_SERVER_REC *server, const char *data)
|
||||
@ -214,7 +187,7 @@ static void event_topic_info(IRC_SERVER_REC *server, const char *data)
|
||||
&topicby, &topictime);
|
||||
|
||||
t = (time_t) atol(topictime);
|
||||
channel_change_topic_info(server, channel, topicby, t);
|
||||
channel_change_topic(server, channel, NULL, topicby, t);
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <settings.h>
|
||||
#include <signals.h>
|
||||
#include <time.h>
|
||||
#include <args.h>
|
||||
|
||||
#define MODULE_NAME "test-channel-events"
|
||||
|
||||
@ -87,10 +88,11 @@ int main(int argc, char **argv)
|
||||
|
||||
g_test_init(&argc, &argv, NULL);
|
||||
|
||||
core_preinit(*argv);
|
||||
irssi_gui = IRSSI_GUI_NONE;
|
||||
|
||||
modules_init();
|
||||
signals_init();
|
||||
set_irssi_dir("/tmp/irssi");
|
||||
set_irssi_config("/tmp/irssi/config");
|
||||
settings_init();
|
||||
recode_init();
|
||||
channel_events_init();
|
||||
|
Loading…
Reference in New Issue
Block a user