Mercurial > pidgin.yaz
comparison plugins/raw.c @ 6387:b9c9f4d6f5d8
[gaim-migrate @ 6892]
Against my better judgement, raw.c now compiles.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Wed, 06 Aug 2003 08:39:56 +0000 |
parents | 8f94cce8faa5 |
children | 9e49daffac97 |
comparison
equal
deleted
inserted
replaced
6386:417f35ff8b3e | 6387:b9c9f4d6f5d8 |
---|---|
1 #include "gaim.h" | 1 #include "gtkinternal.h" |
2 | |
3 #include "conversation.h" | |
4 #include "debug.h" | |
2 #include "prpl.h" | 5 #include "prpl.h" |
3 #include "gtkplugin.h" | 6 #include "gtkplugin.h" |
7 | |
4 #ifdef MAX | 8 #ifdef MAX |
5 #undef MAX | 9 # undef MAX |
6 #undef MIN | 10 # undef MIN |
7 #endif | 11 #endif |
12 | |
8 #include "protocols/jabber/jabber.h" | 13 #include "protocols/jabber/jabber.h" |
9 #include "protocols/msn/session.h" | 14 #include "protocols/msn/session.h" |
10 | 15 |
11 #define RAW_PLUGIN_ID "raw" | 16 #define RAW_PLUGIN_ID "gtk-raw" |
12 | 17 |
13 static GtkWidget *window = NULL; | 18 static GtkWidget *window = NULL; |
14 static GtkWidget *optmenu = NULL; | 19 static GtkWidget *optmenu = NULL; |
15 static struct gaim_connection *gc = NULL; | 20 static GaimConnection *gc = NULL; |
16 static GaimPlugin *me = NULL; | 21 static GaimPlugin *me = NULL; |
17 | 22 |
18 static int goodbye() | 23 static int goodbye() |
19 { | 24 { |
20 gaim_plugin_unload(me); | 25 gaim_plugin_unload(me); |
24 static void send_it(GtkEntry *entry) | 29 static void send_it(GtkEntry *entry) |
25 { | 30 { |
26 const char *txt; | 31 const char *txt; |
27 if (!gc) return; | 32 if (!gc) return; |
28 txt = gtk_entry_get_text(entry); | 33 txt = gtk_entry_get_text(entry); |
29 switch (gc->protocol) { | 34 switch (gaim_connection_get_protocol(gc)) { |
30 case GAIM_PROTO_TOC: | 35 case GAIM_PROTO_TOC: |
31 { | 36 { |
32 int *a = (int *)gc->proto_data; | 37 int *a = (int *)gc->proto_data; |
33 unsigned short seqno = htons(a[1]++ & 0xffff); | 38 unsigned short seqno = htons(a[1]++ & 0xffff); |
34 unsigned short len = htons(strlen(txt) + 1); | 39 unsigned short len = htons(strlen(txt) + 1); |
58 break; | 63 break; |
59 } | 64 } |
60 gtk_entry_set_text(entry, ""); | 65 gtk_entry_set_text(entry, ""); |
61 } | 66 } |
62 | 67 |
63 static void set_gc(gpointer d, struct gaim_connection *c) | 68 static void set_gc(gpointer d, GaimConnection *c) |
64 { | 69 { |
65 gc = c; | 70 gc = c; |
66 } | 71 } |
67 | 72 |
68 static void redo_optmenu(struct gaim_connection *arg, gpointer x) | 73 static void redo_optmenu(GaimConnection *arg, gpointer x) |
69 { | 74 { |
70 GtkWidget *menu; | 75 GtkWidget *menu; |
71 GSList *g = connections; | 76 GList *g = gaim_connections_get_all(); |
72 struct gaim_connection *c; | 77 GaimConnection *c; |
78 GaimAccount *account; | |
79 GaimPlugin *plugin; | |
73 | 80 |
74 menu = gtk_menu_new(); | 81 menu = gtk_menu_new(); |
75 gc = NULL; | 82 gc = NULL; |
76 | 83 |
77 while (g) { | 84 while (g) { |
78 char buf[256]; | 85 char buf[256]; |
79 GtkWidget *opt; | 86 GtkWidget *opt; |
80 c = (struct gaim_connection *)g->data; | 87 c = (GaimConnection *)g->data; |
81 g = g->next; | 88 g = g->next; |
82 if (x && c == arg) | 89 if (x && c == arg) |
83 continue; | 90 continue; |
84 if (c->protocol != GAIM_PROTO_TOC && c->protocol != GAIM_PROTO_MSN && | 91 if (gaim_connection_get_protocol(c) != GAIM_PROTO_TOC && |
85 c->protocol != GAIM_PROTO_IRC && c->protocol != GAIM_PROTO_JABBER) | 92 gaim_connection_get_protocol(c) != GAIM_PROTO_MSN && |
93 gaim_connection_get_protocol(c) != GAIM_PROTO_IRC && | |
94 gaim_connection_get_protocol(c) != GAIM_PROTO_JABBER) | |
86 continue; | 95 continue; |
87 if (!gc) | 96 if (!gc) |
88 gc = c; | 97 gc = c; |
89 g_snprintf(buf, sizeof buf, "%s (%s)", c->username, | 98 |
90 c->prpl->info->name); | 99 account = gaim_connection_get_account(c); |
100 | |
101 plugin = gaim_find_prpl(gaim_account_get_protocol(account)); | |
102 | |
103 g_snprintf(buf, sizeof buf, "%s (%s)", | |
104 gaim_account_get_username(account), | |
105 plugin->info->name); | |
106 | |
91 opt = gtk_menu_item_new_with_label(buf); | 107 opt = gtk_menu_item_new_with_label(buf); |
92 g_signal_connect(G_OBJECT(opt), "activate", G_CALLBACK(set_gc), c); | 108 g_signal_connect(G_OBJECT(opt), "activate", G_CALLBACK(set_gc), c); |
93 gtk_widget_show(opt); | 109 gtk_widget_show(opt); |
94 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); | 110 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); |
95 } | 111 } |