38 |
#include "../../common/weeconfig.h" |
#include "../../common/weeconfig.h" |
39 |
#include "../../common/hotlist.h" |
#include "../../common/hotlist.h" |
40 |
#include "../../common/log.h" |
#include "../../common/log.h" |
41 |
|
#include "../../common/utf8.h" |
42 |
#include "../../irc/irc.h" |
#include "../../irc/irc.h" |
43 |
|
|
44 |
|
|
353 |
{ |
{ |
354 |
if (CHANNEL(buffer)->topic) |
if (CHANNEL(buffer)->topic) |
355 |
{ |
{ |
356 |
buf = weechat_convert_encoding (cfg_look_charset_decode, |
buf = weechat_convert_encoding ((local_utf8) ? |
357 |
|
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf, |
358 |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
359 |
cfg_look_charset_internal : local_charset, |
cfg_look_charset_internal : local_charset, |
360 |
CHANNEL(buffer)->topic); |
CHANNEL(buffer)->topic); |
415 |
{ |
{ |
416 |
if (!(*message)) |
if (!(*message)) |
417 |
return; |
return; |
418 |
(*offset)++; |
|
419 |
|
(*offset) += utf8_char_size ((*message)->message + (*offset)); |
420 |
if (!((*message)->message[*offset])) |
if (!((*message)->message[*offset])) |
421 |
{ |
{ |
422 |
*message = (*message)->next_message; |
*message = (*message)->next_message; |
436 |
{ |
{ |
437 |
char format_align[32]; |
char format_align[32]; |
438 |
char saved_char_end, saved_char; |
char saved_char_end, saved_char; |
439 |
int end_of_word, chars_to_display, num_displayed; |
int pos_saved_char, end_of_word, chars_to_display, num_displayed; |
440 |
|
|
441 |
if (!message || !end_msg || |
if (!message || !end_msg || |
442 |
((!simulate) && (window->win_chat_cursor_y > window->win_chat_height - 1))) |
((!simulate) && (window->win_chat_cursor_y > window->win_chat_height - 1))) |
473 |
window->win_chat_cursor_x += line->length_align; |
window->win_chat_cursor_x += line->length_align; |
474 |
} |
} |
475 |
|
|
476 |
chars_to_display = strlen (message->message + offset); |
chars_to_display = utf8_strlen (message->message + offset); |
477 |
|
|
478 |
/* too long for current line */ |
/* too long for current line */ |
479 |
if (window->win_chat_cursor_x + chars_to_display > window->win_chat_width) |
if (window->win_chat_cursor_x + chars_to_display > window->win_chat_width) |
480 |
{ |
{ |
481 |
num_displayed = window->win_chat_width - window->win_chat_cursor_x; |
num_displayed = window->win_chat_width - window->win_chat_cursor_x; |
482 |
saved_char = message->message[offset + num_displayed]; |
pos_saved_char = utf8_real_pos (message->message + offset, num_displayed); |
483 |
message->message[offset + num_displayed] = '\0'; |
saved_char = message->message[offset + pos_saved_char]; |
484 |
|
message->message[offset + pos_saved_char] = '\0'; |
485 |
if ((!simulate) && |
if ((!simulate) && |
486 |
((count == 0) || (*lines_displayed >= num_lines - count))) |
((count == 0) || (*lines_displayed >= num_lines - count))) |
487 |
mvwprintw (window->win_chat, |
mvwprintw (window->win_chat, |
488 |
window->win_chat_cursor_y, |
window->win_chat_cursor_y, |
489 |
window->win_chat_cursor_x, |
window->win_chat_cursor_x, |
490 |
"%s", message->message + offset); |
"%s", message->message + offset); |
491 |
message->message[offset + num_displayed] = saved_char; |
message->message[offset + pos_saved_char] = saved_char; |
492 |
offset += num_displayed; |
offset += pos_saved_char; |
493 |
} |
} |
494 |
else |
else |
495 |
{ |
{ |
502 |
"%s", message->message + offset); |
"%s", message->message + offset); |
503 |
if (message == end_msg) |
if (message == end_msg) |
504 |
{ |
{ |
|
offset = end_offset; |
|
505 |
if (end_msg) |
if (end_msg) |
506 |
end_msg->message[end_offset + 1] = saved_char_end; |
end_msg->message[end_offset + 1] = saved_char_end; |
507 |
gui_message_get_next_char (&message, &offset); |
if (saved_char_end == '\0') |
508 |
|
{ |
509 |
|
message = message->next_message; |
510 |
|
offset = 0; |
511 |
|
} |
512 |
|
else |
513 |
|
offset = end_offset + 1; |
514 |
} |
} |
515 |
else |
else |
516 |
{ |
{ |
573 |
while (message && (message->message[offset]) && (message->message[offset] != ' ')) |
while (message && (message->message[offset]) && (message->message[offset] != ' ')) |
574 |
{ |
{ |
575 |
*word_end_msg = message; |
*word_end_msg = message; |
576 |
*word_end_offset = offset; |
*word_end_offset = offset + utf8_char_size (message->message + offset) - 1; |
577 |
(*word_length_with_spaces)++; |
(*word_length_with_spaces) += utf8_char_size (message->message + offset); |
578 |
(*word_length)++; |
(*word_length) += utf8_char_size (message->message + offset); |
579 |
gui_message_get_next_char (&message, &offset); |
gui_message_get_next_char (&message, &offset); |
580 |
} |
} |
581 |
} |
} |
840 |
mvwprintw (ptr_win->win_chat, i, 0, "%s %-16s ", |
mvwprintw (ptr_win->win_chat, i, 0, "%s %-16s ", |
841 |
(ptr_dcc == dcc_selected) ? "***" : " ", |
(ptr_dcc == dcc_selected) ? "***" : " ", |
842 |
ptr_dcc->nick); |
ptr_dcc->nick); |
843 |
buf = weechat_convert_encoding (cfg_look_charset_decode, |
buf = weechat_convert_encoding ((local_utf8) ? |
844 |
|
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf, |
845 |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
846 |
cfg_look_charset_internal : local_charset, |
cfg_look_charset_internal : local_charset, |
847 |
(DCC_IS_CHAT(ptr_dcc->type)) ? |
(DCC_IS_CHAT(ptr_dcc->type)) ? |
864 |
(DCC_IS_RECV(ptr_dcc->type)) ? "-->>" : "<<--"); |
(DCC_IS_RECV(ptr_dcc->type)) ? "-->>" : "<<--"); |
865 |
gui_window_set_color (ptr_win->win_chat, |
gui_window_set_color (ptr_win->win_chat, |
866 |
COLOR_DCC_WAITING + ptr_dcc->status); |
COLOR_DCC_WAITING + ptr_dcc->status); |
867 |
buf = weechat_convert_encoding (cfg_look_charset_decode, |
buf = weechat_convert_encoding ((local_utf8) ? |
868 |
|
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf, |
869 |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
870 |
cfg_look_charset_internal : local_charset, |
cfg_look_charset_internal : local_charset, |
871 |
_(dcc_status_string[ptr_dcc->status])); |
_(dcc_status_string[ptr_dcc->status])); |
916 |
else |
else |
917 |
num_unit = 3; |
num_unit = 3; |
918 |
sprintf (format, " (%s %%s/s)", unit_format[num_unit]); |
sprintf (format, " (%s %%s/s)", unit_format[num_unit]); |
919 |
buf = weechat_convert_encoding (cfg_look_charset_decode, |
buf = weechat_convert_encoding ((local_utf8) ? |
920 |
|
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf, |
921 |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
922 |
cfg_look_charset_internal : local_charset, |
cfg_look_charset_internal : local_charset, |
923 |
unit_name[num_unit]); |
unit_name[num_unit]); |
1260 |
wprintw (ptr_win->win_status, "%s", SERVER(ptr_win->buffer)->name); |
wprintw (ptr_win->win_status, "%s", SERVER(ptr_win->buffer)->name); |
1261 |
if (SERVER(ptr_win->buffer)->is_away) |
if (SERVER(ptr_win->buffer)->is_away) |
1262 |
{ |
{ |
1263 |
string = weechat_convert_encoding (cfg_look_charset_decode, |
string = weechat_convert_encoding ((local_utf8) ? |
1264 |
|
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf, |
1265 |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
1266 |
cfg_look_charset_internal : local_charset, |
cfg_look_charset_internal : local_charset, |
1267 |
_("(away)")); |
_("(away)")); |
1378 |
wprintw (ptr_win->win_status, "<DCC> "); |
wprintw (ptr_win->win_status, "<DCC> "); |
1379 |
else |
else |
1380 |
{ |
{ |
1381 |
string = weechat_convert_encoding (cfg_look_charset_decode, |
string = weechat_convert_encoding ((local_utf8) ? |
1382 |
|
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf, |
1383 |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
1384 |
cfg_look_charset_internal : local_charset, |
cfg_look_charset_internal : local_charset, |
1385 |
_("[not connected]")); |
_("[not connected]")); |
1395 |
COLOR_WIN_STATUS_DELIMITERS); |
COLOR_WIN_STATUS_DELIMITERS); |
1396 |
wprintw (ptr_win->win_status, "["); |
wprintw (ptr_win->win_status, "["); |
1397 |
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS); |
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS); |
1398 |
string = weechat_convert_encoding (cfg_look_charset_decode, |
string = weechat_convert_encoding ((local_utf8) ? |
1399 |
|
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf, |
1400 |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
1401 |
cfg_look_charset_internal : local_charset, |
cfg_look_charset_internal : local_charset, |
1402 |
_("Act: ")); |
_("Act: ")); |
1489 |
COLOR_WIN_STATUS_DELIMITERS); |
COLOR_WIN_STATUS_DELIMITERS); |
1490 |
wprintw (ptr_win->win_status, "["); |
wprintw (ptr_win->win_status, "["); |
1491 |
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS); |
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS); |
1492 |
string = weechat_convert_encoding (cfg_look_charset_decode, |
string = weechat_convert_encoding ((local_utf8) ? |
1493 |
|
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf, |
1494 |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
1495 |
cfg_look_charset_internal : local_charset, |
cfg_look_charset_internal : local_charset, |
1496 |
_("Lag: %.1f")); |
_("Lag: %.1f")); |
1511 |
} |
} |
1512 |
else |
else |
1513 |
x = ptr_win->win_width - 2; |
x = ptr_win->win_width - 2; |
1514 |
string = weechat_convert_encoding (cfg_look_charset_decode, |
string = weechat_convert_encoding ((local_utf8) ? |
1515 |
|
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf, |
1516 |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
1517 |
cfg_look_charset_internal : local_charset, |
cfg_look_charset_internal : local_charset, |
1518 |
_("-MORE-")); |
_("-MORE-")); |
1729 |
} |
} |
1730 |
else if (buffer->has_input) |
else if (buffer->has_input) |
1731 |
{ |
{ |
1732 |
if (buffer->input_buffer_size == 0) |
if (buffer->input_buffer_length == 0) |
1733 |
buffer->input_buffer[0] = '\0'; |
buffer->input_buffer[0] = '\0'; |
1734 |
|
|
1735 |
input_width = gui_get_input_width (ptr_win); |
input_width = gui_get_input_width (ptr_win); |
1767 |
snprintf (format, 32, "%%-%ds", input_width); |
snprintf (format, 32, "%%-%ds", input_width); |
1768 |
if (ptr_win == gui_current_window) |
if (ptr_win == gui_current_window) |
1769 |
wprintw (ptr_win->win_input, format, |
wprintw (ptr_win->win_input, format, |
1770 |
buffer->input_buffer + buffer->input_buffer_1st_display); |
utf8_add_offset (buffer->input_buffer, |
1771 |
|
buffer->input_buffer_1st_display)); |
1772 |
else |
else |
1773 |
wprintw (ptr_win->win_input, format, |
wprintw (ptr_win->win_input, format, |
1774 |
""); |
""); |
1794 |
snprintf (format, 32, "%%-%ds", input_width); |
snprintf (format, 32, "%%-%ds", input_width); |
1795 |
if (ptr_win == gui_current_window) |
if (ptr_win == gui_current_window) |
1796 |
wprintw (ptr_win->win_input, format, |
wprintw (ptr_win->win_input, format, |
1797 |
buffer->input_buffer + buffer->input_buffer_1st_display); |
utf8_add_offset (buffer->input_buffer, |
1798 |
|
buffer->input_buffer_1st_display)); |
1799 |
else |
else |
1800 |
wprintw (ptr_win->win_input, format, |
wprintw (ptr_win->win_input, format, |
1801 |
""); |
""); |
1808 |
} |
} |
1809 |
} |
} |
1810 |
|
|
1811 |
wnoutrefresh (ptr_win->win_input); |
doupdate (); |
1812 |
|
wrefresh (ptr_win->win_input); |
1813 |
refresh (); |
refresh (); |
1814 |
} |
} |
1815 |
} |
} |
2733 |
ptr_string[0] = 32; |
ptr_string[0] = 32; |
2734 |
ptr_string++; |
ptr_string++; |
2735 |
} |
} |
2736 |
length = strlen (message); |
length = utf8_strlen (message); |
2737 |
buffer->last_line->length += length; |
buffer->last_line->length += length; |
2738 |
if (type & MSG_TYPE_MSG) |
if (type & MSG_TYPE_MSG) |
2739 |
buffer->last_line->line_with_message = 1; |
buffer->last_line->line_with_message = 1; |
2856 |
else |
else |
2857 |
buf2 = strdup (buf); |
buf2 = strdup (buf); |
2858 |
|
|
2859 |
buf3 = weechat_convert_encoding (cfg_look_charset_decode, |
if (!local_utf8 || !utf8_is_valid (buf2)) |
2860 |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
buf3 = weechat_convert_encoding ((local_utf8) ? |
2861 |
cfg_look_charset_internal : local_charset, |
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf, |
2862 |
buf2); |
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
2863 |
|
cfg_look_charset_internal : local_charset, |
2864 |
|
buf2); |
2865 |
|
else |
2866 |
|
buf3 = strdup (buf2); |
2867 |
|
|
2868 |
if (gui_init_ok) |
if (gui_init_ok) |
2869 |
{ |
{ |