mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Added /SET reuse_unused_windows setting, default is OFF
If window_close_on_part is ON, we don't anymore close the window if we get kicked or connection gets lost. Also don't close DCC chat window if the other side disconnects. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@357 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
234e95ef94
commit
8ea2400269
@ -76,9 +76,6 @@ void window_remove_item(WINDOW_REC *window, WI_ITEM_REC *item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
signal_emit("window item remove", 2, window, item);
|
signal_emit("window item remove", 2, window, item);
|
||||||
|
|
||||||
if (settings_get_bool("window_close_on_part") && windows->next != NULL)
|
|
||||||
window_destroy(window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WINDOW_REC *window_item_window(WI_ITEM_REC *item)
|
WINDOW_REC *window_item_window(WI_ITEM_REC *item)
|
||||||
@ -237,19 +234,22 @@ void window_item_create(WI_ITEM_REC *item, int automatic)
|
|||||||
WINDOW_REC *window;
|
WINDOW_REC *window;
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
char *str;
|
char *str;
|
||||||
int clear_waiting;
|
int clear_waiting, reuse_unused_windows;
|
||||||
|
|
||||||
g_return_if_fail(item != NULL);
|
g_return_if_fail(item != NULL);
|
||||||
|
|
||||||
str = item->server == NULL ? NULL :
|
str = item->server == NULL ? NULL :
|
||||||
g_strdup_printf("%s %s", ((SERVER_REC *) item->server)->tag, item->name);
|
g_strdup_printf("%s %s", ((SERVER_REC *) item->server)->tag, item->name);
|
||||||
|
|
||||||
|
reuse_unused_windows = settings_get_bool("reuse_unused_windows");
|
||||||
|
|
||||||
clear_waiting = TRUE;
|
clear_waiting = TRUE;
|
||||||
window = NULL;
|
window = NULL;
|
||||||
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
|
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
|
||||||
WINDOW_REC *rec = tmp->data;
|
WINDOW_REC *rec = tmp->data;
|
||||||
|
|
||||||
if (rec->items == NULL && rec->level == 0 &&
|
if (reuse_unused_windows &&
|
||||||
|
rec->items == NULL && rec->level == 0 &&
|
||||||
(window == NULL || rec == active_win)) {
|
(window == NULL || rec == active_win)) {
|
||||||
/* no items in this window, we should probably use it.. */
|
/* no items in this window, we should probably use it.. */
|
||||||
window = rec;
|
window = rec;
|
||||||
@ -297,7 +297,7 @@ static void signal_window_item_changed(WINDOW_REC *window, WI_ITEM_REC *item)
|
|||||||
|
|
||||||
void window_items_init(void)
|
void window_items_init(void)
|
||||||
{
|
{
|
||||||
settings_add_bool("lookandfeel", "window_close_on_part", TRUE);
|
settings_add_bool("lookandfeel", "reuse_unused_windows", FALSE);
|
||||||
|
|
||||||
signal_add_last("window item changed", (SIGNAL_FUNC) signal_window_item_changed);
|
signal_add_last("window item changed", (SIGNAL_FUNC) signal_window_item_changed);
|
||||||
}
|
}
|
||||||
|
@ -264,6 +264,7 @@ static void sig_dcc_destroyed(DCC_REC *dcc)
|
|||||||
|
|
||||||
if (query != NULL) {
|
if (query != NULL) {
|
||||||
/* DCC chat closed, close the query with it. */
|
/* DCC chat closed, close the query with it. */
|
||||||
|
if (dcc->connection_lost) query->unwanted = TRUE;
|
||||||
query_destroy(query);
|
query_destroy(query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
#include "levels.h"
|
#include "levels.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
#include "irc.h"
|
#include "irc.h"
|
||||||
#include "channels.h"
|
#include "channels.h"
|
||||||
@ -54,7 +55,14 @@ static void signal_channel_destroyed(CHANNEL_REC *channel)
|
|||||||
g_return_if_fail(channel != NULL);
|
g_return_if_fail(channel != NULL);
|
||||||
|
|
||||||
window = window_item_window((WI_ITEM_REC *) channel);
|
window = window_item_window((WI_ITEM_REC *) channel);
|
||||||
if (window != NULL) window_remove_item(window, (WI_ITEM_REC *) channel);
|
if (window != NULL) {
|
||||||
|
window_remove_item(window, (WI_ITEM_REC *) channel);
|
||||||
|
|
||||||
|
if (windows->next != NULL && (!channel->joined || channel->left) &&
|
||||||
|
settings_get_bool("window_close_on_part")) {
|
||||||
|
window_destroy(window);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void signal_window_item_removed(WINDOW_REC *window, WI_ITEM_REC *item)
|
static void signal_window_item_removed(WINDOW_REC *window, WI_ITEM_REC *item)
|
||||||
@ -235,6 +243,8 @@ static void cmd_channel_remove(const char *data)
|
|||||||
|
|
||||||
void fe_channels_init(void)
|
void fe_channels_init(void)
|
||||||
{
|
{
|
||||||
|
settings_add_bool("lookandfeel", "window_close_on_part", TRUE);
|
||||||
|
|
||||||
signal_add("channel created", (SIGNAL_FUNC) signal_channel_created);
|
signal_add("channel created", (SIGNAL_FUNC) signal_channel_created);
|
||||||
signal_add("channel destroyed", (SIGNAL_FUNC) signal_channel_destroyed);
|
signal_add("channel destroyed", (SIGNAL_FUNC) signal_channel_destroyed);
|
||||||
signal_add("window item remove", (SIGNAL_FUNC) signal_window_item_removed);
|
signal_add("window item remove", (SIGNAL_FUNC) signal_window_item_removed);
|
||||||
|
@ -68,7 +68,13 @@ static void signal_query_destroyed(QUERY_REC *query)
|
|||||||
g_return_if_fail(query != NULL);
|
g_return_if_fail(query != NULL);
|
||||||
|
|
||||||
window = window_item_window((WI_ITEM_REC *) query);
|
window = window_item_window((WI_ITEM_REC *) query);
|
||||||
if (window != NULL) window_remove_item(window, (WI_ITEM_REC *) query);
|
if (window != NULL) {
|
||||||
|
window_remove_item(window, (WI_ITEM_REC *) query);
|
||||||
|
|
||||||
|
if (windows->next != NULL && !query->unwanted &&
|
||||||
|
settings_get_bool("window_close_on_part"))
|
||||||
|
window_destroy(window);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void signal_window_item_removed(WINDOW_REC *window, WI_ITEM_REC *item)
|
static void signal_window_item_removed(WINDOW_REC *window, WI_ITEM_REC *item)
|
||||||
|
@ -14,6 +14,7 @@ typedef struct {
|
|||||||
|
|
||||||
char *address;
|
char *address;
|
||||||
char *server_tag;
|
char *server_tag;
|
||||||
|
int unwanted:1; /* TRUE if the other side closed or some error occured (DCC chats!) */
|
||||||
int destroying:1;
|
int destroying:1;
|
||||||
} QUERY_REC;
|
} QUERY_REC;
|
||||||
|
|
||||||
|
@ -166,6 +166,7 @@ static void dcc_chat_input(DCC_REC *dcc)
|
|||||||
ret = line_split(tmpbuf, recvlen, &str, (LINEBUF_REC **) &dcc->databuf);
|
ret = line_split(tmpbuf, recvlen, &str, (LINEBUF_REC **) &dcc->databuf);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
/* connection lost */
|
/* connection lost */
|
||||||
|
dcc->connection_lost = TRUE;
|
||||||
signal_emit("dcc closed", 1, dcc);
|
signal_emit("dcc closed", 1, dcc);
|
||||||
dcc_destroy(dcc);
|
dcc_destroy(dcc);
|
||||||
break;
|
break;
|
||||||
|
@ -53,6 +53,7 @@ typedef struct DCC_REC {
|
|||||||
int gotalldata:1; /* DCC fast send: got all acks from the other end (needed to make sure the end of transfer works right) */
|
int gotalldata:1; /* DCC fast send: got all acks from the other end (needed to make sure the end of transfer works right) */
|
||||||
|
|
||||||
int mirc_ctcp:1; /* DCC chat: Send CTCPs without the CTCP_MESSAGE prefix */
|
int mirc_ctcp:1; /* DCC chat: Send CTCPs without the CTCP_MESSAGE prefix */
|
||||||
|
int connection_lost:1; /* DCC chat: other side closed connection */
|
||||||
int destroyed:1; /* We're about to destroy this DCC recond */
|
int destroyed:1; /* We're about to destroy this DCC recond */
|
||||||
|
|
||||||
/* read/write counter buffer */
|
/* read/write counter buffer */
|
||||||
|
Loading…
Reference in New Issue
Block a user