Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/screen.c @ 772:464be13343a9
Store most data in UTF-8 internally
Only chat buffer data is still using 1 byte for char size.
User input still doesn't handle UTF-8 locales.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 25 Mar 2006 18:10:36 +0100 |
parents | ce4f8a2129a4 |
children | e25b8a348ebd |
comparison
equal
deleted
inserted
replaced
771:ce4f8a2129a4 | 772:464be13343a9 |
---|---|
574 // If this window doesn't exist, it is created. | 574 // If this window doesn't exist, it is created. |
575 void scr_WriteInWindow(const char *winId, const char *text, time_t timestamp, | 575 void scr_WriteInWindow(const char *winId, const char *text, time_t timestamp, |
576 unsigned int prefix_flags, int force_show) | 576 unsigned int prefix_flags, int force_show) |
577 { | 577 { |
578 window_entry_t *win_entry; | 578 window_entry_t *win_entry; |
579 char *text_locale; | |
579 int dont_show = FALSE; | 580 int dont_show = FALSE; |
580 | 581 |
581 // Look for the window entry. | 582 // Look for the window entry. |
582 win_entry = scr_SearchWindow(winId); | 583 win_entry = scr_SearchWindow(winId); |
583 | 584 |
594 | 595 |
595 // The message must be displayed -> update top pointer | 596 // The message must be displayed -> update top pointer |
596 if (win_entry->cleared) | 597 if (win_entry->cleared) |
597 win_entry->top = g_list_last(win_entry->hbuf); | 598 win_entry->top = g_list_last(win_entry->hbuf); |
598 | 599 |
599 hbuf_add_line(&win_entry->hbuf, text, timestamp, prefix_flags, | 600 text_locale = from_utf8(text); |
601 hbuf_add_line(&win_entry->hbuf, text_locale, timestamp, prefix_flags, | |
600 maxX - Roster_Width - PREFIX_WIDTH); | 602 maxX - Roster_Width - PREFIX_WIDTH); |
603 g_free(text_locale); | |
601 | 604 |
602 if (win_entry->cleared) { | 605 if (win_entry->cleared) { |
603 win_entry->cleared = FALSE; | 606 win_entry->cleared = FALSE; |
604 if (g_list_next(win_entry->top)) | 607 if (g_list_next(win_entry->top)) |
605 win_entry->top = g_list_next(win_entry->top); | 608 win_entry->top = g_list_next(win_entry->top); |
1589 multiline = g_strdup(line); | 1592 multiline = g_strdup(line); |
1590 num++; | 1593 num++; |
1591 } else | 1594 } else |
1592 return; | 1595 return; |
1593 } | 1596 } |
1594 scr_LogPrint(LPRINT_NORMAL, "Multi-line mode: line #%d added [%.25s...", | 1597 scr_LogPrint(LPRINT_NORMAL|LPRINT_NOTUTF8, |
1595 num, line); | 1598 "Multi-line mode: line #%d added [%.25s...", num, line); |
1596 } | 1599 } |
1597 | 1600 |
1598 // scr_cmdhisto_addline() | 1601 // scr_cmdhisto_addline() |
1599 // Add a line to the inputLine history | 1602 // Add a line to the inputLine history |
1600 inline void scr_cmdhisto_addline(char *line) | 1603 inline void scr_cmdhisto_addline(char *line) |
2053 g_snprintf(asciikey, 15, "MK%d", kcode.mcode); | 2056 g_snprintf(asciikey, 15, "MK%d", kcode.mcode); |
2054 | 2057 |
2055 boundcmd = settings_get(SETTINGS_TYPE_BINDING, asciikey); | 2058 boundcmd = settings_get(SETTINGS_TYPE_BINDING, asciikey); |
2056 | 2059 |
2057 if (boundcmd) { | 2060 if (boundcmd) { |
2058 gchar *cmd = g_strdup_printf("/%s", boundcmd); | 2061 gchar *cmd, *boundcmd_locale; |
2062 boundcmd_locale = from_utf8(boundcmd); | |
2063 cmd = g_strdup_printf("/%s", boundcmd_locale); | |
2059 scr_CheckAutoAway(TRUE); | 2064 scr_CheckAutoAway(TRUE); |
2060 if (process_command(cmd)) | 2065 if (process_command(cmd)) |
2061 return 255; // Quit | 2066 return 255; // Quit |
2067 g_free(boundcmd_locale); | |
2062 g_free(cmd); | 2068 g_free(cmd); |
2063 return 0; | 2069 return 0; |
2064 } | 2070 } |
2065 | 2071 |
2066 scr_LogPrint(LPRINT_NORMAL, "Unknown key=%s", asciikey); | 2072 scr_LogPrint(LPRINT_NORMAL, "Unknown key=%s", asciikey); |