GtkTextIter textiter;
char *str;
char *from;
+ char *to;
char *body;
+ int sent;
str = iks_string (iks_stack (message), message);
write (fd, str, strlen (str));
- if ((from = iks_find_attrib (message, "from")) == NULL)
- from = "";
- if ((body = iks_cdata (iks_child (iks_find (message, "body")))) == NULL)
- body = "";
+ from = iks_find_attrib (message, "from");
+ to = iks_find_attrib (message, "to");
+ if (from == NULL)
+ sent = 1;
+ if (sent && to == NULL)
+ return;
+ body = iks_cdata (iks_child (iks_find (message, "body")));
textbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));
gtk_text_buffer_get_end_iter (textbuffer, &textiter);
- gtk_text_buffer_insert (textbuffer, &textiter, from, -1);
+ if (sent)
+ {
+ gtk_text_buffer_insert (textbuffer, &textiter, "> ", -1);
+ gtk_text_buffer_insert (textbuffer, &textiter, to, -1);
+ }
+ else
+ {
+ gtk_text_buffer_insert (textbuffer, &textiter, "< ", -1);
+ gtk_text_buffer_insert (textbuffer, &textiter, from, -1);
+ }
gtk_text_buffer_insert (textbuffer, &textiter, ": ", -1);
- gtk_text_buffer_insert (textbuffer, &textiter, body, -1);
+ if (body)
+ gtk_text_buffer_insert (textbuffer, &textiter, body, -1);
gtk_text_buffer_insert (textbuffer, &textiter, "\n", -1);
}