Mercurial > pidgin
comparison src/buddy_chat.c @ 2856:b1e300a85678
[gaim-migrate @ 2869]
rewrote the html parser in gtkimhtml. yes, that's really all i did. the reason for the massive change is because i added a length argument, which then needed to be propogated down to everything that would ever receive anything that would get drawn to the window.
the new parser isn't any faster. that wasn't my goal. it's much more understandable now (hopefully, anyway).
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sat, 08 Dec 2001 09:48:52 +0000 |
parents | 86e74a0c2f6e |
children | d842df0f5fe1 |
comparison
equal
deleted
inserted
replaced
2855:19f786779b08 | 2856:b1e300a85678 |
---|---|
603 char *tmp = addthis; | 603 char *tmp = addthis; |
604 addthis = g_strconcat(tmp, matches->data, " ", NULL); | 604 addthis = g_strconcat(tmp, matches->data, " ", NULL); |
605 g_free(tmp); | 605 g_free(tmp); |
606 matches = g_list_remove(matches, matches->data); | 606 matches = g_list_remove(matches, matches->data); |
607 } | 607 } |
608 write_to_conv(c, addthis, WFLAG_NOLOG, NULL, time(NULL)); | 608 write_to_conv(c, addthis, WFLAG_NOLOG, NULL, time(NULL), -1); |
609 gtk_editable_insert_text(GTK_EDITABLE(c->entry), partial, strlen(partial), &start); | 609 gtk_editable_insert_text(GTK_EDITABLE(c->entry), partial, strlen(partial), &start); |
610 if (t == start) { | 610 if (t == start) { |
611 t = start + strlen(partial); | 611 t = start + strlen(partial); |
612 gtk_editable_set_position(GTK_EDITABLE(c->entry), t); | 612 gtk_editable_set_position(GTK_EDITABLE(c->entry), t); |
613 } | 613 } |
616 | 616 |
617 g_free(text); | 617 g_free(text); |
618 g_free(partial); | 618 g_free(partial); |
619 } | 619 } |
620 | 620 |
621 gboolean meify(char *message) | 621 gboolean meify(char *message, int len) |
622 { | 622 { |
623 /* read /me-ify : if the message (post-HTML) starts with /me, remove | 623 /* read /me-ify : if the message (post-HTML) starts with /me, remove |
624 * the "/me " part of it (including that space) and return TRUE */ | 624 * the "/me " part of it (including that space) and return TRUE */ |
625 char *c = message; | 625 char *c = message; |
626 int inside_HTML = 0; /* i really don't like descriptive names */ | 626 int inside_HTML = 0; /* i really don't like descriptive names */ |
627 if (!c) | 627 if (!c) |
628 return FALSE; /* um... this would be very bad if this happens */ | 628 return FALSE; /* um... this would be very bad if this happens */ |
629 if (len == -1) | |
630 len = strlen(message); | |
629 while (*c) { | 631 while (*c) { |
630 if (inside_HTML) { | 632 if (inside_HTML) { |
631 if (*c == '>') | 633 if (*c == '>') |
632 inside_HTML = 0; | 634 inside_HTML = 0; |
633 } else { | 635 } else { |
635 inside_HTML = 1; | 637 inside_HTML = 1; |
636 else | 638 else |
637 break; | 639 break; |
638 } | 640 } |
639 c++; /* i really don't like c++ either */ | 641 c++; /* i really don't like c++ either */ |
642 len--; | |
640 } | 643 } |
641 /* k, so now we've gotten past all the HTML crap. */ | 644 /* k, so now we've gotten past all the HTML crap. */ |
642 if (!*c) | 645 if (!*c) |
643 return FALSE; | 646 return FALSE; |
644 if (!g_strncasecmp(c, "/me ", 4)) { | 647 if (!g_strncasecmp(c, "/me ", 4)) { |
645 sprintf(c, "%s", c + 4); | 648 memmove(c, c + 4, len - 4); |
646 return TRUE; | 649 return TRUE; |
647 } else | 650 } else |
648 return FALSE; | 651 return FALSE; |
649 } | 652 } |
650 | 653 |
719 } | 722 } |
720 | 723 |
721 if ((flag & WFLAG_RECV) && find_nick(b->gc, message)) | 724 if ((flag & WFLAG_RECV) && find_nick(b->gc, message)) |
722 flag |= WFLAG_NICK; | 725 flag |= WFLAG_NICK; |
723 | 726 |
724 write_to_conv(b, message, flag, who, mtime); | 727 write_to_conv(b, message, flag, who, mtime, -1); |
725 } | 728 } |
726 | 729 |
727 | 730 |
728 | 731 |
729 void whisper_callback(GtkWidget *widget, struct conversation *b) | 732 void whisper_callback(GtkWidget *widget, struct conversation *b) |
882 if (b->makesound && (sound_options & OPT_SOUND_CHAT_JOIN)) | 885 if (b->makesound && (sound_options & OPT_SOUND_CHAT_JOIN)) |
883 play_sound(CHAT_JOIN); | 886 play_sound(CHAT_JOIN); |
884 | 887 |
885 if (chat_options & OPT_CHAT_LOGON) { | 888 if (chat_options & OPT_CHAT_LOGON) { |
886 g_snprintf(tmp, sizeof(tmp), _("%s entered the room."), name); | 889 g_snprintf(tmp, sizeof(tmp), _("%s entered the room."), name); |
887 write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time(NULL)); | 890 write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time(NULL), -1); |
888 } | 891 } |
889 } | 892 } |
890 | 893 |
891 | 894 |
892 void rename_chat_buddy(struct conversation *b, char *old, char *new) | 895 void rename_chat_buddy(struct conversation *b, char *old, char *new) |
956 gtk_list_insert_items(GTK_LIST(b->list), g_list_append(NULL, list_item), pos); | 959 gtk_list_insert_items(GTK_LIST(b->list), g_list_append(NULL, list_item), pos); |
957 gtk_widget_show(list_item); | 960 gtk_widget_show(list_item); |
958 | 961 |
959 if (chat_options & OPT_CHAT_LOGON) { | 962 if (chat_options & OPT_CHAT_LOGON) { |
960 g_snprintf(tmp, sizeof(tmp), _("%s is now known as %s"), old, new); | 963 g_snprintf(tmp, sizeof(tmp), _("%s is now known as %s"), old, new); |
961 write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time(NULL)); | 964 write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time(NULL), -1); |
962 } | 965 } |
963 } | 966 } |
964 | 967 |
965 | 968 |
966 void remove_chat_buddy(struct conversation *b, char *buddy, char *reason) | 969 void remove_chat_buddy(struct conversation *b, char *buddy, char *reason) |
1005 if (chat_options & OPT_CHAT_LOGON) { | 1008 if (chat_options & OPT_CHAT_LOGON) { |
1006 if (reason && *reason) | 1009 if (reason && *reason) |
1007 g_snprintf(tmp, sizeof(tmp), _("%s left the room (%s)."), buddy, reason); | 1010 g_snprintf(tmp, sizeof(tmp), _("%s left the room (%s)."), buddy, reason); |
1008 else | 1011 else |
1009 g_snprintf(tmp, sizeof(tmp), _("%s left the room."), buddy); | 1012 g_snprintf(tmp, sizeof(tmp), _("%s left the room."), buddy); |
1010 write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time(NULL)); | 1013 write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time(NULL), -1); |
1011 } | 1014 } |
1012 } | 1015 } |
1013 | 1016 |
1014 | 1017 |
1015 void im_callback(GtkWidget *w, struct conversation *b) | 1018 void im_callback(GtkWidget *w, struct conversation *b) |