639
639
const char *tags, const char *message, ...)
641
641
time_t date_printed;
642
int display_time, length, at_least_one_message_printed;
642
int display_time, length, at_least_one_message_printed, msg_discarded;
643
643
char *pos, *pos_prefix, *pos_tab, *pos_end, *pos_lines;
644
644
char *modifier_data, *new_msg, *ptr_msg, *lines_waiting;
645
645
struct t_gui_line *ptr_line;
735
ptr_msg = (new_msg) ? new_msg : pos;
739
ptr_msg = (new_msg) ? new_msg : pos;
737
/* space followed by tab => prefix ignored */
738
if ((ptr_msg[0] == ' ') && (ptr_msg[1] == '\t'))
744
/* if two first chars are tab, then do not display time */
745
if ((ptr_msg[0] == '\t') && (ptr_msg[1] == '\t'))
741
/* space followed by tab => prefix ignored */
742
if ((ptr_msg[0] == ' ') && (ptr_msg[1] == '\t'))
752
/* if tab found, use prefix (before tab) */
753
pos_tab = strchr (ptr_msg, '\t');
757
pos_prefix = ptr_msg;
758
ptr_msg = pos_tab + 1;
748
/* if two first chars are tab, then do not display time */
749
if ((ptr_msg[0] == '\t') && (ptr_msg[1] == '\t'))
756
/* if tab found, use prefix (before tab) */
757
pos_tab = strchr (ptr_msg, '\t');
761
pos_prefix = ptr_msg;
762
ptr_msg = pos_tab + 1;
765
ptr_line = gui_line_add (buffer, (display_time) ? date : 0,
766
date_printed, tags, pos_prefix, ptr_msg);
769
if (buffer && buffer->print_hooks_enabled)
770
hook_print_exec (buffer, ptr_line);
771
if (ptr_line->data->displayed)
772
at_least_one_message_printed = 1;
777
length = ((pos_prefix) ? strlen (pos_prefix) + 1 : 0) +
778
strlen (ptr_msg) + 1;
779
if (gui_chat_lines_waiting_buffer)
781
length += strlen (gui_chat_lines_waiting_buffer) + 1;
782
lines_waiting = realloc (gui_chat_lines_waiting_buffer, length);
785
gui_chat_lines_waiting_buffer = lines_waiting;
789
free (gui_chat_lines_waiting_buffer);
790
gui_chat_lines_waiting_buffer = NULL;
769
ptr_line = gui_line_add (buffer, (display_time) ? date : 0,
770
date_printed, tags, pos_prefix, ptr_msg);
773
if (buffer && buffer->print_hooks_enabled)
774
hook_print_exec (buffer, ptr_line);
775
if (ptr_line->data->displayed)
776
at_least_one_message_printed = 1;
795
gui_chat_lines_waiting_buffer = malloc (length);
796
if (gui_chat_lines_waiting_buffer)
797
gui_chat_lines_waiting_buffer[0] = '\0';
799
if (gui_chat_lines_waiting_buffer)
801
pos_lines = gui_chat_lines_waiting_buffer +
802
strlen (gui_chat_lines_waiting_buffer);
803
if (pos_lines > gui_chat_lines_waiting_buffer)
810
memcpy (pos_lines, pos_prefix, strlen (pos_prefix));
811
pos_lines += strlen (pos_prefix);
815
memcpy (pos_lines, ptr_msg, strlen (ptr_msg) + 1);
781
length = ((pos_prefix) ? strlen (pos_prefix) + 1 : 0) +
782
strlen (ptr_msg) + 1;
783
if (gui_chat_lines_waiting_buffer)
785
length += strlen (gui_chat_lines_waiting_buffer) + 1;
786
lines_waiting = realloc (gui_chat_lines_waiting_buffer, length);
789
gui_chat_lines_waiting_buffer = lines_waiting;
793
free (gui_chat_lines_waiting_buffer);
794
gui_chat_lines_waiting_buffer = NULL;
799
gui_chat_lines_waiting_buffer = malloc (length);
800
if (gui_chat_lines_waiting_buffer)
801
gui_chat_lines_waiting_buffer[0] = '\0';
803
if (gui_chat_lines_waiting_buffer)
805
pos_lines = gui_chat_lines_waiting_buffer +
806
strlen (gui_chat_lines_waiting_buffer);
807
if (pos_lines > gui_chat_lines_waiting_buffer)
814
memcpy (pos_lines, pos_prefix, strlen (pos_prefix));
815
pos_lines += strlen (pos_prefix);
819
memcpy (pos_lines, ptr_msg, strlen (ptr_msg) + 1);