Add irc_notice_pos setting

This commit is contained in:
TingPing 2013-03-09 17:09:38 -05:00
parent c76dedd9b9
commit 9924300c05
4 changed files with 35 additions and 23 deletions

View File

@ -450,7 +450,6 @@ const struct prefs vars[] =
{"gui_tab_icons", P_OFFINT (hex_gui_tab_icons), TYPE_BOOL}, {"gui_tab_icons", P_OFFINT (hex_gui_tab_icons), TYPE_BOOL},
{"gui_tab_layout", P_OFFINT (hex_gui_tab_layout), TYPE_INT}, {"gui_tab_layout", P_OFFINT (hex_gui_tab_layout), TYPE_INT},
{"gui_tab_newtofront", P_OFFINT (hex_gui_tab_newtofront), TYPE_INT}, {"gui_tab_newtofront", P_OFFINT (hex_gui_tab_newtofront), TYPE_INT},
{"gui_tab_notices", P_OFFINT (hex_gui_tab_notices), TYPE_BOOL},
{"gui_tab_pos", P_OFFINT (hex_gui_tab_pos), TYPE_INT}, {"gui_tab_pos", P_OFFINT (hex_gui_tab_pos), TYPE_INT},
{"gui_tab_server", P_OFFINT (hex_gui_tab_server), TYPE_BOOL}, {"gui_tab_server", P_OFFINT (hex_gui_tab_server), TYPE_BOOL},
{"gui_tab_small", P_OFFINT (hex_gui_tab_small), TYPE_INT}, {"gui_tab_small", P_OFFINT (hex_gui_tab_small), TYPE_INT},
@ -523,6 +522,7 @@ const struct prefs vars[] =
{"irc_nick3", P_OFFSET (hex_irc_nick3), TYPE_STR}, {"irc_nick3", P_OFFSET (hex_irc_nick3), TYPE_STR},
{"irc_nick_hilight", P_OFFSET (hex_irc_nick_hilight), TYPE_STR}, {"irc_nick_hilight", P_OFFSET (hex_irc_nick_hilight), TYPE_STR},
{"irc_no_hilight", P_OFFSET (hex_irc_no_hilight), TYPE_STR}, {"irc_no_hilight", P_OFFSET (hex_irc_no_hilight), TYPE_STR},
{"irc_notice_pos", P_OFFINT (hex_irc_notice_pos), TYPE_INT},
{"irc_part_reason", P_OFFSET (hex_irc_part_reason), TYPE_STR}, {"irc_part_reason", P_OFFSET (hex_irc_part_reason), TYPE_STR},
{"irc_quit_reason", P_OFFSET (hex_irc_quit_reason), TYPE_STR}, {"irc_quit_reason", P_OFFSET (hex_irc_quit_reason), TYPE_STR},
{"irc_raw_modes", P_OFFINT (hex_irc_raw_modes), TYPE_BOOL}, {"irc_raw_modes", P_OFFINT (hex_irc_raw_modes), TYPE_BOOL},

View File

@ -146,7 +146,6 @@ struct hexchatprefs
unsigned int hex_gui_tab_dialogs; unsigned int hex_gui_tab_dialogs;
unsigned int hex_gui_tab_dots; unsigned int hex_gui_tab_dots;
unsigned int hex_gui_tab_icons; unsigned int hex_gui_tab_icons;
unsigned int hex_gui_tab_notices;
unsigned int hex_gui_tab_server; unsigned int hex_gui_tab_server;
unsigned int hex_gui_tab_sort; unsigned int hex_gui_tab_sort;
unsigned int hex_gui_tab_utils; unsigned int hex_gui_tab_utils;
@ -276,6 +275,7 @@ struct hexchatprefs
int hex_input_balloon_time; int hex_input_balloon_time;
int hex_irc_ban_type; int hex_irc_ban_type;
int hex_irc_join_delay; int hex_irc_join_delay;
int hex_irc_notice_pos;
int hex_net_ping_timeout; int hex_net_ping_timeout;
int hex_net_proxy_port; int hex_net_proxy_port;
int hex_net_proxy_type; /* 0=disabled, 1=wingate 2=socks4, 3=socks5, 4=http */ int hex_net_proxy_type; /* 0=disabled, 1=wingate 2=socks4, 3=socks5, 4=http */

View File

