Wed, 17 Jan 2007 08:58:26 +0000
[gaim-migrate @ 18143]
A really great raw XMPP plugin.
| 15412 | 1 | /* |
| 2 | * Gaim - XMPP debugging tool | |
| 3 | * | |
| 4 | * Copyright (C) 2002-2003, Sean Egan | |
| 5 | * | |
| 6 | * This program is free software; you can redistribute it and/or modify | |
| 7 | * it under the terms of the GNU General Public License as published by | |
| 8 | * the Free Software Foundation; either version 2 of the License, or | |
| 9 | * (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 19 | * | |
| 20 | */ | |
| 21 | ||
| 22 | #include "internal.h" | |
| 23 | #include "gtkplugin.h" | |
| 24 | #include "version.h" | |
| 25 | #include "prpl.h" | |
| 26 | #include "xmlnode.h" | |
| 27 | ||
| 28 | #include "gtkimhtml.h" | |
| 29 | ||
| 30 | typedef struct { | |
| 31 | GaimConnection *gc; | |
| 32 | GtkWidget *window; | |
| 33 | GtkWidget *hbox; | |
| 34 | GtkWidget *dropdown; | |
| 35 | GtkWidget *imhtml; | |
| 36 | GtkWidget *entry; | |
| 37 | GtkWidget *sw; | |
| 38 | int count; | |
| 39 | GList *accounts; | |
| 40 | } XmppConsole; | |
| 41 | ||
| 42 | XmppConsole *console = NULL; | |
| 43 | static void *xmpp_console_handle = NULL; | |
| 44 | ||
| 45 | #define BRACKET_COLOR "#940f8c" | |
| 46 | #define TAG_COLOR "#8b1dab" | |
| 47 | #define ATTR_NAME_COLOR "#a02961" | |
| 48 | #define ATTR_VALUE_COLOR "#324aa4" | |
| 49 | #define XMLNS_COLOR "#2cb12f" | |
| 50 | ||
| 51 | static char * | |
| 52 | xmlnode_to_pretty_str(xmlnode *node, int *len, int depth) | |
| 53 | { | |
| 54 | GString *text = g_string_new(""); | |
| 55 | xmlnode *c; | |
| 56 | char *node_name, *esc, *esc2, *tab = NULL; | |
| 57 | gboolean need_end = FALSE, pretty = TRUE; | |
| 58 | ||
| 59 | g_return_val_if_fail(node != NULL, NULL); | |
| 60 | ||
| 61 | if(pretty && depth) { | |
| 62 | tab = g_strnfill(depth, '\t'); | |
| 63 | text = g_string_append(text, tab); | |
| 64 | } | |
| 65 | ||
| 66 | node_name = g_markup_escape_text(node->name, -1); | |
| 67 | g_string_append_printf(text, "<font color='" | |
| 68 | BRACKET_COLOR "'><</font><font color='" | |
| 69 | TAG_COLOR "'><b>%s</b></font>", node_name); | |
| 70 | ||
| 71 | if (node->xmlns) { | |
| 72 | if((!node->parent || | |
| 73 | !node->parent->xmlns || | |
| 74 | strcmp(node->xmlns, node->parent->xmlns)) && | |
| 75 | strcmp(node->xmlns, "jabber:client")) | |
| 76 | { | |
| 77 | char *xmlns = g_markup_escape_text(node->xmlns, -1); | |
| 78 | g_string_append_printf(text, " <font color='" | |
| 79 | ATTR_NAME_COLOR "'><b>xmlns</b></font>='<font color='" | |
| 80 | XMLNS_COLOR "'><b>%s</b></font>'", xmlns); | |
| 81 | g_free(xmlns); | |
| 82 | } | |
| 83 | } | |
| 84 | for(c = node->child; c; c = c->next) | |
| 85 | { | |
| 86 | if(c->type == XMLNODE_TYPE_ATTRIB) { | |
| 87 | esc = g_markup_escape_text(c->name, -1); | |
| 88 | esc2 = g_markup_escape_text(c->data, -1); | |
| 89 | g_string_append_printf(text, " <font color='" | |
| 90 | ATTR_NAME_COLOR "'><b>%s</b></font>='<font color='" | |
| 91 | ATTR_VALUE_COLOR "'>%s</font>'", esc, esc2); | |
| 92 | g_free(esc); | |
| 93 | g_free(esc2); | |
| 94 | } else if(c->type == XMLNODE_TYPE_TAG || c->type == XMLNODE_TYPE_DATA) { | |
| 95 | if(c->type == XMLNODE_TYPE_DATA) | |
| 96 | pretty = FALSE; | |
| 97 | need_end = TRUE; | |
| 98 | } | |
| 99 | } | |
| 100 | ||
| 101 | if(need_end) { | |
| 102 | g_string_append_printf(text, | |
| 103 | "<font color='"BRACKET_COLOR"'>></font>%s", pretty ? "<br>" : ""); | |
| 104 | ||
| 105 | for(c = node->child; c; c = c->next) | |
| 106 | { | |
| 107 | if(c->type == XMLNODE_TYPE_TAG) { | |
| 108 | int esc_len; | |
| 109 | esc = xmlnode_to_pretty_str(c, &esc_len, depth+1); | |
| 110 | text = g_string_append_len(text, esc, esc_len); | |
| 111 | g_free(esc); | |
| 112 | } else if(c->type == XMLNODE_TYPE_DATA && c->data_sz > 0) { | |
| 113 | esc = g_markup_escape_text(c->data, c->data_sz); | |
| 114 | text = g_string_append(text, esc); | |
| 115 | g_free(esc); | |
| 116 | } | |
| 117 | } | |
| 118 | ||
| 119 | if(tab && pretty) | |
| 120 | text = g_string_append(text, tab); | |
| 121 | g_string_append_printf(text, "<font color='"BRACKET_COLOR"'><</font>/<font color='" | |
| 122 | TAG_COLOR"'><b>%s</b></font><font color='"BRACKET_COLOR | |
| 123 | "'>></font><br>", node_name); | |
| 124 | } else { | |
| 125 | g_string_append_printf(text, "/<font color='"BRACKET_COLOR"'>></font><br>"); | |
| 126 | } | |
| 127 | ||
| 128 | g_free(node_name); | |
| 129 | ||
| 130 | g_free(tab); | |
| 131 | ||
| 132 | if(len) | |
| 133 | *len = text->len; | |
| 134 | ||
| 135 | return g_string_free(text, FALSE); | |
| 136 | } | |
| 137 | ||
| 138 | static void | |
| 139 | xmlnode_received_cb(GaimConnection *gc, xmlnode **packet, gpointer null) | |
| 140 | { | |
| 141 | char *str, *formatted; | |
| 142 | ||
| 143 | if (!console || console->gc != gc) | |
| 144 | return; | |
| 145 | str = xmlnode_to_pretty_str(*packet, NULL, 0); | |
| 146 | formatted = g_strdup_printf("<body bgcolor='#ffcece'><pre>%s</pre></body>", str); | |
| 147 | gtk_imhtml_append_text(GTK_IMHTML(console->imhtml), formatted, 0); | |
| 148 | g_free(formatted); | |
| 149 | g_free(str); | |
| 150 | } | |
| 151 | ||
| 152 | static void | |
| 153 | xmlnode_sent_cb(GaimConnection *gc, char **packet, gpointer null) | |
| 154 | { | |
| 155 | char *str; | |
| 156 | char *formatted; | |
| 157 | xmlnode *node; | |
| 158 | ||
| 159 | if (!console || console->gc != gc) | |
| 160 | return; | |
| 161 | node = xmlnode_from_str(*packet, -1); | |
| 162 | ||
| 163 | if (!node) | |
| 164 | return; | |
| 165 | ||
| 166 | str = xmlnode_to_pretty_str(node, NULL, 0); | |
| 167 | formatted = g_strdup_printf("<body bgcolor='#dcecc4'><pre>%s</pre></body>", str); | |
| 168 | gtk_imhtml_append_text(GTK_IMHTML(console->imhtml), formatted, 0); | |
| 169 | g_free(formatted); | |
| 170 | g_free(str); | |
| 171 | xmlnode_free(node); | |
| 172 | } | |
| 173 | ||
| 174 | static void message_send_cb(GtkWidget *widget, gpointer p) | |
| 175 | { | |
| 176 | GtkTextIter start, end; | |
| 177 | GaimPluginProtocolInfo *prpl_info = NULL; | |
| 178 | GaimConnection *gc = console->gc; | |
| 179 | GtkTextBuffer *buffer; | |
| 180 | char *text; | |
| 181 | ||
| 182 | gc = console->gc; | |
| 183 | ||
| 184 | prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
| 185 | ||
| 186 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); | |
| 187 | gtk_text_buffer_get_start_iter(buffer, &start); | |
| 188 | gtk_text_buffer_get_end_iter(buffer, &end); | |
| 189 | ||
| 190 | text = gtk_imhtml_get_text(GTK_IMHTML(console->entry), &start, &end); | |
| 191 | ||
| 192 | if (gc && prpl_info->convo_closed != NULL) | |
| 193 | prpl_info->send_raw(gc, text, strlen(text)); | |
| 194 | ||
| 195 | g_free(text); | |
| 196 | gtk_imhtml_clear(GTK_IMHTML(console->entry)); | |
| 197 | } | |
| 198 | ||
| 199 | static void entry_changed_cb(GtkTextBuffer *buffer, void *data) | |
| 200 | { | |
| 201 | char *xmlstr, *str; | |
| 202 | GtkTextIter iter; | |
| 203 | int wrapped_lines; | |
| 204 | int lines; | |
| 205 | GdkRectangle oneline; | |
| 206 | int height; | |
| 207 | int pad_top, pad_inside, pad_bottom; | |
| 208 | GtkTextIter start, end; | |
| 209 | xmlnode *node; | |
| 210 | ||
| 211 | wrapped_lines = 1; | |
| 212 | gtk_text_buffer_get_start_iter(buffer, &iter); | |
| 213 | gtk_text_view_get_iter_location(GTK_TEXT_VIEW(console->entry), &iter, &oneline); | |
| 214 | while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(console->entry), &iter)) | |
| 215 | wrapped_lines++; | |
| 216 | ||
| 217 | lines = gtk_text_buffer_get_line_count(buffer); | |
| 218 | ||
| 219 | /* Show a maximum of 64 lines */ | |
| 220 | lines = MIN(lines, 6); | |
| 221 | wrapped_lines = MIN(wrapped_lines, 6); | |
| 222 | ||
| 223 | pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(console->entry)); | |
| 224 | pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(console->entry)); | |
| 225 | pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(console->entry)); | |
| 226 | ||
| 227 | height = (oneline.height + pad_top + pad_bottom) * lines; | |
| 228 | height += (oneline.height + pad_inside) * (wrapped_lines - lines); | |
| 229 | ||
| 230 | gtk_widget_set_size_request(console->sw, -1, height+6); | |
| 231 | ||
| 232 | ||
| 233 | ||
| 234 | gtk_text_buffer_get_start_iter(buffer, &start); | |
| 235 | gtk_text_buffer_get_end_iter(buffer, &end); | |
| 236 | str = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); | |
| 237 | if (!str) | |
| 238 | return; | |
| 239 | xmlstr = g_strdup_printf("<xml>%s</xml>", str); | |
| 240 | node = xmlnode_from_str(xmlstr, -1); | |
| 241 | if (node) { | |
| 242 | gtk_imhtml_clear_formatting(GTK_IMHTML(console->entry)); | |
| 243 | } else { | |
| 244 | gtk_imhtml_toggle_background(GTK_IMHTML(console->entry), "#ffcece"); | |
| 245 | } | |
| 246 | g_free(str); | |
| 247 | g_free(xmlstr); | |
| 248 | if (node) | |
| 249 | xmlnode_free(node); | |
| 250 | } | |
| 251 | ||
| 252 | static void iq_clicked_cb(GtkWidget *w, gpointer nul) | |
| 253 | { | |
| 254 | GtkWidget *hbox, *to_entry, *label, *type_combo; | |
| 255 | GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
| 256 | GtkTextIter iter; | |
| 257 | GtkTextBuffer *buffer; | |
| 258 | const char *to; | |
| 259 | int result; | |
| 260 | char *stanza; | |
| 261 | ||
| 262 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<iq/>", | |
| 263 | GTK_WINDOW(console->window), | |
| 264 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 265 | GTK_STOCK_CANCEL, | |
| 266 | GTK_RESPONSE_REJECT, | |
| 267 | GTK_STOCK_OK, | |
| 268 | GTK_RESPONSE_ACCEPT, | |
| 269 | NULL); | |
| 270 | gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); | |
| 271 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); | |
| 272 | gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); | |
| 273 | ||
| 274 | hbox = gtk_hbox_new(FALSE, 3); | |
| 275 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); | |
| 276 | ||
| 277 | label = gtk_label_new("To:"); | |
| 278 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 279 | gtk_size_group_add_widget(sg, label); | |
| 280 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 281 | ||
| 282 | to_entry = gtk_entry_new(); | |
| 283 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 284 | gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); | |
| 285 | ||
| 286 | hbox = gtk_hbox_new(FALSE, 3); | |
| 287 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); | |
| 288 | label = gtk_label_new("Type:"); | |
| 289 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 290 | ||
| 291 | gtk_size_group_add_widget(sg, label); | |
| 292 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 293 | type_combo = gtk_combo_box_new_text(); | |
| 294 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "get"); | |
| 295 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "set"); | |
| 296 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "result"); | |
| 297 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "error"); | |
| 298 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); | |
| 299 | gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); | |
| 300 | ||
| 301 | gtk_widget_show_all(GTK_DIALOG(dialog)->vbox); | |
| 302 | ||
| 303 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 304 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 305 | gtk_widget_destroy(dialog); | |
| 306 | return; | |
| 307 | } | |
| 308 | ||
| 309 | to = gtk_entry_get_text(GTK_ENTRY(to_entry)); | |
| 310 | ||
| 311 | stanza = g_strdup_printf("<iq %s%s%s id='console%x' type='%s'></iq>", | |
| 312 | to && *to ? "to='" : "", | |
| 313 | to && *to ? to : "", | |
| 314 | to && *to ? "'" : "", | |
| 315 | g_random_int(), | |
| 316 | gtk_combo_box_get_active_text(GTK_COMBO_BOX(type_combo))); | |
| 317 | ||
| 318 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); | |
| 319 | gtk_text_buffer_set_text(buffer, stanza, -1); | |
| 320 | gtk_text_buffer_get_iter_at_offset(buffer, &iter, strstr(stanza, "</iq>") - stanza); | |
| 321 | gtk_text_buffer_place_cursor(buffer, &iter); | |
| 322 | g_free(stanza); | |
| 323 | ||
| 324 | gtk_widget_destroy(dialog); | |
| 325 | ||
| 326 | } | |
| 327 | ||
| 328 | static void presence_clicked_cb(GtkWidget *w, gpointer nul) | |
| 329 | { | |
| 330 | GtkWidget *hbox, | |
| 331 | *to_entry, | |
| 332 | *status_entry, | |
| 333 | *priority_entry, | |
| 334 | *label, | |
| 335 | *show_combo, | |
| 336 | *type_combo; | |
| 337 | GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
| 338 | GtkTextIter iter; | |
| 339 | GtkTextBuffer *buffer; | |
| 340 | const char *to, *type, *status, *show, *priority; | |
| 341 | int result; | |
| 342 | char *stanza; | |
| 343 | ||
| 344 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<presence/>", | |
| 345 | GTK_WINDOW(console->window), | |
| 346 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 347 | GTK_STOCK_CANCEL, | |
| 348 | GTK_RESPONSE_REJECT, | |
| 349 | GTK_STOCK_OK, | |
| 350 | GTK_RESPONSE_ACCEPT, | |
| 351 | NULL); | |
| 352 | gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); | |
| 353 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); | |
| 354 | gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); | |
| 355 | ||
| 356 | hbox = gtk_hbox_new(FALSE, 3); | |
| 357 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); | |
| 358 | ||
| 359 | label = gtk_label_new("To:"); | |
| 360 | gtk_size_group_add_widget(sg, label); | |
| 361 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 362 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 363 | ||
| 364 | to_entry = gtk_entry_new(); | |
| 365 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 366 | gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); | |
| 367 | ||
| 368 | hbox = gtk_hbox_new(FALSE, 3); | |
| 369 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); | |
| 370 | label = gtk_label_new("Type:"); | |
| 371 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 372 | gtk_size_group_add_widget(sg, label); | |
| 373 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 374 | type_combo = gtk_combo_box_new_text(); | |
| 375 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "default"); | |
| 376 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "unavailable"); | |
| 377 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "subscribe"); | |
| 378 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "unsubscribe"); | |
| 379 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "subscribed"); | |
| 380 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "unsubscribed"); | |
| 381 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "probe"); | |
| 382 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "error"); | |
| 383 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); | |
| 384 | gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); | |
| 385 | ||
| 386 | hbox = gtk_hbox_new(FALSE, 3); | |
| 387 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); | |
| 388 | label = gtk_label_new("Show:"); | |
| 389 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 390 | gtk_size_group_add_widget(sg, label); | |
| 391 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 392 | show_combo = gtk_combo_box_new_text(); | |
| 393 | gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "default"); | |
| 394 | gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "away"); | |
| 395 | gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "dnd"); | |
| 396 | gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "xa"); | |
| 397 | gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "chat"); | |
| 398 | ||
| 399 | gtk_combo_box_set_active(GTK_COMBO_BOX(show_combo), 0); | |
| 400 | gtk_box_pack_start(GTK_BOX(hbox), show_combo, FALSE, FALSE, 0); | |
| 401 | ||
| 402 | hbox = gtk_hbox_new(FALSE, 3); | |
| 403 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); | |
| 404 | ||
| 405 | label = gtk_label_new("Status:"); | |
| 406 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 407 | gtk_size_group_add_widget(sg, label); | |
| 408 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 409 | ||
| 410 | status_entry = gtk_entry_new(); | |
| 411 | gtk_entry_set_activates_default (GTK_ENTRY (status_entry), TRUE); | |
| 412 | gtk_box_pack_start(GTK_BOX(hbox), status_entry, FALSE, FALSE, 0); | |
| 413 | ||
| 414 | ||
| 415 | hbox = gtk_hbox_new(FALSE, 3); | |
| 416 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); | |
| 417 | ||
| 418 | label = gtk_label_new("Priority:"); | |
| 419 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 420 | gtk_size_group_add_widget(sg, label); | |
| 421 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 422 | ||
| 423 | priority_entry = gtk_spin_button_new_with_range(-128, 127, 1); | |
| 424 | gtk_spin_button_set_value(GTK_SPIN_BUTTON(priority_entry), 0); | |
| 425 | gtk_box_pack_start(GTK_BOX(hbox), priority_entry, FALSE, FALSE, 0); | |
| 426 | ||
| 427 | ||
| 428 | gtk_widget_show_all(GTK_DIALOG(dialog)->vbox); | |
| 429 | ||
| 430 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 431 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 432 | gtk_widget_destroy(dialog); | |
| 433 | return; | |
| 434 | } | |
| 435 | ||
| 436 | to = gtk_entry_get_text(GTK_ENTRY(to_entry)); | |
| 437 | type = gtk_combo_box_get_active_text(GTK_COMBO_BOX(type_combo)); | |
| 438 | if (!strcmp(type, "default")) | |
| 439 | type = ""; | |
| 440 | show = gtk_combo_box_get_active_text(GTK_COMBO_BOX(show_combo)); | |
| 441 | if (!strcmp(show, "default")) | |
| 442 | show = ""; | |
| 443 | status = gtk_entry_get_text(GTK_ENTRY(status_entry)); | |
| 444 | priority = gtk_entry_get_text(GTK_ENTRY(priority_entry)); | |
| 445 | if (!strcmp(priority, "0")) | |
| 446 | priority = ""; | |
| 447 | ||
| 448 | ||
| 449 | ||
| 450 | stanza = g_strdup_printf("<presence %s%s%s id='console%x' %s%s%s>" | |
| 451 | "%s%s%s%s%s%s%s%s%s" | |
| 452 | "</presence>", | |
| 453 | *to ? "to='" : "", | |
| 454 | *to ? to : "", | |
| 455 | *to ? "'" : "", | |
| 456 | g_random_int(), | |
| 457 | ||
| 458 | *type ? "type='" : "", | |
| 459 | *type ? type : "", | |
| 460 | *type ? "'" : "", | |
| 461 | ||
| 462 | *show ? "<show>" : "", | |
| 463 | *show ? show : "", | |
| 464 | *show ? "</show>" : "", | |
| 465 | ||
| 466 | *status ? "<status>" : "", | |
| 467 | *status ? status : "", | |
| 468 | *status ? "</status>" : "", | |
| 469 | ||
| 470 | *priority ? "<priority>" : "", | |
| 471 | *priority ? priority : "", | |
| 472 | *priority ? "</priority>" : ""); | |
| 473 | ||
| 474 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); | |
| 475 | gtk_text_buffer_set_text(buffer, stanza, -1); | |
| 476 | gtk_text_buffer_get_iter_at_offset(buffer, &iter, strstr(stanza, "</presence>") - stanza); | |
| 477 | gtk_text_buffer_place_cursor(buffer, &iter); | |
| 478 | g_free(stanza); | |
| 479 | ||
| 480 | gtk_widget_destroy(dialog); | |
| 481 | } | |
| 482 | ||
| 483 | static void message_clicked_cb(GtkWidget *w, gpointer nul) | |
| 484 | { | |
| 485 | GtkWidget *hbox, | |
| 486 | *to_entry, | |
| 487 | *body_entry, | |
| 488 | *thread_entry, | |
| 489 | *subject_entry, | |
| 490 | *label, | |
| 491 | *type_combo; | |
| 492 | GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
| 493 | GtkTextIter iter; | |
| 494 | GtkTextBuffer *buffer; | |
| 495 | const char *to, *body, *thread, *subject; | |
| 496 | char *stanza; | |
| 497 | int result; | |
| 498 | ||
| 499 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<message/>", | |
| 500 | GTK_WINDOW(console->window), | |
| 501 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 502 | GTK_STOCK_CANCEL, | |
| 503 | GTK_RESPONSE_REJECT, | |
| 504 | GTK_STOCK_OK, | |
| 505 | GTK_RESPONSE_ACCEPT, | |
| 506 | NULL); | |
| 507 | gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); | |
| 508 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); | |
| 509 | gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); | |
| 510 | ||
| 511 | hbox = gtk_hbox_new(FALSE, 3); | |
| 512 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); | |
| 513 | ||
| 514 | label = gtk_label_new("To:"); | |
| 515 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 516 | gtk_size_group_add_widget(sg, label); | |
| 517 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 518 | ||
| 519 | to_entry = gtk_entry_new(); | |
| 520 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 521 | gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); | |
| 522 | ||
| 523 | hbox = gtk_hbox_new(FALSE, 3); | |
| 524 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); | |
| 525 | label = gtk_label_new("Type:"); | |
| 526 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 527 | gtk_size_group_add_widget(sg, label); | |
| 528 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 529 | type_combo = gtk_combo_box_new_text(); | |
| 530 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "chat"); | |
| 531 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "headline"); | |
| 532 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "groupchat"); | |
| 533 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "normal"); | |
| 534 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "error"); | |
| 535 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); | |
| 536 | gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); | |
| 537 | ||
| 538 | hbox = gtk_hbox_new(FALSE, 3); | |
| 539 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); | |
| 540 | ||
| 541 | label = gtk_label_new("Body:"); | |
| 542 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 543 | gtk_size_group_add_widget(sg, label); | |
| 544 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 545 | ||
| 546 | body_entry = gtk_entry_new(); | |
| 547 | gtk_entry_set_activates_default (GTK_ENTRY (body_entry), TRUE); | |
| 548 | gtk_box_pack_start(GTK_BOX(hbox), body_entry, FALSE, FALSE, 0); | |
| 549 | ||
| 550 | ||
| 551 | hbox = gtk_hbox_new(FALSE, 3); | |
| 552 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); | |
| 553 | ||
| 554 | label = gtk_label_new("Subject:"); | |
| 555 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 556 | gtk_size_group_add_widget(sg, label); | |
| 557 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 558 | ||
| 559 | subject_entry = gtk_entry_new(); | |
| 560 | gtk_entry_set_activates_default (GTK_ENTRY (subject_entry), TRUE); | |
| 561 | gtk_box_pack_start(GTK_BOX(hbox), subject_entry, FALSE, FALSE, 0); | |
| 562 | ||
| 563 | hbox = gtk_hbox_new(FALSE, 3); | |
| 564 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); | |
| 565 | ||
| 566 | label = gtk_label_new("Thread:"); | |
| 567 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 568 | gtk_size_group_add_widget(sg, label); | |
| 569 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 570 | ||
| 571 | thread_entry = gtk_entry_new(); | |
| 572 | gtk_entry_set_activates_default (GTK_ENTRY (thread_entry), TRUE); | |
| 573 | gtk_box_pack_start(GTK_BOX(hbox), thread_entry, FALSE, FALSE, 0); | |
| 574 | ||
| 575 | gtk_widget_show_all(GTK_DIALOG(dialog)->vbox); | |
| 576 | ||
| 577 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 578 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 579 | gtk_widget_destroy(dialog); | |
| 580 | return; | |
| 581 | } | |
| 582 | ||
| 583 | to = gtk_entry_get_text(GTK_ENTRY(to_entry)); | |
| 584 | body = gtk_entry_get_text(GTK_ENTRY(body_entry)); | |
| 585 | thread = gtk_entry_get_text(GTK_ENTRY(thread_entry)); | |
| 586 | subject = gtk_entry_get_text(GTK_ENTRY(subject_entry)); | |
| 587 | ||
| 588 | stanza = g_strdup_printf("<message %s%s%s id='console%x' type='%s'>" | |
| 589 | "%s%s%s%s%s%s%s%s%s" | |
| 590 | "</message>", | |
| 591 | ||
| 592 | *to ? "to='" : "", | |
| 593 | *to ? to : "", | |
| 594 | *to ? "'" : "", | |
| 595 | g_random_int(), | |
| 596 | gtk_combo_box_get_active_text(GTK_COMBO_BOX(type_combo)), | |
| 597 | ||
| 598 | *body ? "<body>" : "", | |
| 599 | *body ? body : "", | |
| 600 | *body ? "</body>" : "", | |
| 601 | ||
| 602 | *subject ? "<subject>" : "", | |
| 603 | *subject ? subject : "", | |
| 604 | *subject ? "</subject>" : "", | |
| 605 | ||
| 606 | *thread ? "<thread>" : "", | |
| 607 | *thread ? thread : "", | |
| 608 | *thread ? "</thread>" : ""); | |
| 609 | ||
| 610 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); | |
| 611 | gtk_text_buffer_set_text(buffer, stanza, -1); | |
| 612 | gtk_text_buffer_get_iter_at_offset(buffer, &iter, strstr(stanza, "</message>") - stanza); | |
| 613 | gtk_text_buffer_place_cursor(buffer, &iter); | |
| 614 | g_free(stanza); | |
| 615 | ||
| 616 | gtk_widget_destroy(dialog); | |
| 617 | } | |
| 618 | ||
| 619 | static void | |
| 620 | signed_on_cb(GaimConnection *gc) | |
| 621 | { | |
| 622 | if (!console) | |
| 623 | return; | |
| 624 | ||
| 625 | gtk_combo_box_append_text(GTK_COMBO_BOX(console->dropdown), gaim_account_get_username(gc->account)); | |
| 626 | console->accounts = g_list_append(console->accounts, gc); | |
| 627 | console->count++; | |
| 628 | ||
| 629 | if (console->count > 1) | |
| 630 | gtk_widget_show_all(console->hbox); | |
| 631 | } | |
| 632 | ||
| 633 | static void | |
| 634 | signed_off_cb(GaimConnection *gc) | |
| 635 | { | |
| 636 | int i = 0; | |
| 637 | GList *l; | |
| 638 | ||
| 639 | if (!console) | |
| 640 | return; | |
| 641 | ||
| 642 | l = console->accounts; | |
| 643 | while (l) { | |
| 644 | GaimConnection *g = l->data; | |
| 645 | if (gc == g) | |
| 646 | break; | |
| 647 | i++; | |
| 648 | l = l->next; | |
| 649 | } | |
| 650 | ||
| 651 | if (l == NULL) | |
| 652 | return; | |
| 653 | ||
| 654 | gtk_combo_box_remove_text(GTK_COMBO_BOX(console->dropdown), i); | |
| 655 | console->accounts = g_list_remove(console->accounts, gc); | |
| 656 | printf("%s\n", gaim_account_get_username(gc->account)); | |
| 657 | console->count--; | |
| 658 | ||
| 659 | if (gc == console->gc) { | |
| 660 | console->gc = NULL; | |
| 661 | gtk_imhtml_append_text(GTK_IMHTML(console->imhtml), | |
| 662 | _("<font color='#777777'>Logged out.</font>"), 0); | |
| 663 | } | |
| 664 | } | |
| 665 | ||
| 666 | static gboolean | |
| 667 | plugin_load(GaimPlugin *plugin) | |
| 668 | { | |
| 669 | GaimPlugin *jabber; | |
| 670 | ||
| 671 | jabber = gaim_find_prpl("prpl-jabber"); | |
| 672 | if (!jabber) | |
| 673 | return FALSE; | |
| 674 | ||
| 675 | xmpp_console_handle = plugin; | |
| 676 | gaim_signal_connect(jabber, "jabber-receiving-xmlnode", xmpp_console_handle, | |
| 677 | GAIM_CALLBACK(xmlnode_received_cb), NULL); | |
| 678 | gaim_signal_connect(jabber, "jabber-sending-text", xmpp_console_handle, | |
| 679 | GAIM_CALLBACK(xmlnode_sent_cb), NULL); | |
| 680 | gaim_signal_connect(gaim_connections_get_handle(), "signed-on", | |
| 681 | plugin, GAIM_CALLBACK(signed_on_cb), NULL); | |
| 682 | gaim_signal_connect(gaim_connections_get_handle(), "signed-off", | |
| 683 | plugin, GAIM_CALLBACK(signed_off_cb), NULL); | |
| 684 | ||
| 685 | return TRUE; | |
| 686 | } | |
| 687 | ||
| 688 | static gboolean | |
| 689 | plugin_unload(GaimPlugin *plugin) | |
| 690 | { | |
| 691 | gtk_widget_destroy(console->window); | |
| 692 | console->window = NULL; | |
| 693 | return TRUE; | |
| 694 | } | |
| 695 | ||
| 696 | static void | |
| 697 | console_destroy(GtkObject *window, gpointer nul) | |
| 698 | { | |
| 699 | g_list_free(console->accounts); | |
| 700 | g_free(console); | |
| 701 | console = NULL; | |
| 702 | } | |
| 703 | ||
| 704 | static void | |
| 705 | dropdown_changed_cb(GtkComboBox *widget, gpointer nul) | |
| 706 | { | |
| 707 | GaimAccount *account; | |
| 708 | ||
| 709 | if (!console) | |
| 710 | return; | |
| 711 | ||
| 712 | account = gaim_accounts_find(gtk_combo_box_get_active_text(GTK_COMBO_BOX(console->dropdown)), | |
| 713 | "prpl-jabber"); | |
| 714 | if (!account || !account->gc) | |
| 715 | return; | |
| 716 | ||
| 717 | console->gc = account->gc; | |
| 718 | gtk_imhtml_clear(GTK_IMHTML(console->imhtml)); | |
| 719 | } | |
| 720 | ||
| 721 | static void | |
| 722 | create_console() | |
| 723 | { | |
| 724 | GtkWidget *vbox = gtk_vbox_new(FALSE, 6); | |
| 725 | GtkWidget *sw = gtk_scrolled_window_new(NULL, NULL); | |
| 726 | GtkWidget *label; | |
| 727 | GtkTextBuffer *buffer; | |
| 728 | GtkWidget *toolbar; | |
| 729 | GtkToolItem *button; | |
| 730 | GList *connections; | |
| 731 | ||
| 732 | if (console) { | |
| 733 | gtk_window_present(GTK_WINDOW(console->window)); | |
| 734 | return; | |
| 735 | } | |
| 736 | ||
| 737 | console = g_new0(XmppConsole, 1); | |
| 738 | ||
| 739 | console->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
| 740 | gtk_window_set_title(GTK_WINDOW(console->window), _("XMPP Console")); | |
| 741 | g_signal_connect(G_OBJECT(console->window), "destroy", G_CALLBACK(console_destroy), NULL); | |
| 742 | gtk_container_set_border_width(GTK_CONTAINER(console->window), 12); | |
| 743 | gtk_window_set_default_size(GTK_WINDOW(console->window), 580, 400); | |
| 744 | gtk_container_add(GTK_CONTAINER(console->window), vbox); | |
| 745 | ||
| 746 | console->hbox = gtk_hbox_new(FALSE, 3); | |
| 747 | gtk_box_pack_start(GTK_BOX(vbox), console->hbox, FALSE, FALSE, 0); | |
| 748 | label = gtk_label_new(_("Account: ")); | |
| 749 | gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); | |
| 750 | gtk_box_pack_start(GTK_BOX(console->hbox), label, FALSE, FALSE, 0); | |
| 751 | console->dropdown = gtk_combo_box_new_text(); | |
| 752 | for (connections = gaim_connections_get_all(); connections; connections = connections->next) { | |
| 753 | GaimConnection *gc = connections->data; | |
| 754 | if (!strcmp(gaim_account_get_protocol_id(gaim_connection_get_account(gc)), "prpl-jabber")) { | |
| 755 | console->count++; | |
| 756 | console->accounts = g_list_append(console->accounts, gc); | |
| 757 | gtk_combo_box_append_text(GTK_COMBO_BOX(console->dropdown), | |
| 758 | gaim_account_get_username(gaim_connection_get_account(gc))); | |
| 759 | if (!console->gc) | |
| 760 | console->gc = gc; | |
| 761 | } | |
| 762 | } | |
| 763 | gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown),0); | |
| 764 | gtk_box_pack_start(GTK_BOX(console->hbox), console->dropdown, TRUE, TRUE, 0); | |
| 765 | g_signal_connect(G_OBJECT(console->dropdown), "changed", G_CALLBACK(dropdown_changed_cb), NULL); | |
| 766 | ||
| 767 | gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); | |
| 768 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
| 769 | GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
| 770 | ||
| 771 | console->imhtml = gtk_imhtml_new(NULL, NULL); | |
| 772 | gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
| 773 | if (console->count == 0) | |
| 774 | gtk_imhtml_append_text(GTK_IMHTML(console->imhtml), | |
| 775 | _("<font color='#777777'>Not connected to XMPP</font>"), 0); | |
| 776 | gtk_container_add(GTK_CONTAINER(sw), console->imhtml); | |
| 777 | ||
| 778 | toolbar = gtk_toolbar_new(); | |
| 779 | button = gtk_tool_button_new(NULL, "<iq/>"); | |
| 780 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(iq_clicked_cb), NULL); | |
| 781 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); | |
| 782 | ||
| 783 | button = gtk_tool_button_new(NULL, "<presence/>"); | |
| 784 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(presence_clicked_cb), NULL); | |
| 785 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); | |
| 786 | ||
| 787 | button = gtk_tool_button_new(NULL, "<message/>"); | |
| 788 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(message_clicked_cb), NULL); | |
| 789 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); | |
| 790 | ||
| 791 | gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); | |
| 792 | ||
| 793 | sw = gtk_scrolled_window_new(NULL, NULL); | |
| 794 | gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); | |
| 795 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
| 796 | GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
| 797 | ||
| 798 | console->entry = gtk_imhtml_new(NULL, NULL); | |
| 799 | gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(console->entry), TRUE); | |
| 800 | g_signal_connect(G_OBJECT(console->entry),"message_send", G_CALLBACK(message_send_cb), console); | |
| 801 | ||
| 802 | gtk_box_pack_start(GTK_BOX(vbox), sw, FALSE, FALSE, 0); | |
| 803 | gtk_container_add(GTK_CONTAINER(sw), console->entry); | |
| 804 | gtk_imhtml_set_editable(GTK_IMHTML(console->entry), TRUE); | |
| 805 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); | |
| 806 | g_signal_connect(G_OBJECT(buffer), "changed", G_CALLBACK(entry_changed_cb), NULL); | |
| 807 | console->sw = sw; | |
| 808 | entry_changed_cb(buffer, NULL); | |
| 809 | ||
| 810 | gtk_widget_show_all(console->window); | |
| 811 | if (console->count < 2) | |
| 812 | gtk_widget_hide(console->hbox); | |
| 813 | } | |
| 814 | ||
| 815 | static GList * | |
| 816 | actions(GaimPlugin *plugin, gpointer context) | |
| 817 | { | |
| 818 | GList *l = NULL; | |
| 819 | GaimPluginAction *act = NULL; | |
| 820 | ||
| 821 | act = gaim_plugin_action_new(_("XMPP Console"), create_console); | |
| 822 | l = g_list_append(l, act); | |
| 823 | ||
| 824 | return l; | |
| 825 | } | |
| 826 | ||
| 827 | ||
| 828 | static GaimPluginInfo info = | |
| 829 | { | |
| 830 | GAIM_PLUGIN_MAGIC, | |
| 831 | GAIM_MAJOR_VERSION, | |
| 832 | GAIM_MINOR_VERSION, | |
| 833 | GAIM_PLUGIN_STANDARD, /**< type */ | |
| 834 | GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ | |
| 835 | 0, /**< flags */ | |
| 836 | NULL, /**< dependencies */ | |
| 837 | GAIM_PRIORITY_DEFAULT, /**< priority */ | |
| 838 | ||
| 839 | "gtk-xmpp", /**< id */ | |
| 840 | N_("XMPP Console"), /**< name */ | |
| 841 | VERSION, /**< version */ | |
| 842 | /** summary */ | |
| 843 | N_("Send and receive raw XMPP stanzas."), | |
| 844 | /** description */ | |
| 845 | N_("This plugin is useful for debbuging XMPP servers or clients."), | |
| 846 | "Sean Egan <seanegan@gmail.com>", /**< author */ | |
| 847 | GAIM_WEBSITE, /**< homepage */ | |
| 848 | ||
| 849 | plugin_load, /**< load */ | |
| 850 | plugin_unload, /**< unload */ | |
| 851 | NULL, /**< destroy */ | |
| 852 | ||
| 853 | NULL, /**< ui_info */ | |
| 854 | NULL, /**< extra_info */ | |
| 855 | NULL, | |
| 856 | actions | |
| 857 | }; | |
| 858 | ||
| 859 | static void | |
| 860 | init_plugin(GaimPlugin *plugin) | |
| 861 | { | |
| 862 | } | |
| 863 | ||
| 864 | GAIM_INIT_PLUGIN(interval, init_plugin, info) |