view finch/libgnt/gntutils.h @ 17284:37499e926a42

Add new MsimMessage element type, MSIM_TYPE_RAW, for fields in incoming protocol messages that don't have any type information associated with them. These elements will be unescaped if used as strings, in msim_msg_get_string(), and won't be escaped if serialized into a protocol message in msim_msg_element_pack(). On the other hand, MSIM_TYPE_STRING will be escaped when packed. Previously, everything was MSIM_TYPE_STRING, leading to more complicated escaping. Now, an instant message "foo/bar\baz" will be represented as follows: bm(raw): 1 f(raw): 180301984 cv(raw): 673 msg(raw): foo/1bar/2baz And it will be interpreted by the receiving client correctly-- msim_msg_get_string(..., "msg") will be "foo/bar\baz".
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Sat, 02 Jun 2007 02:43:43 +0000
parents 5f204f55af09
children 8410511f4dbb
line wrap: on
line source

#include <glib.h>

#include "gnt.h"
#include "gntwidget.h"

typedef gpointer (*GDupFunc)(gconstpointer data);

void gnt_util_get_text_bound(const char *text, int *width, int *height);

/* excluding *end */
int gnt_util_onscreen_width(const char *start, const char *end);

const char *gnt_util_onscreen_width_to_pointer(const char *str, int len, int *w);

/* Inserts newlines in 'string' where necessary so that its onscreen width is
 * no more than 'maxw'.
 * 'maxw' can be <= 0, in which case the maximum screen width is considered.
 *
 * Returns a newly allocated string.
 */
char *gnt_util_onscreen_fit_string(const char *string, int maxw);

GHashTable *g_hash_table_duplicate(GHashTable *src, GHashFunc hash,
		GEqualFunc equal, GDestroyNotify key_d, GDestroyNotify value_d,
		GDupFunc key_dup, GDupFunc value_dup);


/**
 * To be used with g_signal_new. Look in the key_pressed signal-definition in
 * gntwidget.c for usage.
 */
gboolean gnt_boolean_handled_accumulator(GSignalInvocationHint *ihint,
				  GValue                *return_accu,
				  const GValue          *handler_return,
				  gpointer               dummy);

/**
 * Returns a GntTree populated with "key" -> "binding" for the widget.
 */
GntWidget *gnt_widget_bindings_view(GntWidget *widget);

/**
 * Parse widgets from 'string'.
 */
void gnt_util_parse_widgets(const char *string, int num, ...);