1
0
mirror of https://github.com/irssi/irssi.git synced 2024-06-23 06:35:36 +00:00

Merge pull request #962 from horgh/horgh/comments-and-indentation

Fix some indentation and add some comments
This commit is contained in:
ailin-nemui 2018-10-09 17:16:21 +02:00 committed by GitHub
commit 8bbf9c696c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 14 deletions

View File

@ -1121,7 +1121,7 @@ int strip_real_length(const char *str, int len,
*last_color_len = -1;
while (*str != '\0') {
if (*str == 3) {
if (*str == 3) { /* mIRC color */
const char *mircstart = str;
if (last_color_pos != NULL)
@ -1132,6 +1132,9 @@ int strip_real_length(const char *str, int len,
*last_color_len = (int) (str-mircstart);
} else if (*str == 4 && str[1] != '\0') {
/* We expect 4 to indicate an internal Irssi color code. However 4
* also means hex color, an alternative to mIRC color codes. We
* don't support those. */
#ifdef TERM_TRUECOLOR
if (str[1] == FORMAT_COLOR_24 && str[2] != '\0') {
if (str[3] == '\0') str++;

View File

@ -45,7 +45,7 @@ static void reset_level_cache(void)
{
GSList *tmp;
never_hilight_level = MSGLEVEL_ALL & ~default_hilight_level;
never_hilight_level = MSGLEVEL_ALL & ~default_hilight_level;
for (tmp = hilights; tmp != NULL; tmp = tmp->next) {
HILIGHT_REC *rec = tmp->data;
@ -180,7 +180,7 @@ static HILIGHT_REC *hilight_find(const char *text, char **channels)
/* check that channels match */
for (chan = channels; *chan != NULL; chan++) {
if (strarray_find(rec->channels, *chan) == -1)
break;
break;
}
if (*chan == NULL)
@ -239,10 +239,10 @@ static gboolean hilight_match_text(HILIGHT_REC *rec, const char *text,
HILIGHT_REC *hilight_match(SERVER_REC *server, const char *channel,
const char *nick, const char *address,
int level, const char *str,
int *match_beg, int *match_end)
int *match_beg, int *match_end)
{
GSList *tmp;
CHANNEL_REC *chanrec;
CHANNEL_REC *chanrec;
NICK_REC *nickrec;
g_return_val_if_fail(str != NULL, NULL);
@ -251,12 +251,12 @@ HILIGHT_REC *hilight_match(SERVER_REC *server, const char *channel,
return NULL;
if (nick != NULL) {
/* check nick mask hilights */
/* check nick mask hilights */
chanrec = channel_find(server, channel);
nickrec = chanrec == NULL ? NULL :
nicklist_find(chanrec, nick);
if (nickrec != NULL) {
HILIGHT_REC *rec;
HILIGHT_REC *rec;
if (nickrec->host == NULL)
nicklist_set_host(chanrec, nickrec, address);
@ -388,10 +388,10 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text,
/* end of the line */
pos = strip_real_length(text, hilight_end,
&color_pos, &color_len);
if (color_pos > 0)
if (color_pos > 0) {
g_string_append_len(tmp, text + color_pos, color_len);
else {
/* no colors in line, change back to default */
} else {
/* no colors in line, change back to default */
g_string_append_c(tmp, 4);
g_string_append_c(tmp, FORMAT_STYLE_DEFAULTS);
}
@ -413,7 +413,7 @@ HILIGHT_REC *hilight_match_nick(SERVER_REC *server, const char *channel,
const char *nick, const char *address,
int level, const char *msg)
{
HILIGHT_REC *rec;
HILIGHT_REC *rec;
rec = hilight_match(server, channel, nick, address,
level, msg, NULL, NULL);
@ -431,7 +431,7 @@ static void read_hilight_config(void)
node = iconfig_node_traverse("hilights", FALSE);
if (node == NULL) {
reset_cache();
reset_cache();
return;
}
@ -545,8 +545,8 @@ static void cmd_hilight_show(void)
}
/* SYNTAX: HILIGHT [-nick | -word | -line] [-mask | -full | -matchcase | -regexp]
[-color <color>] [-actcolor <color>] [-level <level>]
[-network <network>] [-channels <channels>] <text> */
[-color <color>] [-actcolor <color>] [-level <level>]
[-network <network>] [-channels <channels>] <text> */
static void cmd_hilight(const char *data)
{
GHashTable *optlist;