@ -867,7 +867,27 @@ inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip, int id)
if (!sess) if (!sess)
{ {
ptr = 0; ptr = 0;
if (prefs.hex_gui_tab_notices) if (prefs.hex_irc_notice_pos == 0)
{
/* paranoia check */
if (msg[0] == '[' && (!serv->have_idmsg || id))
{
/* guess where chanserv meant to post this -sigh- */
if (!g_ascii_strcasecmp (nick, "ChanServ") && !find_dialog (serv, nick))
{
char *dest = strdup (msg + 1);
char *end = strchr (dest, ']');
if (end)
{
*end = 0;
sess = find_channel (serv, dest);
}
free (dest);
}
}
if (!sess)
sess = find_session_from_nick (nick, serv);
} else if (prefs.hex_irc_notice_pos == 1)
{ {
int stype = server_notice ? SESS_SNOTICES : SESS_NOTICES; int stype = server_notice ? SESS_SNOTICES : SESS_NOTICES;
sess = find_session_from_type (stype, serv); sess = find_session_from_type (stype, serv);
@ -888,25 +908,9 @@ inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip, int id)
msg += 14; msg += 14;
} else } else
{ {
/* paranoia check */ sess = serv->front_session;
if (msg[0] == '[' && (!serv->have_idmsg || id))
{
/* guess where chanserv meant to post this -sigh- */
if (!g_ascii_strcasecmp (nick, "ChanServ") && !find_dialog (serv, nick))
{
char *dest = strdup (msg + 1);
char *end = strchr (dest, ']');
if (end)
{
*end = 0;
sess = find_channel (serv, dest);
}
free (dest);
}
}
if (!sess)
sess = find_session_from_nick (nick, serv);
} }
if (!sess) if (!sess)
{ {
if (server_notice) if (server_notice)

View File

@ -321,6 +321,14 @@ static const char *const focusnewtabsmenu[] =
NULL NULL
}; };
static const char *const noticeposmenu[] =
{
N_("Automatic"),
N_("In an extra tab"),
N_("In the front tab"),
NULL
};
static const char *const swtype[] = static const char *const swtype[] =
{ {
N_("Tabs"), /* 0 tabs */ N_("Tabs"), /* 0 tabs */
@ -334,13 +342,13 @@ static const setting tabs_settings[] =
/*{ST_HEADER, N_("Channel Switcher"),0,0,0},*/ /*{ST_HEADER, N_("Channel Switcher"),0,0,0},*/
{ST_RADIO, N_("Switcher type:"),P_OFFINTNL(hex_gui_tab_layout), 0, swtype, 0}, {ST_RADIO, N_("Switcher type:"),P_OFFINTNL(hex_gui_tab_layout), 0, swtype, 0},
{ST_TOGGLE, N_("Open an extra tab for server messages"), P_OFFINTNL(hex_gui_tab_server), 0, 0, 0}, {ST_TOGGLE, N_("Open an extra tab for server messages"), P_OFFINTNL(hex_gui_tab_server), 0, 0, 0},
{ST_TOGGLE, N_("Open an extra tab for server notices"), P_OFFINTNL(hex_gui_tab_notices), 0, 0, 0},
{ST_TOGGLE, N_("Open a new tab when you receive a private message"), P_OFFINTNL(hex_gui_autoopen_dialog), 0, 0, 0}, {ST_TOGGLE, N_("Open a new tab when you receive a private message"), P_OFFINTNL(hex_gui_autoopen_dialog), 0, 0, 0},
{ST_TOGGLE, N_("Sort tabs in alphabetical order"), P_OFFINTNL(hex_gui_tab_sort), 0, 0, 0}, {ST_TOGGLE, N_("Sort tabs in alphabetical order"), P_OFFINTNL(hex_gui_tab_sort), 0, 0, 0},
{ST_TOGGLE, N_("Show icons in the channel tree"), P_OFFINTNL(hex_gui_tab_icons), 0, 0, 0}, {ST_TOGGLE, N_("Show icons in the channel tree"), P_OFFINTNL(hex_gui_tab_icons), 0, 0, 0},
{ST_TOGGLE, N_("Show dotted lines in the channel tree"), P_OFFINTNL(hex_gui_tab_dots), 0, 0, 0}, {ST_TOGGLE, N_("Show dotted lines in the channel tree"), P_OFFINTNL(hex_gui_tab_dots), 0, 0, 0},
{ST_TOGGLE, N_("Smaller text"), P_OFFINTNL(hex_gui_tab_small), 0, 0, 0}, {ST_TOGGLE, N_("Smaller text"), P_OFFINTNL(hex_gui_tab_small), 0, 0, 0},
{ST_MENU, N_("Focus new tabs:"), P_OFFINTNL(hex_gui_tab_newtofront), 0, focusnewtabsmenu, 0}, {ST_MENU, N_("Focus new tabs:"), P_OFFINTNL(hex_gui_tab_newtofront), 0, focusnewtabsmenu, 0},
{ST_MENU, N_("Notice placement:"), P_OFFINTNL(hex_irc_notice_pos), 0, noticeposmenu, 0},
{ST_MENU, N_("Show channel switcher at:"), P_OFFINTNL(hex_gui_tab_pos), 0, cspos, 1}, {ST_MENU, N_("Show channel switcher at:"), P_OFFINTNL(hex_gui_tab_pos), 0, cspos, 1},
{ST_NUMBER, N_("Shorten tab labels to:"), P_OFFINTNL(hex_gui_tab_trunc), 0, (const char **)N_("letters."), 99}, {ST_NUMBER, N_("Shorten tab labels to:"), P_OFFINTNL(hex_gui_tab_trunc), 0, (const char **)N_("letters."), 99},