1
0
mirror of https://github.com/irssi/irssi.git synced 2024-10-13 05:03:45 -04: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; *last_color_len = -1;
while (*str != '\0') { while (*str != '\0') {
if (*str == 3) { if (*str == 3) { /* mIRC color */
const char *mircstart = str; const char *mircstart = str;
if (last_color_pos != NULL) if (last_color_pos != NULL)
@ -1132,6 +1132,9 @@ int strip_real_length(const char *str, int len,
*last_color_len = (int) (str-mircstart); *last_color_len = (int) (str-mircstart);
} else if (*str == 4 && str[1] != '\0') { } 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 #ifdef TERM_TRUECOLOR
if (str[1] == FORMAT_COLOR_24 && str[2] != '\0') { if (str[1] == FORMAT_COLOR_24 && str[2] != '\0') {
if (str[3] == '\0') str++; if (str[3] == '\0') str++;

View File

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