1 | /********************************************************************\ |
---|
2 | * BitlBee -- An IRC to other IM-networks gateway * |
---|
3 | * * |
---|
4 | * Copyright 2002-2004 Wilmer van der Gaast and others * |
---|
5 | \********************************************************************/ |
---|
6 | |
---|
7 | /* |
---|
8 | * nogaim |
---|
9 | * |
---|
10 | * Gaim without gaim - for BitlBee |
---|
11 | * |
---|
12 | * This file contains functions called by the Gaim IM-modules. It's written |
---|
13 | * from scratch for BitlBee and doesn't contain any code from Gaim anymore |
---|
14 | * (except for the function names). |
---|
15 | * |
---|
16 | * Copyright 2002-2004 Wilmer van der Gaast <lintux@lintux.cx> |
---|
17 | */ |
---|
18 | |
---|
19 | /* |
---|
20 | This program is free software; you can redistribute it and/or modify |
---|
21 | it under the terms of the GNU General Public License as published by |
---|
22 | the Free Software Foundation; either version 2 of the License, or |
---|
23 | (at your option) any later version. |
---|
24 | |
---|
25 | This program is distributed in the hope that it will be useful, |
---|
26 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
27 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
28 | GNU General Public License for more details. |
---|
29 | |
---|
30 | You should have received a copy of the GNU General Public License with |
---|
31 | the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL; |
---|
32 | if not, write to the Free Software Foundation, Inc., 59 Temple Place, |
---|
33 | Suite 330, Boston, MA 02111-1307 USA |
---|
34 | */ |
---|
35 | |
---|
36 | #define BITLBEE_CORE |
---|
37 | #include "nogaim.h" |
---|
38 | #include <ctype.h> |
---|
39 | #include <iconv.h> |
---|
40 | |
---|
41 | static char *proto_away_alias[7][5] = |
---|
42 | { |
---|
43 | { "Away from computer", "Away", "Extended away", NULL }, |
---|
44 | { "NA", "N/A", "Not available", NULL }, |
---|
45 | { "Busy", "Do not disturb", "DND", "Occupied", NULL }, |
---|
46 | { "Be right back", "BRB", NULL }, |
---|
47 | { "On the phone", "Phone", "On phone", NULL }, |
---|
48 | { "Out to lunch", "Lunch", "Food", NULL }, |
---|
49 | { NULL } |
---|
50 | }; |
---|
51 | static char *proto_away_alias_find( GList *gcm, char *away ); |
---|
52 | |
---|
53 | static int remove_chat_buddy_silent( struct conversation *b, char *handle ); |
---|
54 | |
---|
55 | GSList *connections; |
---|
56 | |
---|
57 | gboolean load_plugin(char *path) |
---|
58 | { |
---|
59 | void (*init_function) (void); |
---|
60 | |
---|
61 | GModule *mod = g_module_open(path, G_MODULE_BIND_LAZY); |
---|
62 | |
---|
63 | if(!mod) { |
---|
64 | log_message(LOGLVL_ERROR, "Can't find `%s', not loading", path); |
---|
65 | return FALSE; |
---|
66 | } |
---|
67 | |
---|
68 | if(!g_module_symbol(mod,"init_plugin",(gpointer *) &init_function)) { |
---|
69 | log_message(LOGLVL_WARNING, "Can't find function `init_plugin' in `%s'\n", path); |
---|
70 | return FALSE; |
---|
71 | } |
---|
72 | |
---|
73 | init_function(); |
---|
74 | |
---|
75 | return TRUE; |
---|
76 | } |
---|
77 | |
---|
78 | /* nogaim.c */ |
---|
79 | |
---|
80 | GList *protocols = NULL; |
---|
81 | |
---|
82 | void register_protocol (struct prpl *p) |
---|
83 | { |
---|
84 | protocols = g_list_append(protocols, p); |
---|
85 | } |
---|
86 | |
---|
87 | |
---|
88 | struct prpl *find_protocol(const char *name) |
---|
89 | { |
---|
90 | GList *gl; |
---|
91 | for (gl = protocols; gl; gl = gl->next) |
---|
92 | { |
---|
93 | struct prpl *proto = gl->data; |
---|
94 | if(!g_strcasecmp(proto->name, name)) |
---|
95 | return proto; |
---|
96 | } |
---|
97 | return NULL; |
---|
98 | } |
---|
99 | |
---|
100 | /* nogaim.c */ |
---|
101 | void nogaim_init() |
---|
102 | { |
---|
103 | GDir *dir; |
---|
104 | GError *error = NULL; |
---|
105 | |
---|
106 | #ifdef WITH_MSN |
---|
107 | extern void msn_init(); |
---|
108 | msn_init(); |
---|
109 | #endif |
---|
110 | |
---|
111 | #ifdef WITH_OSCAR |
---|
112 | extern void oscar_init(); |
---|
113 | oscar_init(); |
---|
114 | #endif |
---|
115 | |
---|
116 | #ifdef WITH_YAHOO |
---|
117 | extern void byahoo_init(); |
---|
118 | byahoo_init(); |
---|
119 | #endif |
---|
120 | |
---|
121 | #ifdef WITH_JABBER |
---|
122 | extern void jabber_init(); |
---|
123 | jabber_init(); |
---|
124 | #endif |
---|
125 | |
---|
126 | dir = g_dir_open(PLUGINDIR, 0, &error); |
---|
127 | |
---|
128 | if (dir) { |
---|
129 | const gchar *entry; |
---|
130 | char *path; |
---|
131 | |
---|
132 | while ((entry = g_dir_read_name(dir))) { |
---|
133 | path = g_build_filename(PLUGINDIR, entry, NULL); |
---|
134 | if(!path) { |
---|
135 | log_message(LOGLVL_WARNING, "Can't build path for %s\n", entry); |
---|
136 | continue; |
---|
137 | } |
---|
138 | |
---|
139 | load_plugin(path); |
---|
140 | |
---|
141 | g_free(path); |
---|
142 | } |
---|
143 | |
---|
144 | g_dir_close(dir); |
---|
145 | } |
---|
146 | } |
---|
147 | |
---|
148 | GSList *get_connections() { return connections; } |
---|
149 | |
---|
150 | int proto_away( struct gaim_connection *gc, char *away ) |
---|
151 | { |
---|
152 | GList *m, *ms; |
---|
153 | char *s; |
---|
154 | |
---|
155 | if( !away ) away = ""; |
---|
156 | ms = m = gc->prpl->away_states( gc ); |
---|
157 | |
---|
158 | while( m ) |
---|
159 | { |
---|
160 | if( *away ) |
---|
161 | { |
---|
162 | if( g_strncasecmp( m->data, away, strlen( m->data ) ) == 0 ) |
---|
163 | break; |
---|
164 | } |
---|
165 | else |
---|
166 | { |
---|
167 | if( g_strcasecmp( m->data, "Available" ) == 0 ) |
---|
168 | break; |
---|
169 | if( g_strcasecmp( m->data, "Online" ) == 0 ) |
---|
170 | break; |
---|
171 | } |
---|
172 | m = m->next; |
---|
173 | } |
---|
174 | |
---|
175 | if( m ) |
---|
176 | { |
---|
177 | gc->prpl->set_away( gc, m->data, *away ? away : NULL ); |
---|
178 | } |
---|
179 | else |
---|
180 | { |
---|
181 | s = proto_away_alias_find( ms, away ); |
---|
182 | if( s ) |
---|
183 | { |
---|
184 | gc->prpl->set_away( gc, s, away ); |
---|
185 | if( set_getint( gc->irc, "debug" ) ) |
---|
186 | serv_got_crap( gc, "Setting away state to %s", s ); |
---|
187 | } |
---|
188 | else |
---|
189 | gc->prpl->set_away( gc, GAIM_AWAY_CUSTOM, away ); |
---|
190 | } |
---|
191 | |
---|
192 | g_list_free( ms ); |
---|
193 | |
---|
194 | return( 1 ); |
---|
195 | } |
---|
196 | |
---|
197 | static char *proto_away_alias_find( GList *gcm, char *away ) |
---|
198 | { |
---|
199 | GList *m; |
---|
200 | int i, j; |
---|
201 | |
---|
202 | for( i = 0; *proto_away_alias[i]; i ++ ) |
---|
203 | { |
---|
204 | for( j = 0; proto_away_alias[i][j]; j ++ ) |
---|
205 | if( g_strncasecmp( away, proto_away_alias[i][j], strlen( proto_away_alias[i][j] ) ) == 0 ) |
---|
206 | break; |
---|
207 | |
---|
208 | if( !proto_away_alias[i][j] ) /* If we reach the end, this row */ |
---|
209 | continue; /* is not what we want. Next! */ |
---|
210 | |
---|
211 | /* Now find an entry in this row which exists in gcm */ |
---|
212 | for( j = 0; proto_away_alias[i][j]; j ++ ) |
---|
213 | { |
---|
214 | m = gcm; |
---|
215 | while( m ) |
---|
216 | { |
---|
217 | if( g_strcasecmp( proto_away_alias[i][j], m->data ) == 0 ) |
---|
218 | return( proto_away_alias[i][j] ); |
---|
219 | m = m->next; |
---|
220 | } |
---|
221 | } |
---|
222 | } |
---|
223 | |
---|
224 | return( NULL ); |
---|
225 | } |
---|
226 | |
---|
227 | /* multi.c */ |
---|
228 | |
---|
229 | struct gaim_connection *new_gaim_conn( struct aim_user *user ) |
---|
230 | { |
---|
231 | struct gaim_connection *gc; |
---|
232 | account_t *a; |
---|
233 | |
---|
234 | gc = g_new0( struct gaim_connection, 1 ); |
---|
235 | |
---|
236 | gc->prpl = user->prpl; |
---|
237 | g_snprintf( gc->username, sizeof( gc->username ), "%s", user->username ); |
---|
238 | g_snprintf( gc->password, sizeof( gc->password ), "%s", user->password ); |
---|
239 | /* [MD] BUGFIX: don't set gc->irc to the global IRC, but use the one from the struct aim_user. |
---|
240 | * This fixes daemon mode breakage where IRC doesn't point to the currently active connection. |
---|
241 | */ |
---|
242 | gc->irc=user->irc; |
---|
243 | |
---|
244 | connections = g_slist_append( connections, gc ); |
---|
245 | |
---|
246 | user->gc = gc; |
---|
247 | gc->user = user; |
---|
248 | |
---|
249 | // Find the account_t so we can set its gc pointer |
---|
250 | for( a = gc->irc->accounts; a; a = a->next ) |
---|
251 | if( ( struct aim_user * ) a->gc == user ) |
---|
252 | { |
---|
253 | a->gc = gc; |
---|
254 | break; |
---|
255 | } |
---|
256 | |
---|
257 | return( gc ); |
---|
258 | } |
---|
259 | |
---|
260 | void destroy_gaim_conn( struct gaim_connection *gc ) |
---|
261 | { |
---|
262 | account_t *a; |
---|
263 | |
---|
264 | /* Destroy the pointer to this connection from the account list */ |
---|
265 | for( a = gc->irc->accounts; a; a = a->next ) |
---|
266 | if( a->gc == gc ) |
---|
267 | { |
---|
268 | a->gc = NULL; |
---|
269 | break; |
---|
270 | } |
---|
271 | |
---|
272 | connections = g_slist_remove( connections, gc ); |
---|
273 | g_free( gc->user ); |
---|
274 | g_free( gc ); |
---|
275 | } |
---|
276 | |
---|
277 | void set_login_progress( struct gaim_connection *gc, int step, char *msg ) |
---|
278 | { |
---|
279 | serv_got_crap( gc, "Logging in: %s", msg ); |
---|
280 | } |
---|
281 | |
---|
282 | /* Errors *while* logging in */ |
---|
283 | void hide_login_progress( struct gaim_connection *gc, char *msg ) |
---|
284 | { |
---|
285 | serv_got_crap( gc, "Login error: %s", msg ); |
---|
286 | } |
---|
287 | |
---|
288 | /* Errors *after* logging in */ |
---|
289 | void hide_login_progress_error( struct gaim_connection *gc, char *msg ) |
---|
290 | { |
---|
291 | serv_got_crap( gc, "Logged out: %s", msg ); |
---|
292 | } |
---|
293 | |
---|
294 | void serv_got_crap( struct gaim_connection *gc, char *format, ... ) |
---|
295 | { |
---|
296 | va_list params; |
---|
297 | char text[1024], buf[1024]; |
---|
298 | char *msg; |
---|
299 | |
---|
300 | va_start( params, format ); |
---|
301 | g_vsnprintf( text, sizeof( text ), format, params ); |
---|
302 | va_end( params ); |
---|
303 | |
---|
304 | if( g_strncasecmp( set_getstr( gc->irc, "charset" ), "none", 4 ) != 0 && |
---|
305 | do_iconv( "UTF8", set_getstr( gc->irc, "charset" ), text, buf, 0, 1024 ) != -1 ) |
---|
306 | msg = buf; |
---|
307 | else |
---|
308 | msg = text; |
---|
309 | |
---|
310 | if( ( g_strcasecmp( set_getstr( gc->irc, "strip_html" ), "always" ) == 0 ) || |
---|
311 | ( ( gc->flags & OPT_CONN_HTML ) && set_getint( gc->irc, "strip_html" ) ) ) |
---|
312 | strip_html( msg ); |
---|
313 | |
---|
314 | irc_usermsg( gc->irc, "%s(%s) - %s", gc->prpl->name, gc->username, msg ); |
---|
315 | } |
---|
316 | |
---|
317 | static gboolean send_keepalive( gpointer d ) |
---|
318 | { |
---|
319 | struct gaim_connection *gc = d; |
---|
320 | |
---|
321 | if( gc->prpl && gc->prpl->keepalive ) |
---|
322 | gc->prpl->keepalive( gc ); |
---|
323 | |
---|
324 | return TRUE; |
---|
325 | } |
---|
326 | |
---|
327 | void account_online( struct gaim_connection *gc ) |
---|
328 | { |
---|
329 | user_t *u; |
---|
330 | |
---|
331 | /* MSN servers sometimes redirect you to a different server and do |
---|
332 | the whole login sequence again, so subsequent calls to this |
---|
333 | function should be handled correctly. (IOW, ignored) */ |
---|
334 | if( gc->flags & OPT_LOGGED_IN ) |
---|
335 | return; |
---|
336 | |
---|
337 | u = user_find( gc->irc, gc->irc->nick ); |
---|
338 | |
---|
339 | serv_got_crap( gc, "Logged in" ); |
---|
340 | |
---|
341 | gc->keepalive = g_timeout_add( 60000, send_keepalive, gc ); |
---|
342 | gc->flags |= OPT_LOGGED_IN; |
---|
343 | |
---|
344 | if( u && u->away ) proto_away( gc, u->away ); |
---|
345 | |
---|
346 | if( !strcmp(gc->prpl->name, "icq") ) |
---|
347 | { |
---|
348 | for( u = gc->irc->users; u; u = u->next ) |
---|
349 | if( u->gc == gc ) |
---|
350 | break; |
---|
351 | |
---|
352 | if( u == NULL ) |
---|
353 | serv_got_crap( gc, "\x02""***\x02"" BitlBee now supports ICQ server-side contact lists. " |
---|
354 | "See \x02""help import_buddies\x02"" for more information." ); |
---|
355 | } |
---|
356 | } |
---|
357 | |
---|
358 | gboolean auto_reconnect( gpointer data ) |
---|
359 | { |
---|
360 | account_t *a = data; |
---|
361 | |
---|
362 | a->reconnect = 0; |
---|
363 | account_on( a->irc, a ); |
---|
364 | |
---|
365 | return( FALSE ); /* Only have to run the timeout once */ |
---|
366 | } |
---|
367 | |
---|
368 | void cancel_auto_reconnect( account_t *a ) |
---|
369 | { |
---|
370 | while( g_source_remove_by_user_data( (gpointer) a ) ); |
---|
371 | a->reconnect = 0; |
---|
372 | } |
---|
373 | |
---|
374 | void account_offline( struct gaim_connection *gc ) |
---|
375 | { |
---|
376 | gc->wants_to_die = TRUE; |
---|
377 | signoff( gc ); |
---|
378 | } |
---|
379 | |
---|
380 | void signoff( struct gaim_connection *gc ) |
---|
381 | { |
---|
382 | irc_t *irc = gc->irc; |
---|
383 | user_t *t, *u = irc->users; |
---|
384 | account_t *a; |
---|
385 | |
---|
386 | serv_got_crap( gc, "Signing off.." ); |
---|
387 | |
---|
388 | gaim_input_remove( gc->keepalive ); |
---|
389 | gc->keepalive = 0; |
---|
390 | gc->prpl->close( gc ); |
---|
391 | gaim_input_remove( gc->inpa ); |
---|
392 | |
---|
393 | while( u ) |
---|
394 | { |
---|
395 | if( u->gc == gc ) |
---|
396 | { |
---|
397 | t = u->next; |
---|
398 | user_del( irc, u->nick ); |
---|
399 | u = t; |
---|
400 | } |
---|
401 | else |
---|
402 | u = u->next; |
---|
403 | } |
---|
404 | |
---|
405 | query_del_by_gc( gc->irc, gc ); |
---|
406 | |
---|
407 | for( a = irc->accounts; a; a = a->next ) |
---|
408 | if( a->gc == gc ) |
---|
409 | break; |
---|
410 | |
---|
411 | if( !a ) |
---|
412 | { |
---|
413 | /* Uhm... This is very sick. */ |
---|
414 | } |
---|
415 | else if( !gc->wants_to_die && set_getint( irc, "auto_reconnect" ) ) |
---|
416 | { |
---|
417 | int delay = set_getint( irc, "auto_reconnect_delay" ); |
---|
418 | serv_got_crap( gc, "Reconnecting in %d seconds..", delay ); |
---|
419 | |
---|
420 | a->reconnect = 1; |
---|
421 | g_timeout_add( delay * 1000, auto_reconnect, a ); |
---|
422 | } |
---|
423 | |
---|
424 | destroy_gaim_conn( gc ); |
---|
425 | } |
---|
426 | |
---|
427 | |
---|
428 | /* dialogs.c */ |
---|
429 | |
---|
430 | void do_error_dialog( struct gaim_connection *gc, char *msg, char *title ) |
---|
431 | { |
---|
432 | serv_got_crap( gc, "Error: %s", msg ); |
---|
433 | } |
---|
434 | |
---|
435 | void do_ask_dialog( struct gaim_connection *gc, char *msg, void *data, void *doit, void *dont ) |
---|
436 | { |
---|
437 | query_add( gc->irc, gc, msg, doit, dont, data ); |
---|
438 | } |
---|
439 | |
---|
440 | |
---|
441 | /* list.c */ |
---|
442 | |
---|
443 | int bud_list_cache_exists( struct gaim_connection *gc ) |
---|
444 | { |
---|
445 | return( 0 ); |
---|
446 | } |
---|
447 | |
---|
448 | void do_import( struct gaim_connection *gc, void *null ) |
---|
449 | { |
---|
450 | return; |
---|
451 | } |
---|
452 | |
---|
453 | void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *realname ) |
---|
454 | { |
---|
455 | user_t *u; |
---|
456 | char nick[MAX_NICK_LENGTH+1]; |
---|
457 | char *s; |
---|
458 | irc_t *irc = gc->irc; |
---|
459 | |
---|
460 | if( set_getint( irc, "debug" ) && 0 ) /* This message is too useless */ |
---|
461 | serv_got_crap( gc, "Receiving user add from handle: %s", handle ); |
---|
462 | |
---|
463 | if( user_findhandle( gc, handle ) ) |
---|
464 | { |
---|
465 | if( set_getint( irc, "debug" ) ) |
---|
466 | serv_got_crap( gc, "User already exists, ignoring add request: %s", handle ); |
---|
467 | |
---|
468 | return; |
---|
469 | |
---|
470 | /* Buddy seems to exist already. Let's ignore this request then... */ |
---|
471 | } |
---|
472 | |
---|
473 | memset( nick, 0, MAX_NICK_LENGTH + 1 ); |
---|
474 | strcpy( nick, nick_get( gc->irc, handle, gc->prpl, realname ) ); |
---|
475 | |
---|
476 | u = user_add( gc->irc, nick ); |
---|
477 | |
---|
478 | if( !realname || !*realname ) realname = nick; |
---|
479 | u->realname = g_strdup( realname ); |
---|
480 | |
---|
481 | if( ( s = strchr( handle, '@' ) ) ) |
---|
482 | { |
---|
483 | u->host = g_strdup( s + 1 ); |
---|
484 | u->user = g_strndup( handle, s - handle ); |
---|
485 | } |
---|
486 | else if( gc->user->proto_opt[0] && *gc->user->proto_opt[0] ) |
---|
487 | { |
---|
488 | u->host = g_strdup( gc->user->proto_opt[0] ); |
---|
489 | u->user = g_strdup( handle ); |
---|
490 | |
---|
491 | /* s/ /_/ ... important for AOL screennames */ |
---|
492 | for( s = u->user; *s; s ++ ) |
---|
493 | if( *s == ' ' ) |
---|
494 | *s = '_'; |
---|
495 | } |
---|
496 | else |
---|
497 | { |
---|
498 | u->host = g_strdup( gc->user->prpl->name ); |
---|
499 | u->user = g_strdup( handle ); |
---|
500 | } |
---|
501 | |
---|
502 | u->gc = gc; |
---|
503 | u->handle = g_strdup( handle ); |
---|
504 | u->send_handler = buddy_send_handler; |
---|
505 | u->last_typing_notice = 0; |
---|
506 | } |
---|
507 | |
---|
508 | struct buddy *find_buddy( struct gaim_connection *gc, char *handle ) |
---|
509 | { |
---|
510 | static struct buddy b[1]; |
---|
511 | user_t *u; |
---|
512 | |
---|
513 | u = user_findhandle( gc, handle ); |
---|
514 | |
---|
515 | if( !u ) |
---|
516 | return( NULL ); |
---|
517 | |
---|
518 | memset( b, 0, sizeof( b ) ); |
---|
519 | strncpy( b->name, handle, 80 ); |
---|
520 | strncpy( b->show, u->realname, BUDDY_ALIAS_MAXLEN ); |
---|
521 | b->present = u->online; |
---|
522 | b->gc = u->gc; |
---|
523 | |
---|
524 | return( b ); |
---|
525 | } |
---|
526 | |
---|
527 | void do_export( struct gaim_connection *gc ) |
---|
528 | { |
---|
529 | return; |
---|
530 | } |
---|
531 | |
---|
532 | void signoff_blocked( struct gaim_connection *gc ) |
---|
533 | { |
---|
534 | return; /* Make all blocked users look invisible (TODO?) */ |
---|
535 | } |
---|
536 | |
---|
537 | |
---|
538 | void serv_buddy_rename( struct gaim_connection *gc, char *handle, char *realname ) |
---|
539 | { |
---|
540 | user_t *u = user_findhandle( gc, handle ); |
---|
541 | char *name, buf[1024]; |
---|
542 | |
---|
543 | if( !u ) return; |
---|
544 | |
---|
545 | /* Convert all UTF-8 */ |
---|
546 | if( g_strncasecmp( set_getstr( gc->irc, "charset" ), "none", 4 ) != 0 && |
---|
547 | do_iconv( "UTF-8", set_getstr( gc->irc, "charset" ), realname, buf, 0, sizeof( buf ) ) != -1 ) |
---|
548 | name = buf; |
---|
549 | else |
---|
550 | name = realname; |
---|
551 | |
---|
552 | if( g_strcasecmp( u->realname, name ) != 0 ) |
---|
553 | { |
---|
554 | if( u->realname != u->nick ) g_free( u->realname ); |
---|
555 | |
---|
556 | u->realname = g_strdup( name ); |
---|
557 | |
---|
558 | if( ( gc->flags & OPT_LOGGED_IN ) && set_getint( gc->irc, "display_namechanges" ) ) |
---|
559 | serv_got_crap( gc, "User `%s' changed name to `%s'", u->nick, u->realname ); |
---|
560 | } |
---|
561 | } |
---|
562 | |
---|
563 | |
---|
564 | /* prpl.c */ |
---|
565 | |
---|
566 | void show_got_added( struct gaim_connection *gc, char *id, char *handle, const char *realname, const char *msg ) |
---|
567 | { |
---|
568 | return; |
---|
569 | } |
---|
570 | |
---|
571 | |
---|
572 | /* server.c */ |
---|
573 | |
---|
574 | void serv_got_update( struct gaim_connection *gc, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps ) |
---|
575 | { |
---|
576 | user_t *u; |
---|
577 | int oa, oo; |
---|
578 | |
---|
579 | u = user_findhandle( gc, handle ); |
---|
580 | |
---|
581 | if( !u ) |
---|
582 | { |
---|
583 | if( g_strcasecmp( set_getstr( gc->irc, "handle_unknown" ), "add" ) == 0 ) |
---|
584 | { |
---|
585 | add_buddy( gc, NULL, handle, NULL ); |
---|
586 | u = user_findhandle( gc, handle ); |
---|
587 | } |
---|
588 | else |
---|
589 | { |
---|
590 | if( set_getint( gc->irc, "debug" ) || g_strcasecmp( set_getstr( gc->irc, "handle_unknown" ), "ignore" ) != 0 ) |
---|
591 | { |
---|
592 | serv_got_crap( gc, "serv_got_update() for handle %s:", handle ); |
---|
593 | serv_got_crap( gc, "loggedin = %d, type = %d", loggedin, type ); |
---|
594 | } |
---|
595 | |
---|
596 | return; |
---|
597 | } |
---|
598 | return; |
---|
599 | } |
---|
600 | |
---|
601 | oa = u->away != NULL; |
---|
602 | oo = u->online; |
---|
603 | |
---|
604 | if( u->away ) |
---|
605 | { |
---|
606 | g_free( u->away ); |
---|
607 | u->away = NULL; |
---|
608 | } |
---|
609 | |
---|
610 | if( loggedin && !u->online ) |
---|
611 | { |
---|
612 | irc_spawn( gc->irc, u ); |
---|
613 | u->online = 1; |
---|
614 | } |
---|
615 | else if( !loggedin && u->online ) |
---|
616 | { |
---|
617 | struct conversation *c; |
---|
618 | |
---|
619 | irc_kill( gc->irc, u ); |
---|
620 | u->online = 0; |
---|
621 | |
---|
622 | /* Remove him/her from the conversations to prevent PART messages after he/she QUIT already */ |
---|
623 | for( c = gc->conversations; c; c = c->next ) |
---|
624 | remove_chat_buddy_silent( c, handle ); |
---|
625 | } |
---|
626 | |
---|
627 | if( ( type & UC_UNAVAILABLE ) && ( !strcmp(gc->prpl->name, "oscar") || !strcmp(gc->prpl->name, "icq")) ) |
---|
628 | { |
---|
629 | u->away = g_strdup( "Away" ); |
---|
630 | } |
---|
631 | else if( ( type & UC_UNAVAILABLE ) && ( !strcmp(gc->prpl->name, "jabber") ) ) |
---|
632 | { |
---|
633 | if( type & UC_DND ) |
---|
634 | u->away = g_strdup( "Do Not Disturb" ); |
---|
635 | else if( type & UC_XA ) |
---|
636 | u->away = g_strdup( "Extended Away" ); |
---|
637 | else // if( type & UC_AWAY ) |
---|
638 | u->away = g_strdup( "Away" ); |
---|
639 | } |
---|
640 | else if( ( type & UC_UNAVAILABLE ) && gc->prpl->get_status_string ) |
---|
641 | { |
---|
642 | u->away = g_strdup( gc->prpl->get_status_string( gc, type ) ); |
---|
643 | } |
---|
644 | else |
---|
645 | u->away = NULL; |
---|
646 | |
---|
647 | /* LISPy... */ |
---|
648 | if( ( set_getint( gc->irc, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */ |
---|
649 | ( u->online ) && /* Don't touch offline people */ |
---|
650 | ( ( ( u->online != oo ) && !u->away ) || /* Voice joining people */ |
---|
651 | ( ( u->online == oo ) && ( oa == !u->away ) ) ) ) /* (De)voice people changing state */ |
---|
652 | { |
---|
653 | irc_write( gc->irc, ":%s!%s@%s MODE %s %cv %s", gc->irc->mynick, gc->irc->mynick, gc->irc->myhost, |
---|
654 | gc->irc->channel, u->away?'-':'+', u->nick ); |
---|
655 | } |
---|
656 | } |
---|
657 | |
---|
658 | void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 flags, time_t mtime, gint len ) |
---|
659 | { |
---|
660 | irc_t *irc = gc->irc; |
---|
661 | user_t *u; |
---|
662 | char buf[8192]; |
---|
663 | |
---|
664 | u = user_findhandle( gc, handle ); |
---|
665 | |
---|
666 | if( !u ) |
---|
667 | { |
---|
668 | char *h = set_getstr( irc, "handle_unknown" ); |
---|
669 | |
---|
670 | if( g_strcasecmp( h, "ignore" ) == 0 ) |
---|
671 | { |
---|
672 | if( set_getint( irc, "debug" ) ) |
---|
673 | serv_got_crap( gc, "Ignoring message from unknown handle %s", handle ); |
---|
674 | |
---|
675 | return; |
---|
676 | } |
---|
677 | else if( g_strncasecmp( h, "add", 3 ) == 0 ) |
---|
678 | { |
---|
679 | int private = set_getint( irc, "private" ); |
---|
680 | |
---|
681 | if( h[3] ) |
---|
682 | { |
---|
683 | if( g_strcasecmp( h + 3, "_private" ) == 0 ) |
---|
684 | private = 1; |
---|
685 | else if( g_strcasecmp( h + 3, "_channel" ) == 0 ) |
---|
686 | private = 0; |
---|
687 | } |
---|
688 | |
---|
689 | add_buddy( gc, NULL, handle, NULL ); |
---|
690 | u = user_findhandle( gc, handle ); |
---|
691 | u->is_private = private; |
---|
692 | } |
---|
693 | else |
---|
694 | { |
---|
695 | serv_got_crap( gc, "Message from unknown handle %s:", handle ); |
---|
696 | u = user_find( irc, irc->mynick ); |
---|
697 | } |
---|
698 | } |
---|
699 | |
---|
700 | if( ( g_strcasecmp( set_getstr( gc->irc, "strip_html" ), "always" ) == 0 ) || |
---|
701 | ( ( gc->flags & OPT_CONN_HTML ) && set_getint( gc->irc, "strip_html" ) ) ) |
---|
702 | strip_html( msg ); |
---|
703 | |
---|
704 | if( g_strncasecmp( set_getstr( irc, "charset" ), "none", 4 ) != 0 && |
---|
705 | do_iconv( "UTF-8", set_getstr( irc, "charset" ), msg, buf, 0, 8192 ) != -1 ) |
---|
706 | msg = buf; |
---|
707 | |
---|
708 | while( strlen( msg ) > 450 ) |
---|
709 | { |
---|
710 | char tmp, *nl; |
---|
711 | |
---|
712 | tmp = msg[450]; |
---|
713 | msg[450] = 0; |
---|
714 | |
---|
715 | /* If there's a newline in this string, split up there so we're not |
---|
716 | going to split up lines. If there isn't a newline, well, too bad. */ |
---|
717 | if( ( nl = strrchr( msg, '\n' ) ) ) |
---|
718 | *nl = 0; |
---|
719 | |
---|
720 | irc_msgfrom( irc, u->nick, msg ); |
---|
721 | |
---|
722 | msg[450] = tmp; |
---|
723 | |
---|
724 | /* Move on. */ |
---|
725 | if( nl ) |
---|
726 | { |
---|
727 | *nl = '\n'; |
---|
728 | msg = nl + 1; |
---|
729 | } |
---|
730 | else |
---|
731 | { |
---|
732 | msg += 450; |
---|
733 | } |
---|
734 | } |
---|
735 | irc_msgfrom( irc, u->nick, msg ); |
---|
736 | } |
---|
737 | |
---|
738 | void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout ) |
---|
739 | { |
---|
740 | user_t *u; |
---|
741 | |
---|
742 | if( !set_getint( gc->irc, "typing_notice" ) ) |
---|
743 | return; |
---|
744 | |
---|
745 | if( ( u = user_findhandle( gc, handle ) ) ) |
---|
746 | irc_noticefrom( gc->irc, u->nick, "* Typing a message *" ); |
---|
747 | } |
---|
748 | |
---|
749 | void serv_got_chat_left( struct gaim_connection *gc, int id ) |
---|
750 | { |
---|
751 | struct conversation *c, *l = NULL; |
---|
752 | GList *ir; |
---|
753 | |
---|
754 | if( set_getint( gc->irc, "debug" ) ) |
---|
755 | serv_got_crap( gc, "You were removed from conversation %d", (int) id ); |
---|
756 | |
---|
757 | for( c = gc->conversations; c && c->id != id; c = (l=c)->next ); |
---|
758 | |
---|
759 | if( c ) |
---|
760 | { |
---|
761 | if( c->joined ) |
---|
762 | { |
---|
763 | user_t *u, *r; |
---|
764 | |
---|
765 | r = user_find( gc->irc, gc->irc->mynick ); |
---|
766 | irc_privmsg( gc->irc, r, "PRIVMSG", c->channel, "", "Cleaning up channel, bye!" ); |
---|
767 | |
---|
768 | u = user_find( gc->irc, gc->irc->nick ); |
---|
769 | irc_kick( gc->irc, u, c->channel, r ); |
---|
770 | /* irc_part( gc->irc, u, c->channel ); */ |
---|
771 | } |
---|
772 | |
---|
773 | if( l ) |
---|
774 | l->next = c->next; |
---|
775 | else |
---|
776 | gc->conversations = c->next; |
---|
777 | |
---|
778 | for( ir = c->in_room; ir; ir = ir->next ) |
---|
779 | g_free( ir->data ); |
---|
780 | g_list_free( c->in_room ); |
---|
781 | g_free( c->channel ); |
---|
782 | g_free( c->title ); |
---|
783 | g_free( c ); |
---|
784 | } |
---|
785 | } |
---|
786 | |
---|
787 | void serv_got_chat_in( struct gaim_connection *gc, int id, char *who, int whisper, char *msg, time_t mtime ) |
---|
788 | { |
---|
789 | struct conversation *c; |
---|
790 | user_t *u; |
---|
791 | char buf[8192]; |
---|
792 | |
---|
793 | /* Gaim sends own messages through this too. IRC doesn't want this, so kill them */ |
---|
794 | if( g_strcasecmp( who, gc->user->username ) == 0 ) |
---|
795 | return; |
---|
796 | |
---|
797 | u = user_findhandle( gc, who ); |
---|
798 | for( c = gc->conversations; c && c->id != id; c = c->next ); |
---|
799 | |
---|
800 | if( ( g_strcasecmp( set_getstr( gc->irc, "strip_html" ), "always" ) == 0 ) || |
---|
801 | ( ( gc->flags & OPT_CONN_HTML ) && set_getint( gc->irc, "strip_html" ) ) ) |
---|
802 | strip_html( msg ); |
---|
803 | |
---|
804 | if( g_strncasecmp( set_getstr( gc->irc, "charset" ), "none", 4 ) != 0 && |
---|
805 | do_iconv( "UTF-8", set_getstr( gc->irc, "charset" ), msg, buf, 0, 8192 ) != -1 ) |
---|
806 | msg = buf; |
---|
807 | |
---|
808 | if( c && u ) |
---|
809 | irc_privmsg( gc->irc, u, "PRIVMSG", c->channel, "", msg ); |
---|
810 | else |
---|
811 | serv_got_crap( gc, "Message from/to conversation %s@%d (unknown conv/user): %s", who, id, msg ); |
---|
812 | } |
---|
813 | |
---|
814 | struct conversation *serv_got_joined_chat( struct gaim_connection *gc, int id, char *handle ) |
---|
815 | { |
---|
816 | struct conversation *c; |
---|
817 | char *s; |
---|
818 | |
---|
819 | /* This one just creates the conversation structure, user won't see anything yet */ |
---|
820 | |
---|
821 | if( gc->conversations ) |
---|
822 | { |
---|
823 | for( c = gc->conversations; c->next; c = c->next ); |
---|
824 | c = c->next = g_new0( struct conversation, 1 ); |
---|
825 | } |
---|
826 | else |
---|
827 | gc->conversations = c = g_new0( struct conversation, 1); |
---|
828 | |
---|
829 | c->id = id; |
---|
830 | c->gc = gc; |
---|
831 | c->title = g_strdup( handle ); |
---|
832 | |
---|
833 | s = g_new( char, 16 ); |
---|
834 | sprintf( s, "&chat_%03d", gc->irc->c_id++ ); |
---|
835 | c->channel = g_strdup( s ); |
---|
836 | g_free( s ); |
---|
837 | |
---|
838 | if( set_getint( gc->irc, "debug" ) ) |
---|
839 | serv_got_crap( gc, "Creating new conversation: (id=%d,handle=%s)", id, handle ); |
---|
840 | |
---|
841 | return( c ); |
---|
842 | } |
---|
843 | |
---|
844 | void serv_finish_login( struct gaim_connection *gc ) |
---|
845 | { |
---|
846 | return; |
---|
847 | } |
---|
848 | |
---|
849 | |
---|
850 | /* buddy_chat.c */ |
---|
851 | |
---|
852 | void add_chat_buddy( struct conversation *b, char *handle ) |
---|
853 | { |
---|
854 | user_t *u = user_findhandle( b->gc, handle ); |
---|
855 | int me = 0; |
---|
856 | |
---|
857 | if( set_getint( b->gc->irc, "debug" ) ) |
---|
858 | serv_got_crap( b->gc, "User %s added to conversation %d", handle, b->id ); |
---|
859 | |
---|
860 | /* It might be yourself! */ |
---|
861 | if( b->gc->prpl->cmp_buddynames( handle, b->gc->user->username ) == 0 ) |
---|
862 | { |
---|
863 | u = user_find( b->gc->irc, b->gc->irc->nick ); |
---|
864 | if( !b->joined ) |
---|
865 | irc_join( b->gc->irc, u, b->channel ); |
---|
866 | b->joined = me = 1; |
---|
867 | } |
---|
868 | |
---|
869 | /* Most protocols allow people to join, even when they're not in |
---|
870 | your contact list. Try to handle that here */ |
---|
871 | if( !u ) |
---|
872 | { |
---|
873 | add_buddy( b->gc, NULL, handle, NULL ); |
---|
874 | u = user_findhandle( b->gc, handle ); |
---|
875 | } |
---|
876 | |
---|
877 | /* Add the handle to the room userlist, if it's not 'me' */ |
---|
878 | if( !me ) |
---|
879 | { |
---|
880 | if( b->joined ) |
---|
881 | irc_join( b->gc->irc, u, b->channel ); |
---|
882 | b->in_room = g_list_append( b->in_room, g_strdup( handle ) ); |
---|
883 | } |
---|
884 | } |
---|
885 | |
---|
886 | void remove_chat_buddy( struct conversation *b, char *handle, char *reason ) |
---|
887 | { |
---|
888 | user_t *u; |
---|
889 | int me = 0; |
---|
890 | |
---|
891 | if( set_getint( b->gc->irc, "debug" ) ) |
---|
892 | serv_got_crap( b->gc, "User %s removed from conversation %d (%s)", handle, b->id, reason ? reason : "" ); |
---|
893 | |
---|
894 | /* It might be yourself! */ |
---|
895 | if( g_strcasecmp( handle, b->gc->user->username ) == 0 ) |
---|
896 | { |
---|
897 | u = user_find( b->gc->irc, b->gc->irc->nick ); |
---|
898 | b->joined = 0; |
---|
899 | me = 1; |
---|
900 | } |
---|
901 | else |
---|
902 | { |
---|
903 | u = user_findhandle( b->gc, handle ); |
---|
904 | } |
---|
905 | |
---|
906 | if( remove_chat_buddy_silent( b, handle ) ) |
---|
907 | if( ( b->joined || me ) && u ) |
---|
908 | irc_part( b->gc->irc, u, b->channel ); |
---|
909 | } |
---|
910 | |
---|
911 | static int remove_chat_buddy_silent( struct conversation *b, char *handle ) |
---|
912 | { |
---|
913 | GList *i; |
---|
914 | |
---|
915 | /* Find the handle in the room userlist and shoot it */ |
---|
916 | i = b->in_room; |
---|
917 | while( i ) |
---|
918 | { |
---|
919 | if( g_strcasecmp( handle, i->data ) == 0 ) |
---|
920 | { |
---|
921 | g_free( i->data ); |
---|
922 | b->in_room = g_list_remove( b->in_room, i->data ); |
---|
923 | return( 1 ); |
---|
924 | } |
---|
925 | |
---|
926 | i = i->next; |
---|
927 | } |
---|
928 | |
---|
929 | return( 0 ); |
---|
930 | } |
---|
931 | |
---|
932 | |
---|
933 | /* prefs.c */ |
---|
934 | |
---|
935 | /* Necessary? */ |
---|
936 | void build_block_list() |
---|
937 | { |
---|
938 | return; |
---|
939 | } |
---|
940 | |
---|
941 | void build_allow_list() |
---|
942 | { |
---|
943 | return; |
---|
944 | } |
---|
945 | |
---|
946 | |
---|
947 | /* Misc. BitlBee stuff which shouldn't really be here */ |
---|
948 | |
---|
949 | struct conversation *conv_findchannel( char *channel ) |
---|
950 | { |
---|
951 | struct gaim_connection *gc; |
---|
952 | struct conversation *c; |
---|
953 | GSList *l; |
---|
954 | |
---|
955 | /* This finds the connection which has a conversation which belongs to this channel */ |
---|
956 | for( l = connections; l; l = l->next ) |
---|
957 | { |
---|
958 | gc = l->data; |
---|
959 | for( c = gc->conversations; c && g_strcasecmp( c->channel, channel ) != 0; c = c->next ); |
---|
960 | if( c ) |
---|
961 | return( c ); |
---|
962 | } |
---|
963 | |
---|
964 | return( NULL ); |
---|
965 | } |
---|
966 | |
---|
967 | char *set_eval_away_devoice( irc_t *irc, set_t *set, char *value ) |
---|
968 | { |
---|
969 | int st; |
---|
970 | |
---|
971 | if( ( g_strcasecmp( value, "true" ) == 0 ) || ( g_strcasecmp( value, "yes" ) == 0 ) || ( g_strcasecmp( value, "on" ) == 0 ) ) |
---|
972 | st = 1; |
---|
973 | else if( ( g_strcasecmp( value, "false" ) == 0 ) || ( g_strcasecmp( value, "no" ) == 0 ) || ( g_strcasecmp( value, "off" ) == 0 ) ) |
---|
974 | st = 0; |
---|
975 | else if( sscanf( value, "%d", &st ) != 1 ) |
---|
976 | return( NULL ); |
---|
977 | |
---|
978 | st = st != 0; |
---|
979 | |
---|
980 | /* Horror.... */ |
---|
981 | |
---|
982 | if( st != set_getint( irc, "away_devoice" ) ) |
---|
983 | { |
---|
984 | char list[80] = ""; |
---|
985 | user_t *u = irc->users; |
---|
986 | int i = 0, count = 0; |
---|
987 | char pm; |
---|
988 | char v[80]; |
---|
989 | |
---|
990 | if( st ) |
---|
991 | pm = '+'; |
---|
992 | else |
---|
993 | pm = '-'; |
---|
994 | |
---|
995 | while( u ) |
---|
996 | { |
---|
997 | if( u->gc && u->online && !u->away ) |
---|
998 | { |
---|
999 | if( ( strlen( list ) + strlen( u->nick ) ) >= 79 ) |
---|
1000 | { |
---|
1001 | for( i = 0; i < count; v[i++] = 'v' ); v[i] = 0; |
---|
1002 | irc_write( irc, ":%s!%s@%s MODE %s %c%s%s", |
---|
1003 | irc->mynick, irc->mynick, irc->myhost, |
---|
1004 | irc->channel, pm, v, list ); |
---|
1005 | |
---|
1006 | *list = 0; |
---|
1007 | count = 0; |
---|
1008 | } |
---|
1009 | |
---|
1010 | sprintf( list + strlen( list ), " %s", u->nick ); |
---|
1011 | count ++; |
---|
1012 | } |
---|
1013 | u = u->next; |
---|
1014 | } |
---|
1015 | |
---|
1016 | /* $v = 'v' x $i */ |
---|
1017 | for( i = 0; i < count; v[i++] = 'v' ); v[i] = 0; |
---|
1018 | irc_write( irc, ":%s!%s@%s MODE %s %c%s%s", irc->mynick, irc->mynick, irc->myhost, |
---|
1019 | irc->channel, pm, v, list ); |
---|
1020 | } |
---|
1021 | |
---|
1022 | return( set_eval_bool( irc, set, value ) ); |
---|
1023 | } |
---|
1024 | |
---|
1025 | int serv_send_im( irc_t *irc, user_t *u, char *msg, int flags ) |
---|
1026 | { |
---|
1027 | char buf[8192]; |
---|
1028 | |
---|
1029 | if( g_strncasecmp( set_getstr( irc, "charset" ), "none", 4 ) != 0 && |
---|
1030 | do_iconv( set_getstr( irc, "charset" ), "UTF-8", msg, buf, 0, 8192 ) != -1 ) |
---|
1031 | msg = buf; |
---|
1032 | |
---|
1033 | if( ( u->gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) ) |
---|
1034 | { |
---|
1035 | char *html; |
---|
1036 | |
---|
1037 | html = escape_html( msg ); |
---|
1038 | strncpy( buf, html, 8192 ); |
---|
1039 | g_free( html ); |
---|
1040 | |
---|
1041 | msg = buf; |
---|
1042 | } |
---|
1043 | |
---|
1044 | return( ((struct gaim_connection *)u->gc)->prpl->send_im( u->gc, u->handle, msg, strlen( msg ), flags ) ); |
---|
1045 | } |
---|
1046 | |
---|
1047 | int serv_send_chat( irc_t *irc, struct gaim_connection *gc, int id, char *msg ) |
---|
1048 | { |
---|
1049 | char buf[8192]; |
---|
1050 | |
---|
1051 | if( g_strncasecmp( set_getstr( irc, "charset" ), "none", 4 ) != 0 && |
---|
1052 | do_iconv( set_getstr( irc, "charset" ), "UTF-8", msg, buf, 0, 8192 ) != -1 ) |
---|
1053 | msg = buf; |
---|
1054 | |
---|
1055 | if( gc->flags & OPT_CONN_HTML) { |
---|
1056 | char * html = escape_html(msg); |
---|
1057 | strncpy(buf, html, 8192); |
---|
1058 | g_free(html); |
---|
1059 | } |
---|
1060 | |
---|
1061 | return( gc->prpl->chat_send( gc, id, msg ) ); |
---|
1062 | } |
---|
1063 | |
---|
1064 | /* Convert from one charset to another. |
---|
1065 | |
---|
1066 | from_cs, to_cs: Source and destination charsets |
---|
1067 | src, dst: Source and destination strings |
---|
1068 | size: Size if src. 0 == use strlen(). strlen() is not reliable for UNICODE/UTF16 strings though. |
---|
1069 | maxbuf: Maximum number of bytes to write to dst |
---|
1070 | |
---|
1071 | Returns the number of bytes written to maxbuf or -1 on an error. |
---|
1072 | */ |
---|
1073 | signed int do_iconv( char *from_cs, char *to_cs, char *src, char *dst, size_t size, size_t maxbuf ) |
---|
1074 | { |
---|
1075 | iconv_t cd; |
---|
1076 | size_t res; |
---|
1077 | size_t inbytesleft, outbytesleft; |
---|
1078 | char *inbuf = src; |
---|
1079 | char *outbuf = dst; |
---|
1080 | |
---|
1081 | cd = iconv_open( to_cs, from_cs ); |
---|
1082 | if( cd == (iconv_t) -1 ) |
---|
1083 | return( -1 ); |
---|
1084 | |
---|
1085 | inbytesleft = size ? size : strlen( src ); |
---|
1086 | outbytesleft = maxbuf - 1; |
---|
1087 | res = iconv( cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft ); |
---|
1088 | *outbuf = '\0'; |
---|
1089 | iconv_close( cd ); |
---|
1090 | |
---|
1091 | if( res == (size_t) -1 ) |
---|
1092 | return( -1 ); |
---|
1093 | else |
---|
1094 | return( outbuf - dst ); |
---|
1095 | } |
---|
1096 | |
---|
1097 | char *set_eval_charset( irc_t *irc, set_t *set, char *value ) |
---|
1098 | { |
---|
1099 | iconv_t cd; |
---|
1100 | |
---|
1101 | if ( g_strncasecmp( value, "none", 4 ) == 0 ) |
---|
1102 | return( value ); |
---|
1103 | |
---|
1104 | cd = iconv_open( "UTF-8", value ); |
---|
1105 | if( cd == (iconv_t) -1 ) |
---|
1106 | return( NULL ); |
---|
1107 | |
---|
1108 | iconv_close( cd ); |
---|
1109 | return( value ); |
---|
1110 | } |
---|