Mercurial > pidgin.yaz
comparison src/conversation.c @ 1100:f168625b63fe
[gaim-migrate @ 1110]
some perl updates, and indication of which account got warned
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 16 Nov 2000 08:48:01 +0000 |
parents | 3819a5a377b2 |
children | 7aabbbaae829 |
comparison
equal
deleted
inserted
replaced
1099:4416ead31db7 | 1100:f168625b63fe |
---|---|
578 | 578 |
579 | 579 |
580 void send_callback(GtkWidget *widget, struct conversation *c) | 580 void send_callback(GtkWidget *widget, struct conversation *c) |
581 { | 581 { |
582 char *buf, *buf2, *buf3; | 582 char *buf, *buf2, *buf3; |
583 int hdrlen, limit; | 583 int limit; |
584 | 584 |
585 if (!c->gc) return; | 585 if (!c->gc) return; |
586 /* FIXME! this used to have limits based on protocol limits (oscar chat was 512, | 586 |
587 * oscar im was 7985, toc was 4k). we shouldn't be using PROTO_whatever here. it | 587 buf2 = gtk_editable_get_chars(GTK_EDITABLE(c->entry), 0, -1); |
588 * should be gotten from the PRPL somehow */ | 588 /* uncomment this if you want no limit on outgoing messages. |
589 * if you uncomment this, you'll probably get kicked off if | |
590 * you send one that's too big. | |
591 limit = strlen(buf2) * 2; | |
592 */ | |
589 limit = 7985 << 2; | 593 limit = 7985 << 2; |
590 | |
591 buf = g_malloc(limit); | 594 buf = g_malloc(limit); |
592 | |
593 buf2 = gtk_editable_get_chars(GTK_EDITABLE(c->entry), 0, -1); | |
594 g_snprintf(buf, limit, "%s", buf2); | 595 g_snprintf(buf, limit, "%s", buf2); |
595 g_free(buf2); | 596 g_free(buf2); |
596 gtk_editable_delete_text(GTK_EDITABLE(c->entry), 0, -1); | 597 gtk_editable_delete_text(GTK_EDITABLE(c->entry), 0, -1); |
597 if (!strlen(buf)) { | 598 if (!strlen(buf)) { |
598 g_free(buf); | 599 g_free(buf); |
602 if (general_options & OPT_GEN_SEND_LINKS) | 603 if (general_options & OPT_GEN_SEND_LINKS) |
603 linkify_text(buf); | 604 linkify_text(buf); |
604 | 605 |
605 buf2 = g_malloc(limit); | 606 buf2 = g_malloc(limit); |
606 | 607 |
607 /* Let us determine how long the message CAN be. | |
608 * toc_send_im is 11 chars long + 2 quotes. | |
609 * + 2 spaces + 6 for the header + 2 for good | |
610 * measure = 23 bytes + the length of normalize c->name */ | |
611 /* FIXME: the hdrlen is for how long the header is going to cut off the limit. | |
612 * but since we don't know on a protocol basis anymore we can't do this. so we'll | |
613 * just assume it's 23 + strlen(normalize(c->name)) for all protocols */ | |
614 hdrlen = 23 + strlen(normalize(c->name)); | |
615 | |
616 if (font_options & OPT_FONT_BOLD) { | 608 if (font_options & OPT_FONT_BOLD) { |
617 g_snprintf(buf2, limit, "<B>%s</B>", buf); | 609 g_snprintf(buf2, limit, "<B>%s</B>", buf); |
618 strcpy(buf, buf2); | 610 strcpy(buf, buf2); |
619 } | 611 } |
620 | 612 |
649 } | 641 } |
650 | 642 |
651 { | 643 { |
652 char *buffy = g_strdup(buf); | 644 char *buffy = g_strdup(buf); |
653 enum gaim_event evnt = c->is_chat ? event_chat_send : event_im_send; | 645 enum gaim_event evnt = c->is_chat ? event_chat_send : event_im_send; |
654 plugin_event(evnt, c->gc, c->name, &buffy, 0); | 646 int plugin_return = plugin_event(evnt, c->gc, c->name, &buffy, 0); |
655 if (!buffy) { | 647 if (!buffy) { |
648 g_free(buf2); | |
649 g_free(buf); | |
650 return; | |
651 } | |
652 if (plugin_return) { | |
653 g_free(buffy); | |
656 g_free(buf2); | 654 g_free(buf2); |
657 g_free(buf); | 655 g_free(buf); |
658 return; | 656 return; |
659 } | 657 } |
660 g_snprintf(buf, limit, "%s", buffy); | 658 g_snprintf(buf, limit, "%s", buffy); |