Mercurial > pidgin
comparison libgaim/dbus-server.c @ 14939:06ae7ffc47e3
[gaim-migrate @ 17711]
This should prevent D-BUS from having to deal with any non-UTF-8
strings emitted by Gaim signals, which should therefore prevent its
early exit. Strings will be salvaged via gaim_utf8_salvage before
emission, and an error will be logged. IRC (and any other protocols
spitting out invalid UTF-8 to signals) should yet be fixed to emit
some sort of binary blob, rather than a UTF-8 string, but this will
make D-BUS robust to any future transgressions.
This is completely untested.
committer: Tailor Script <tailor@pidgin.im>
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Thu, 09 Nov 2006 16:35:06 +0000 |
parents | 64733c315986 |
children | d24de6319f87 |
comparison
equal
deleted
inserted
replaced
14938:4b2ac755d565 | 14939:06ae7ffc47e3 |
---|---|
36 #include "dbus-bindings.h" | 36 #include "dbus-bindings.h" |
37 #include "debug.h" | 37 #include "debug.h" |
38 #include "core.h" | 38 #include "core.h" |
39 #include "internal.h" | 39 #include "internal.h" |
40 #include "savedstatuses.h" | 40 #include "savedstatuses.h" |
41 #include "util.h" | |
41 #include "value.h" | 42 #include "value.h" |
42 #include "xmlnode.h" | 43 #include "xmlnode.h" |
43 | 44 |
44 | 45 |
45 /**************************************************************************/ | 46 /**************************************************************************/ |
665 int id; | 666 int id; |
666 gint xint; | 667 gint xint; |
667 guint xuint; | 668 guint xuint; |
668 gboolean xboolean; | 669 gboolean xboolean; |
669 gpointer ptr = NULL; | 670 gpointer ptr = NULL; |
671 gboolean allocated = FALSE; | |
670 | 672 |
671 if (gaim_value_is_outgoing(gaim_values[i])) | 673 if (gaim_value_is_outgoing(gaim_values[i])) |
672 { | 674 { |
673 ptr = my_arg(gpointer); | 675 ptr = my_arg(gpointer); |
674 g_return_if_fail(ptr); | 676 g_return_if_fail(ptr); |
688 xboolean = my_arg(gboolean); | 690 xboolean = my_arg(gboolean); |
689 dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &xboolean); | 691 dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &xboolean); |
690 break; | 692 break; |
691 case GAIM_TYPE_STRING: | 693 case GAIM_TYPE_STRING: |
692 str = null_to_empty(my_arg(char*)); | 694 str = null_to_empty(my_arg(char*)); |
695 if (!g_utf8_validate(str, -1, NULL)) { | |
696 gaim_debug_error("dbus", "Invalid UTF-8 string passed to signal, emitting salvaged string!\n"); | |
697 str = gaim_utf8_salvage(str); | |
698 allocated = TRUE; | |
699 } | |
693 dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &str); | 700 dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &str); |
701 if (allocated) | |
702 g_free(str); | |
694 break; | 703 break; |
695 case GAIM_TYPE_SUBTYPE: /* registered pointers only! */ | 704 case GAIM_TYPE_SUBTYPE: /* registered pointers only! */ |
696 case GAIM_TYPE_POINTER: | 705 case GAIM_TYPE_POINTER: |
697 case GAIM_TYPE_OBJECT: | 706 case GAIM_TYPE_OBJECT: |
698 case GAIM_TYPE_BOXED: | 707 case GAIM_TYPE_BOXED: |