Mercurial > pidgin
annotate plugins/gaim-remote/remote.c @ 9131:4ae763960140
[gaim-migrate @ 9912]
Thanks to tszcheetah's bug 961232 I fixed the icon freezing problem.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 30 May 2004 20:34:14 +0000 |
parents | 294ae6548d4e |
children | eae7e049d639 |
rev | line source |
---|---|
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6179
diff
changeset
|
1 /** |
5859 | 2 * Remote control plugin for Gaim |
3 * | |
4 * Copyright (C) 2003 Christian Hammond. | |
5 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
6 * | |
7 * This program is free software; you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation; either version 2 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
20 * 02111-1307, USA. | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
21 * |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
22 * @todo Make this a core plugin! |
5859 | 23 */ |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
24 #include "internal.h" |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6179
diff
changeset
|
25 #include "gtkinternal.h" |
5859 | 26 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
27 #ifndef _WIN32 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
28 # include <sys/un.h> |
5859 | 29 #endif |
30 | |
31 #include <signal.h> | |
32 #include <getopt.h> | |
33 | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
34 #include "conversation.h" |
6179
16e384bb7fbf
[gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents:
6177
diff
changeset
|
35 #include "core.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
36 #include "debug.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
37 #include "prpl.h" |
8704 | 38 #include "notify.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
39 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
40 /* XXX */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
41 #include "gtkconv.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
42 #include "gtkplugin.h" |
5859 | 43 #include "gaim.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
44 #include "ui.h" |
5859 | 45 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
46 #include <gaim-remote/remote.h> |
5859 | 47 |
5873
a18e88c4dace
[gaim-migrate @ 6305]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
48 #define REMOTE_PLUGIN_ID "gtk-remote" |
5859 | 49 |
50 struct UI { | |
51 GIOChannel *channel; | |
52 guint inpa; | |
53 }; | |
54 | |
55 #ifndef _WIN32 | |
56 static gint UI_fd = -1; | |
6107 | 57 static guint watcher = 0; |
5859 | 58 #endif |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
59 static int gaim_session = 0; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
60 static GSList *uis = NULL; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
61 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
62 /* AIM URI's ARE FUN :-D */ |
5884
d188b000e892
[gaim-migrate @ 6316]
Christian Hammond <chipx86@chipx86.com>
parents:
5873
diff
changeset
|
63 static const char * |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
64 gaim_remote_handle_uri(const char *uri) |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
65 { |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
66 const char *username; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
67 GString *str; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
68 GList *conn; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
69 GaimConnection *gc = NULL; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
70 GaimAccount *account; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
71 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
72 gaim_debug(GAIM_DEBUG_INFO, "gaim_remote_handle_uri", "Handling URI: %s\n", uri); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
73 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
74 /* Well, we'd better check to make sure we have at least one |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
75 AIM account connected. */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
76 for (conn = gaim_connections_get_all(); conn != NULL; conn = conn->next) { |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
77 gc = conn->data; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
78 account = gaim_connection_get_account(gc); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
79 username = gaim_account_get_username(account); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
80 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
81 if (gaim_account_get_protocol(account) == GAIM_PROTO_OSCAR && |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
82 username != NULL && isalpha(*username)) { |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
83 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
84 break; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
85 } |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
86 } |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
87 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
88 if (gc == NULL) |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
89 return _("Not connected to AIM"); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
90 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
91 /* aim:goim?screenname=screenname&message=message */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
92 if (!g_ascii_strncasecmp(uri, "aim:goim?", strlen("aim:goim?"))) { |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
93 char *who, *what; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
94 GaimConversation *c; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
95 uri = uri + strlen("aim:goim?"); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
96 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
97 if (!(who = strstr(uri, "screenname="))) { |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
98 return _("No screenname given."); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
99 } |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
100 /* spaces are encoded as +'s */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
101 who = who + strlen("screenname="); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
102 str = g_string_new(NULL); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
103 while (*who && (*who != '&')) { |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
104 g_string_append_c(str, *who == '+' ? ' ' : *who); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
105 who++; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
106 } |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
107 who = g_strdup(str->str); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
108 g_string_free(str, TRUE); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
109 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
110 what = strstr(uri, "message="); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
111 if (what) { |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
112 what = what + strlen("message="); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
113 str = g_string_new(NULL); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
114 while (*what && (*what != '&' || !g_ascii_strncasecmp(what, "&", 5))) { |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
115 g_string_append_c(str, *what == '+' ? ' ' : *what); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
116 what++; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
117 } |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
118 what = g_strdup(str->str); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
119 g_string_free(str, TRUE); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
120 } |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
121 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
122 c = gaim_conversation_new(GAIM_CONV_IM, gc->account, who); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
123 g_free(who); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
124 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
125 if (what) { |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
126 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(c); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
127 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
128 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, what, -1); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
129 g_free(what); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
130 } |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
131 } else if (!g_ascii_strncasecmp(uri, "aim:addbuddy?", strlen("aim:addbuddy?"))) { |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
132 char *who, *group; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
133 uri = uri + strlen("aim:addbuddy?"); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
134 /* spaces are encoded as +'s */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
135 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
136 if (!(who = strstr(uri, "screenname="))) { |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
137 return _("No screenname given."); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
138 } |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
139 who = who + strlen("screenname="); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
140 str = g_string_new(NULL); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
141 while (*who && (*who != '&')) { |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
142 g_string_append_c(str, *who == '+' ? ' ' : *who); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
143 who++; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
144 } |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
145 who = g_strdup(str->str); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
146 g_string_free(str, TRUE); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
147 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
148 group = strstr(uri, "group="); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
149 if (group) { |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
150 group = group + strlen("group="); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
151 str = g_string_new(NULL); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
152 while (*group && (*group != '&' || !g_ascii_strncasecmp(group, "&", 5))) { |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
153 g_string_append_c(str, *group == '+' ? ' ' : *group); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
154 group++; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
155 } |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
156 group = g_strdup(str->str); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
157 g_string_free(str, TRUE); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
158 } |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
159 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
160 gaim_debug(GAIM_DEBUG_MISC, "gaim_remote_handle_uri", "who: %s\n", who); |
7100
abdc55ffadba
[gaim-migrate @ 7665]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
161 gaim_blist_request_add_buddy(gc->account, who, group, NULL); |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
162 g_free(who); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
163 if (group) |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
164 g_free(group); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
165 } else if (!g_ascii_strncasecmp(uri, "aim:gochat?", strlen("aim:gochat?"))) { |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
166 char *room; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
167 GHashTable *components; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
168 int exch = 5; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
169 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
170 uri = uri + strlen("aim:gochat?"); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
171 /* spaces are encoded as +'s */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
172 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
173 if (!(room = strstr(uri, "roomname="))) { |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
174 return _("No roomname given."); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
175 } |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
176 room = room + strlen("roomname="); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
177 str = g_string_new(NULL); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
178 while (*room && (*room != '&')) { |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
179 g_string_append_c(str, *room == '+' ? ' ' : *room); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
180 room++; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
181 } |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
182 room = g_strdup(str->str); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
183 g_string_free(str, TRUE); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
184 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
185 g_free); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
186 g_hash_table_replace(components, g_strdup("room"), room); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
187 g_hash_table_replace(components, g_strdup("exchange"), |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
188 g_strdup_printf("%d", exch)); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
189 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
190 serv_join_chat(gc, components); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
191 g_hash_table_destroy(components); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
192 } else { |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
193 return _("Invalid AIM URI"); |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
194 } |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
195 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
196 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
197 return NULL; |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
198 } |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
199 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
200 |
5859 | 201 |
202 #if 0 | |
203 static guchar * | |
204 UI_build(guint32 *len, guchar type, guchar subtype, va_list args) | |
205 { | |
206 guchar *buffer; | |
207 guint32 pos; | |
208 int size; | |
209 void *data; | |
210 | |
211 *len = sizeof(guchar) * 2 + 4; | |
212 buffer = g_malloc(*len); | |
213 pos = 0; | |
214 | |
215 memcpy(buffer + pos, &type, sizeof(type)); pos += sizeof(type); | |
216 memcpy(buffer + pos, &subtype, sizeof(subtype)); pos += sizeof(subtype); | |
217 | |
218 /* we come back and do size last */ | |
219 pos += 4; | |
220 | |
221 size = va_arg(args, int); | |
222 while (size != -1) { | |
223 *len += size; | |
224 buffer = g_realloc(buffer, *len); | |
225 | |
226 data = va_arg(args, void *); | |
227 memcpy(buffer + pos, data, size); | |
228 pos += size; | |
229 | |
230 size = va_arg(args, int); | |
231 } | |
232 | |
233 pos -= sizeof(guchar) * 2 + 4; | |
234 | |
235 /* now we do size */ | |
236 memcpy(buffer + sizeof(guchar) * 2, &pos, 4); | |
237 | |
238 return buffer; | |
239 } | |
240 | |
241 static gint | |
242 UI_write(struct UI *ui, guchar *data, gint len) | |
243 { | |
244 GError *error = NULL; | |
245 gint sent; | |
246 /* we'll let the write silently fail because the read will pick it up as dead */ | |
247 g_io_channel_write_chars(ui->channel, data, len, &sent, &error); | |
248 if (error) | |
249 g_error_free(error); | |
250 return sent; | |
251 } | |
252 | |
253 static void | |
254 UI_build_write(struct UI *ui, guchar type, guchar subtype, ...) | |
255 { | |
256 va_list ap; | |
257 gchar *data; | |
258 guint32 len; | |
259 | |
260 va_start(ap, subtype); | |
261 data = UI_build(&len, type, subtype, ap); | |
262 va_end(ap); | |
263 | |
264 UI_write(ui, data, len); | |
265 | |
266 g_free(data); | |
267 } | |
268 | |
269 static void | |
270 UI_broadcast(guchar *data, gint len) | |
271 { | |
272 GSList *u = uis; | |
273 while (u) { | |
274 struct UI *ui = u->data; | |
275 UI_write(ui, data, len); | |
276 u = u->next; | |
277 } | |
278 } | |
279 | |
280 static void | |
281 UI_build_broadcast(guchar type, guchar subtype, ...) | |
282 { | |
283 va_list ap; | |
284 gchar *data; | |
285 guint32 len; | |
286 | |
287 if (!uis) | |
288 return; | |
289 | |
290 va_start(ap, subtype); | |
291 data = UI_build(&len, type, subtype, ap); | |
292 va_end(ap); | |
293 | |
294 UI_broadcast(data, len); | |
295 | |
296 g_free(data); | |
297 } | |
298 #endif | |
299 | |
300 #ifndef _WIN32 | |
301 static void | |
6063 | 302 meta_handler(struct UI *ui, guchar subtype, gchar *data) |
5859 | 303 { |
304 GaimRemotePacket *p; | |
305 GError *error = NULL; | |
306 switch (subtype) { | |
307 case CUI_META_LIST: | |
308 break; | |
309 case CUI_META_QUIT: | |
310 while (uis) { | |
311 ui = uis->data; | |
312 uis = g_slist_remove(uis, ui); | |
313 g_io_channel_shutdown(ui->channel, TRUE, &error); | |
314 g_source_remove(ui->inpa); | |
315 g_free(ui); | |
316 } | |
7646 | 317 g_timeout_add(0, gaim_core_quit_cb, NULL); |
5859 | 318 break; |
319 case CUI_META_DETACH: | |
320 uis = g_slist_remove(uis, ui); | |
321 g_io_channel_shutdown(ui->channel, TRUE, &error); | |
322 g_source_remove(ui->inpa); | |
323 g_free(ui); | |
324 break; | |
325 case CUI_META_PING: | |
326 p = gaim_remote_packet_new(CUI_TYPE_META, CUI_META_ACK); | |
327 gaim_remote_session_send_packet(g_io_channel_unix_get_fd(ui->channel), | |
328 p); | |
329 gaim_remote_packet_free(p); | |
330 break; | |
331 default: | |
332 gaim_debug(GAIM_DEBUG_WARNING, "cui", | |
333 "Unhandled meta subtype %d\n", subtype); | |
334 break; | |
335 } | |
336 | |
337 if(error) | |
338 g_error_free(error); | |
339 } | |
340 | |
341 static void | |
6063 | 342 plugin_handler(struct UI *ui, guchar subtype, gpointer data) |
5859 | 343 { |
344 #ifdef GAIM_PLUGINS | |
345 guint id; | |
346 GaimPlugin *p; | |
347 | |
348 switch (subtype) { | |
349 /* | |
350 case CUI_PLUGIN_LIST: | |
351 break; | |
352 */ | |
353 case CUI_PLUGIN_LOAD: | |
354 gaim_plugin_load(gaim_plugin_probe(data)); | |
355 break; | |
356 case CUI_PLUGIN_UNLOAD: | |
357 memcpy(&id, data, sizeof(id)); | |
358 p = g_list_nth_data(gaim_plugins_get_loaded(), id); | |
359 if (p) { | |
360 gaim_plugin_unload(p); | |
361 } | |
362 break; | |
363 default: | |
364 gaim_debug(GAIM_DEBUG_WARNING, "cui", | |
365 "Unhandled plugin subtype %d\n", subtype); | |
366 break; | |
367 } | |
368 #endif | |
369 } | |
370 | |
371 static void | |
6063 | 372 user_handler(struct UI *ui, guchar subtype, gchar *data) |
5859 | 373 { |
374 guint id; | |
375 GaimAccount *account; | |
376 | |
377 switch (subtype) { | |
378 /* | |
379 case CUI_USER_LIST: | |
380 break; | |
381 case CUI_USER_ADD: | |
382 break; | |
383 case CUI_USER_REMOVE: | |
384 break; | |
385 case CUI_USER_MODIFY: | |
386 break; | |
387 */ | |
388 case CUI_USER_SIGNON: | |
389 if (!data) | |
390 return; | |
391 memcpy(&id, data, sizeof(id)); | |
392 account = g_list_nth_data(gaim_accounts_get_all(), id); | |
393 if (account) | |
6036 | 394 gaim_account_connect(account); |
5859 | 395 /* don't need to do anything here because the UI will get updates from other handlers */ |
396 break; | |
397 default: | |
398 gaim_debug(GAIM_DEBUG_WARNING, "cui", | |
399 "Unhandled user subtype %d\n", subtype); | |
400 break; | |
401 } | |
402 } | |
403 | |
404 static void | |
6063 | 405 message_handler(struct UI *ui, guchar subtype, gchar *data) |
5859 | 406 { |
407 switch (subtype) { | |
408 case CUI_MESSAGE_LIST: | |
409 break; | |
410 case CUI_MESSAGE_SEND: | |
411 if (!data) | |
412 return; | |
413 { | |
414 guint id; | |
415 GaimConnection *gc; | |
416 guint len; | |
417 char *who, *msg; | |
418 gint flags; | |
419 int pos = 0; | |
420 | |
421 memcpy(&id, data + pos, sizeof(id)); | |
422 pos += sizeof(id); | |
423 gc = g_list_nth_data(gaim_connections_get_all(), id); | |
424 if (!gc) | |
425 return; | |
426 | |
427 memcpy(&len, data + pos, sizeof(len)); | |
428 pos += sizeof(len); | |
429 who = g_strndup(data + pos, len + 1); | |
430 pos += len; | |
431 | |
432 memcpy(&len, data + pos, sizeof(len)); | |
433 pos += sizeof(len); | |
434 msg = g_strndup(data + pos, len + 1); | |
435 pos += len; | |
436 | |
437 memcpy(&flags, data + pos, sizeof(flags)); | |
6982 | 438 serv_send_im(gc, who, msg, flags); |
5859 | 439 |
440 g_free(who); | |
441 g_free(msg); | |
442 } | |
443 break; | |
444 case CUI_MESSAGE_RECV: | |
445 break; | |
446 default: | |
447 gaim_debug(GAIM_DEBUG_WARNING, "cui", | |
448 "Unhandled message subtype %d\n", subtype); | |
449 break; | |
450 } | |
451 } | |
452 | |
453 static gint | |
6063 | 454 gaim_recv(GIOChannel *source, gchar *buf, gint len) |
5859 | 455 { |
456 gint total = 0; | |
6063 | 457 guint cur; |
5859 | 458 |
459 GError *error = NULL; | |
460 | |
461 while (total < len) { | |
7386 | 462 if (g_io_channel_read_chars(source, buf + total, len - total, (gsize *) &cur, &error) != G_IO_STATUS_NORMAL) { |
5859 | 463 if (error) |
464 g_error_free(error); | |
465 return -1; | |
466 } | |
467 if (cur == 0) | |
468 return total; | |
469 total += cur; | |
470 } | |
471 | |
472 return total; | |
473 } | |
474 | |
475 static void | |
6063 | 476 remote_handler(struct UI *ui, guchar subtype, gchar *data, int len) |
5859 | 477 { |
478 const char *resp; | |
479 char *send; | |
480 switch (subtype) { | |
481 case CUI_REMOTE_CONNECTIONS: | |
482 break; | |
483 case CUI_REMOTE_URI: | |
484 send = g_malloc(len + 1); | |
485 memcpy(send, data, len); | |
486 send[len] = 0; | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
487 resp = gaim_remote_handle_uri(send); |
5859 | 488 g_free(send); |
489 /* report error */ | |
490 break; | |
491 default: | |
492 gaim_debug(GAIM_DEBUG_WARNING, "cui", | |
493 "Unhandled remote subtype %d\n", subtype); | |
494 break; | |
495 } | |
496 } | |
497 | |
498 static gboolean | |
499 UI_readable(GIOChannel *source, GIOCondition cond, gpointer data) | |
500 { | |
501 struct UI *ui = data; | |
502 | |
6063 | 503 gchar type; |
504 gchar subtype; | |
7631 | 505 gint len; |
5859 | 506 |
507 GError *error = NULL; | |
508 | |
6063 | 509 gchar *in; |
5859 | 510 |
511 /* no byte order worries! this'll change if we go to TCP */ | |
512 if (gaim_recv(source, &type, sizeof(type)) != sizeof(type)) { | |
513 gaim_debug(GAIM_DEBUG_ERROR, "cui", "UI has abandoned us!\n"); | |
514 uis = g_slist_remove(uis, ui); | |
515 g_io_channel_shutdown(ui->channel, TRUE, &error); | |
516 if(error) { | |
517 g_error_free(error); | |
518 error = NULL; | |
519 } | |
520 g_source_remove(ui->inpa); | |
521 g_free(ui); | |
522 return FALSE; | |
523 } | |
524 | |
525 if (gaim_recv(source, &subtype, sizeof(subtype)) != sizeof(subtype)) { | |
526 gaim_debug(GAIM_DEBUG_ERROR, "cui", "UI has abandoned us!\n"); | |
527 uis = g_slist_remove(uis, ui); | |
528 g_io_channel_shutdown(ui->channel, TRUE, &error); | |
529 if(error) { | |
530 g_error_free(error); | |
531 error = NULL; | |
532 } | |
533 g_source_remove(ui->inpa); | |
534 g_free(ui); | |
535 return FALSE; | |
536 } | |
537 | |
6063 | 538 if (gaim_recv(source, (gchar *)&len, sizeof(len)) != sizeof(len)) { |
5859 | 539 gaim_debug(GAIM_DEBUG_ERROR, "cui", "UI has abandoned us!\n"); |
540 uis = g_slist_remove(uis, ui); | |
541 g_io_channel_shutdown(ui->channel, TRUE, &error); | |
542 if(error) { | |
543 g_error_free(error); | |
544 error = NULL; | |
545 } | |
546 g_source_remove(ui->inpa); | |
547 g_free(ui); | |
548 return FALSE; | |
549 } | |
550 | |
551 if (len) { | |
6063 | 552 in = g_new0(gchar, len); |
5859 | 553 if (gaim_recv(source, in, len) != len) { |
554 gaim_debug(GAIM_DEBUG_ERROR, "cui", "UI has abandoned us!\n"); | |
555 uis = g_slist_remove(uis, ui); | |
556 g_io_channel_shutdown(ui->channel, TRUE, &error); | |
557 if(error) { | |
558 g_error_free(error); | |
559 error = NULL; | |
560 } | |
561 g_source_remove(ui->inpa); | |
562 g_free(ui); | |
563 return FALSE; | |
564 } | |
565 } else | |
566 in = NULL; | |
567 | |
568 switch (type) { | |
569 case CUI_TYPE_META: | |
570 meta_handler(ui, subtype, in); | |
571 break; | |
572 case CUI_TYPE_PLUGIN: | |
573 plugin_handler(ui, subtype, in); | |
574 break; | |
575 case CUI_TYPE_USER: | |
576 user_handler(ui, subtype, in); | |
577 break; | |
578 /* | |
579 case CUI_TYPE_CONN: | |
580 conn_handler(ui, subtype, in); | |
581 break; | |
582 case CUI_TYPE_BUDDY: | |
583 buddy_handler(ui, subtype, in); | |
584 break; | |
585 */ | |
586 case CUI_TYPE_MESSAGE: | |
587 message_handler(ui, subtype, in); | |
588 break; | |
589 /* | |
590 case CUI_TYPE_CHAT: | |
591 chat_handler(ui, subtype, in); | |
592 break; | |
593 */ | |
594 case CUI_TYPE_REMOTE: | |
595 remote_handler(ui, subtype, in, len); | |
596 break; | |
597 default: | |
598 gaim_debug(GAIM_DEBUG_WARNING, "cui", | |
599 "Unhandled type %d\n", type); | |
600 break; | |
601 } | |
602 | |
603 if (in) | |
604 g_free(in); | |
605 return TRUE; | |
606 } | |
607 | |
608 static gboolean | |
609 socket_readable(GIOChannel *source, GIOCondition cond, gpointer data) | |
610 { | |
611 struct sockaddr_un saddr; | |
6063 | 612 guint len = sizeof(saddr); |
5859 | 613 gint fd; |
614 | |
615 struct UI *ui; | |
616 | |
617 if ((fd = accept(UI_fd, (struct sockaddr *)&saddr, &len)) == -1) | |
618 return FALSE; | |
619 | |
620 ui = g_new0(struct UI, 1); | |
621 uis = g_slist_append(uis, ui); | |
622 | |
623 ui->channel = g_io_channel_unix_new(fd); | |
624 ui->inpa = g_io_add_watch(ui->channel, G_IO_IN | G_IO_HUP | G_IO_ERR, UI_readable, ui); | |
625 g_io_channel_unref(ui->channel); | |
626 | |
627 gaim_debug(GAIM_DEBUG_MISC, "cui", "Got one\n"); | |
628 return TRUE; | |
629 } | |
630 | |
631 static gint | |
8704 | 632 open_socket(char **error) |
5859 | 633 { |
634 struct sockaddr_un saddr; | |
635 gint fd; | |
636 | |
637 while (gaim_remote_session_exists(gaim_session)) | |
638 gaim_session++; | |
639 | |
640 gaim_debug(GAIM_DEBUG_MISC, "cui", "Session: %d\n", gaim_session); | |
641 | |
642 if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) != -1) { | |
643 mode_t m = umask(0177); | |
644 saddr.sun_family = AF_UNIX; | |
645 | |
646 g_snprintf(saddr.sun_path, sizeof(saddr.sun_path), "%s" G_DIR_SEPARATOR_S "gaim_%s.%d", | |
647 g_get_tmp_dir(), g_get_user_name(), gaim_session); | |
648 if (bind(fd, (struct sockaddr *)&saddr, sizeof(saddr)) != -1) | |
649 listen(fd, 100); | |
650 else { | |
8704 | 651 *error = g_strdup_printf(_("Failed to assign %s to a socket:\n%s"), |
652 saddr.sun_path, strerror(errno)); | |
5859 | 653 g_log(NULL, G_LOG_LEVEL_CRITICAL, |
654 "Failed to assign %s to a socket (Error: %s)", | |
655 saddr.sun_path, strerror(errno)); | |
7617 | 656 umask(m); |
5859 | 657 return -1; |
658 } | |
659 umask(m); | |
660 } else | |
661 g_log(NULL, G_LOG_LEVEL_CRITICAL, "Unable to open socket: %s", strerror(errno)); | |
662 return fd; | |
663 } | |
664 #endif /*! _WIN32*/ | |
665 | |
6177
73f8f5c0e348
[gaim-migrate @ 6662]
Christian Hammond <chipx86@chipx86.com>
parents:
6107
diff
changeset
|
666 static gboolean |
73f8f5c0e348
[gaim-migrate @ 6662]
Christian Hammond <chipx86@chipx86.com>
parents:
6107
diff
changeset
|
667 plugin_load(GaimPlugin *plugin) |
5859 | 668 { |
669 #ifndef _WIN32 | |
670 GIOChannel *channel; | |
8704 | 671 char *buf; |
5859 | 672 |
8704 | 673 if ((UI_fd = open_socket(&buf)) < 0) { |
674 gaim_notify_error(NULL, NULL, _("Unable to open socket"), buf); | |
675 g_free(buf); | |
6177
73f8f5c0e348
[gaim-migrate @ 6662]
Christian Hammond <chipx86@chipx86.com>
parents:
6107
diff
changeset
|
676 return FALSE; |
8704 | 677 } |
5859 | 678 |
679 channel = g_io_channel_unix_new(UI_fd); | |
6107 | 680 watcher = g_io_add_watch(channel, G_IO_IN, socket_readable, NULL); |
5859 | 681 g_io_channel_unref(channel); |
6177
73f8f5c0e348
[gaim-migrate @ 6662]
Christian Hammond <chipx86@chipx86.com>
parents:
6107
diff
changeset
|
682 |
73f8f5c0e348
[gaim-migrate @ 6662]
Christian Hammond <chipx86@chipx86.com>
parents:
6107
diff
changeset
|
683 return TRUE; |
73f8f5c0e348
[gaim-migrate @ 6662]
Christian Hammond <chipx86@chipx86.com>
parents:
6107
diff
changeset
|
684 #else |
73f8f5c0e348
[gaim-migrate @ 6662]
Christian Hammond <chipx86@chipx86.com>
parents:
6107
diff
changeset
|
685 return FALSE; |
5859 | 686 #endif |
687 } | |
688 | |
6177
73f8f5c0e348
[gaim-migrate @ 6662]
Christian Hammond <chipx86@chipx86.com>
parents:
6107
diff
changeset
|
689 static gboolean |
73f8f5c0e348
[gaim-migrate @ 6662]
Christian Hammond <chipx86@chipx86.com>
parents:
6107
diff
changeset
|
690 plugin_unload(GaimPlugin *plugin) |
5859 | 691 { |
692 /* don't save prefs after plugins are gone... */ | |
693 #ifndef _WIN32 | |
694 char buf[1024]; | |
6177
73f8f5c0e348
[gaim-migrate @ 6662]
Christian Hammond <chipx86@chipx86.com>
parents:
6107
diff
changeset
|
695 |
6107 | 696 g_source_remove(watcher); |
5859 | 697 close(UI_fd); |
6177
73f8f5c0e348
[gaim-migrate @ 6662]
Christian Hammond <chipx86@chipx86.com>
parents:
6107
diff
changeset
|
698 |
6063 | 699 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "gaim_%s.%d", |
5859 | 700 g_get_tmp_dir(), g_get_user_name(), gaim_session); |
701 | |
702 unlink(buf); | |
703 | |
704 gaim_debug(GAIM_DEBUG_MISC, "core", "Removed core\n"); | |
5954 | 705 |
706 return TRUE; | |
6177
73f8f5c0e348
[gaim-migrate @ 6662]
Christian Hammond <chipx86@chipx86.com>
parents:
6107
diff
changeset
|
707 #else |
73f8f5c0e348
[gaim-migrate @ 6662]
Christian Hammond <chipx86@chipx86.com>
parents:
6107
diff
changeset
|
708 return FALSE; |
73f8f5c0e348
[gaim-migrate @ 6662]
Christian Hammond <chipx86@chipx86.com>
parents:
6107
diff
changeset
|
709 #endif |
5859 | 710 } |
711 | |
712 static GaimPluginInfo info = | |
713 { | |
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8704
diff
changeset
|
714 GAIM_PLUGIN_API_VERSION, /**< api_version */ |
5859 | 715 GAIM_PLUGIN_STANDARD, /**< type */ |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
716 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ |
5859 | 717 0, /**< flags */ |
718 NULL, /**< dependencies */ | |
719 GAIM_PRIORITY_DEFAULT, /**< priority */ | |
720 | |
721 REMOTE_PLUGIN_ID, /**< id */ | |
722 N_("Remote Control"), /**< name */ | |
723 VERSION, /**< version */ | |
724 /** summary */ | |
725 N_("Provides remote control for gaim applications."), | |
726 /** description */ | |
727 N_("Gives Gaim the ability to be remote-controlled through third-party " | |
728 "applications or through the gaim-remote tool."), | |
7782
795b71216887
[gaim-migrate @ 8427]
Christian Hammond <chipx86@chipx86.com>
parents:
7646
diff
changeset
|
729 "Sean Egan <sean.egan@binghamton.edu>", |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6179
diff
changeset
|
730 GAIM_WEBSITE, /**< homepage */ |
5859 | 731 |
732 plugin_load, /**< load */ | |
733 plugin_unload, /**< unload */ | |
734 NULL, /**< destroy */ | |
735 | |
736 NULL, /**< ui_info */ | |
8993 | 737 NULL, /**< extra_info */ |
738 NULL, | |
739 NULL | |
5859 | 740 }; |
741 | |
742 static void | |
743 __init_plugin(GaimPlugin *plugin) | |
744 { | |
745 } | |
746 | |
6177
73f8f5c0e348
[gaim-migrate @ 6662]
Christian Hammond <chipx86@chipx86.com>
parents:
6107
diff
changeset
|
747 /* This may be horribly wrong. Oh the mayhem! */ |
6063 | 748 GAIM_INIT_PLUGIN(remote, __init_plugin, info) |