Changes in / [2af3e23:8e9e2b7]
- Files:
-
- 2 added
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile
r2af3e23 r8e9e2b7 10 10 11 11 # Program variables 12 objects = bitlbee.o dcc.o help.o ipc.o irc.o irc_im.o irc_channel.o irc_commands.o irc_send.o irc_user.o irc_util.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS)12 objects = bitlbee.o dcc.o help.o ipc.o irc.o irc_im.o irc_channel.o irc_commands.o irc_send.o irc_user.o irc_util.o nick.o $(OTR_BI) query.o root_commands.o set.o storage.o $(STORAGE_OBJS) 13 13 headers = bitlbee.h commands.h conf.h config.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h lib/events.h lib/ftutil.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/account.h protocols/bee.h protocols/ft.h protocols/nogaim.h 14 14 subdirs = lib protocols … … 27 27 subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o) 28 28 29 all: $(OUTFILE) 29 all: $(OUTFILE) $(OTR_PI) 30 30 $(MAKE) -C doc 31 31 … … 33 33 @echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n' 34 34 35 install: install-bin install-doc 35 install: install-bin install-doc install-plugins 36 36 @if ! [ -d $(DESTDIR)$(CONFIG) ]; then echo -e '\nThe configuration directory $(DESTDIR)$(CONFIG) does not exist yet, don'\''t forget to create it!'; fi 37 37 @if ! [ -e $(DESTDIR)$(ETCDIR)/bitlbee.conf ]; then echo -e '\nNo files are installed in '$(DESTDIR)$(ETCDIR)' by make install. Run make install-etc to do that.'; fi 38 38 @echo 39 39 40 .PHONY: install install-bin install-etc install-doc \40 .PHONY: install install-bin install-etc install-doc install-plugins \ 41 41 uninstall uninstall-bin uninstall-etc uninstall-doc \ 42 42 all clean distclean tar $(subdirs) … … 104 104 -rmdir $(DESTDIR)$(ETCDIR) 105 105 106 install-plugins: 107 ifdef OTR_PI 108 mkdir -p $(DESTDIR)$(PLUGINDIR) 109 install -m 0755 otr.so $(DESTDIR)$(PLUGINDIR) 110 endif 111 106 112 tar: 107 113 fakeroot debian/rules clean || make distclean … … 112 118 $(subdirs): 113 119 @$(MAKE) -C $@ $(MAKECMDGOALS) 120 121 $(OTR_PI): %.so: $(SRCDIR)%.c 122 @echo '*' Building plugin $@ 123 @$(CC) $(CFLAGS) $(OTRFLAGS) -fPIC -shared $< -o $@ 114 124 115 125 $(objects): %.o: $(SRCDIR)%.c -
bitlbee.h
r2af3e23 r8e9e2b7 162 162 void root_command_string( irc_t *irc, char *command ); 163 163 void root_command( irc_t *irc, char *command[] ); 164 gboolean root_command_add( const char *command, int params, void (*func)(irc_t *, char **args), int flags ); 164 165 gboolean cmd_identify_finish( gpointer data, gint fd, b_input_condition cond ); 165 166 gboolean bitlbee_shutdown( gpointer data, gint fd, b_input_condition cond ); -
commands.h
r2af3e23 r8e9e2b7 37 37 } command_t; 38 38 39 extern co nst command_tcommands[];39 extern command_t root_commands[]; 40 40 41 41 #define IRC_CMD_PRE_LOGIN 1 -
configure
r2af3e23 r8e9e2b7 34 34 gcov=0 35 35 plugins=1 36 otr=auto 36 37 37 38 events=glib … … 77 78 --gcov=0/1 Disable/enable test coverage reporting $gcov 78 79 --plugins=0/1 Disable/enable plugins support $plugins 80 --otr=0/1 Disable/enable OTR encryption support $otr 79 81 80 82 --events=... Event handler (glib, libevent) $events … … 489 491 fi 490 492 493 otrprefix="" 494 for i in / /usr /usr/local; do 495 if [ -f ${i}/lib/libotr.a ]; then 496 otrprefix=${i} 497 break 498 fi 499 done 500 if [ "$otr" = "auto" ]; then 501 if [ -n "$otrprefix" ]; then 502 otr=1 503 else 504 otr=0 505 fi 506 fi 507 if [ "$otr" = 1 ]; then 508 # BI == built-in 509 echo '#define OTR_BI' >> config.h 510 echo "EFLAGS+=-L${otrprefix}/lib -lotr" >> Makefile.settings 511 echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings 512 echo 'OTR_BI=otr.o' >> Makefile.settings 513 elif [ "$otr" = "plugin" ]; then 514 echo '#define OTR_PI' >> config.h 515 echo "OTRFLAGS=-L${otrprefix}/lib -lotr" >> Makefile.settings 516 echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings 517 echo 'OTR_PI=otr.so' >> Makefile.settings 518 fi 519 491 520 if [ ! -e doc/user-guide/help.txt ] && ! type xmlto > /dev/null 2> /dev/null; then 492 521 echo … … 683 712 fi 684 713 714 if [ "$otr" = "1" ]; then 715 echo ' Off-the-Record (OTR) Messaging enabled.' 716 elif [ "$otr" = "plugin" ]; then 717 echo ' Off-the-Record (OTR) Messaging enabled (as a plugin).' 718 else 719 echo ' Off-the-Record (OTR) Messaging disabled.' 720 fi 721 685 722 echo ' Using event handler: '$events 686 723 echo ' Using SSL library: '$ssl -
doc/README
r2af3e23 r8e9e2b7 66 66 BitlBee's only real dependency is GLib. This is available on virtually every 67 67 platform. Any recent version of GLib (2.4 or higher) will work. 68 69 Off-the-Record encryption support will be included by default if the 70 configure script finds libotr in one of the usual places. You can pass 71 --otr=1 or --otr=0 to force it on or off, respectively. 68 72 69 73 These days, many IM protocols use SSL/TLS connections (for authentication … … 145 149 146 150 147 A NOTE ON ENCRYPTION148 ==================== 151 A NOTE ON PASSWORD ENCRYPTION 152 ============================= 149 153 150 154 There used to be a note here about the simple obfuscation method used to -
doc/user-guide/commands.xml
r2af3e23 r8e9e2b7 367 367 </description> 368 368 </bitlbee-command> 369 370 <bitlbee-command name="otr"> 371 <short-description>Off-the-Record encryption control</short-description> 372 <syntax>otr <subcommand> [<arguments>]</syntax> 373 374 <description> 375 376 <para> 377 Available subcommands: connect, disconnect, smp, smpq, trust, info, keygen, and forget. See <emphasis>help otr <subcommand></emphasis> for more information. 378 </para> 379 380 </description> 381 382 <bitlbee-command name="connect"> 383 <syntax>otr connect <nick></syntax> 384 385 <description> 386 387 <para> 388 Attempts to establish an encrypted connection with the specified user by sending a magic string. 389 </para> 390 391 </description> 392 393 </bitlbee-command> 394 395 <bitlbee-command name="disconnect"> 396 <syntax>otr disconnect <nick></syntax> 397 398 <description> 399 400 <para> 401 Resets the connection with the specified user to cleartext. 402 </para> 403 404 </description> 405 406 </bitlbee-command> 407 408 <bitlbee-command name="smp"> 409 <syntax>otr smp <nick> <secret></syntax> 410 411 <description> 412 413 <para> 414 Attempts to authenticate the given user's active fingerprint via the Socialist Millionaires' Protocol. 415 </para> 416 417 <para> 418 If an SMP challenge has already been received from the given user, responds with the specified secret. Otherwise, a challenge for the secret will be sent. If the protocol succeeds (i.e. both parties gave the same secret), the fingerprint will be trusted. 419 </para> 420 421 </description> 422 423 </bitlbee-command> 424 425 <bitlbee-command name="smpq"> 426 <syntax>otr smpq <nick> <question> <answer></syntax> 427 428 <description> 429 430 <para> 431 Attempts to authenticate the given user's active fingerprint via the Socialist Millionaires' Protocol, Q&A style. 432 </para> 433 434 <para> 435 When initiating SMP, this is an alternative to the 'otr smp' command. The shared secret is provided as the answer to a specific question. The question is transmitted with the initial SMP packet and used to prompt the other party. If the protocol succeeds (i.e. they give the correct answer), the fingerprint will be trusted. 436 </para> 437 438 </description> 439 440 </bitlbee-command> 441 442 <bitlbee-command name="trust"> 443 <syntax>otr trust <nick> <fp1> <fp2> <fp3> <fp4> <fp5></syntax> 444 445 <description> 446 447 <para> 448 Manually affirms trust in the specified fingerprint, given as five blocks of precisely eight (hexadecimal) digits each. 449 </para> 450 451 </description> 452 453 </bitlbee-command> 454 455 <bitlbee-command name="info"> 456 <syntax>otr info</syntax> 457 <syntax>otr info <nick></syntax> 458 459 <description> 460 461 <para> 462 Shows information about the OTR state. The first form lists our private keys and current OTR contexts. The second form displays information about the connection with a given user, including the list of their known fingerprints. 463 </para> 464 465 </description> 466 467 </bitlbee-command> 468 469 <bitlbee-command name="keygen"> 470 <syntax>otr keygen <account-no></syntax> 471 472 <description> 473 474 <para> 475 Generates a new OTR private key for the given account. 476 </para> 477 478 </description> 479 480 </bitlbee-command> 481 482 <bitlbee-command name="forget"> 483 <syntax>otr forget <thing> <arguments></syntax> 484 485 <description> 486 487 <para> 488 Forgets some part of our OTR userstate. Available things: fingerprint, context, and key. See <emphasis>help otr forget <thing></emphasis> for more information. 489 </para> 490 491 </description> 492 493 <bitlbee-command name="fingerprint"> 494 <syntax>otr forget fingerprint <nick> <fingerprint></syntax> 495 496 <description> 497 498 <para> 499 Drops the specified fingerprint from the given user's OTR connection context. It is allowed to specify only a (unique) prefix of the desired fingerprint. 500 </para> 501 502 </description> 503 504 </bitlbee-command> 505 506 <bitlbee-command name="context"> 507 <syntax>otr forget context <nick></syntax> 508 509 <description> 510 511 <para> 512 Forgets the entire OTR context associated with the given user. This includes current message and protocol states, as well as any fingerprints for that user. 513 </para> 514 515 </description> 516 517 </bitlbee-command> 518 519 <bitlbee-command name="key"> 520 <syntax>otr forget key <fingerprint></syntax> 521 522 <description> 523 524 <para> 525 Forgets an OTR private key matching the specified fingerprint. It is allowed to specify only a (unique) prefix of the fingerprint. 526 </para> 527 528 </description> 529 530 </bitlbee-command> 531 532 </bitlbee-command> 533 534 </bitlbee-command> 369 535 370 536 <bitlbee-command name="set"> … … 589 755 </description> 590 756 757 </bitlbee-setting> 758 759 <bitlbee-setting name="color_encrypted" type="boolean" scope="global"> 760 <default>true</default> 761 762 <description> 763 <para> 764 If set to true, BitlBee will color incoming encrypted messages according to their fingerprint trust level: untrusted=red, trusted=green. 765 </para> 766 </description> 591 767 </bitlbee-setting> 592 768 … … 931 1107 </bitlbee-setting> 932 1108 1109 <bitlbee-setting name="otr_policy" type="string" scope="global"> 1110 <default>opportunistic</default> 1111 <possible-values>never, opportunistic, manual, always</possible-values> 1112 1113 <description> 1114 <para> 1115 This setting controls the policy for establishing Off-the-Record connections. 1116 </para> 1117 <para> 1118 A value of "never" effectively disables the OTR subsystem. In "opportunistic" mode, a magic whitespace pattern will be appended to the first message sent to any user. If the peer is also running opportunistic OTR, an encrypted connection will be set up automatically. On "manual", on the other hand, OTR connections must be established explicitly using <emphasis>otr connect</emphasis>. Finally, the setting "always" enforces encrypted communication by causing BitlBee to refuse to send any cleartext messages at all. 1119 </para> 1120 </description> 1121 </bitlbee-setting> 1122 933 1123 <bitlbee-setting name="password" type="string" scope="both"> 934 1124 <description> -
irc.c
r2af3e23 r8e9e2b7 29 29 30 30 GSList *irc_connection_list; 31 GSList *irc_plugins; 31 32 32 33 static gboolean irc_userping( gpointer _irc, gint fd, b_input_condition cond ); … … 42 43 char *host = NULL, *myhost = NULL; 43 44 irc_user_t *iu; 45 GSList *l; 44 46 set_t *s; 45 47 bee_t *b; … … 165 167 nogaim_init(); 166 168 169 for( l = irc_plugins; l; l = l->next ) 170 { 171 irc_plugin_t *p = l->data; 172 if( p->irc_new ) 173 p->irc_new( irc ); 174 } 175 167 176 return irc; 168 177 } … … 208 217 void irc_free( irc_t * irc ) 209 218 { 219 GSList *l; 220 210 221 irc->status |= USTATUS_SHUTDOWN; 211 222 … … 215 226 if( storage_save( irc, NULL, TRUE ) != STORAGE_OK ) 216 227 log_message( LOGLVL_WARNING, "Error while saving settings for user %s", irc->user->nick ); 228 229 for( l = irc_plugins; l; l = l->next ) 230 { 231 irc_plugin_t *p = l->data; 232 if( p->irc_free ) 233 p->irc_free( irc ); 234 } 217 235 218 236 irc_connection_list = g_slist_remove( irc_connection_list, irc ); … … 933 951 return SET_INVALID; 934 952 } 953 954 void register_irc_plugin( const struct irc_plugin *p ) 955 { 956 irc_plugins = g_slist_prepend( irc_plugins, (gpointer) p ); 957 } -
irc.h
r2af3e23 r8e9e2b7 28 28 29 29 #define IRC_MAX_LINE 512 30 #define IRC_MAX_ARGS 830 #define IRC_MAX_ARGS 16 31 31 32 32 #define IRC_LOGIN_TIMEOUT 60 … … 86 86 gint login_source_id; /* To slightly delay some events at login time. */ 87 87 88 struct otr *otr; /* OTR state and book keeping, used by the OTR plugin. 89 TODO: Some mechanism for plugindata. */ 90 88 91 struct bee *b; 89 92 } irc_t; … … 93 96 /* Replaced with iu->last_channel IRC_USER_PRIVATE = 1, */ 94 97 IRC_USER_AWAY = 2, 98 99 IRC_USER_OTR_ENCRYPTED = 0x10000, 100 IRC_USER_OTR_TRUSTED = 0x20000, 95 101 } irc_user_flags_t; 96 102 … … 214 220 } irc_channel_del_user_type_t; 215 221 222 /* These are a glued a little bit to the core/bee layer and a little bit to 223 IRC. The first user is OTR, and I guess at some point we'll get to shape 224 this a little bit more as other uses come up. */ 225 typedef struct irc_plugin 226 { 227 /* Called at the end of irc_new(). Can be used to add settings, etc. */ 228 gboolean (*irc_new)( irc_t *irc ); 229 /* At the end of irc_free(). */ 230 void (*irc_free)( irc_t *irc ); 231 232 /* Problem with the following two functions is ordering if multiple 233 plugins are handling them. Let's keep fixing that problem for 234 whenever it becomes important. */ 235 236 /* Called by bee_irc_user_privmsg_cb(). Return NULL if you want to 237 abort sending the msg. */ 238 char* (*filter_msg_out)( irc_user_t *iu, char *msg, int flags ); 239 /* Called by bee_irc_user_msg(). Return NULL if you swallowed the 240 message and don't want anything to go to the user. */ 241 char* (*filter_msg_in)( irc_user_t *iu, char *msg, int flags ); 242 243 /* From storage.c functions. Ideally these should not be used 244 and instead data should be stored in settings which will get 245 saved automatically. Consider these deprecated! */ 246 void (*storage_load)( irc_t *irc ); 247 void (*storage_save)( irc_t *irc ); 248 void (*storage_remove)( const char *nick ); 249 } irc_plugin_t; 250 251 extern GSList *irc_plugins; /* struct irc_plugin */ 252 216 253 /* irc.c */ 217 254 extern GSList *irc_connection_list; … … 238 275 239 276 void irc_umode_set( irc_t *irc, const char *s, gboolean allow_priv ); 277 278 void register_irc_plugin( const struct irc_plugin *p ); 240 279 241 280 /* irc_channel.c */ -
irc_commands.c
r2af3e23 r8e9e2b7 635 635 irc_send_msg_raw( irc->root, "NOTICE", irc->user->nick, "COMPLETIONS OK" ); 636 636 637 for( i = 0; commands[i].command; i ++ )638 irc_send_msg_f( irc->root, "NOTICE", irc->user->nick, "COMPLETIONS %s", commands[i].command );637 for( i = 0; root_commands[i].command; i ++ ) 638 irc_send_msg_f( irc->root, "NOTICE", irc->user->nick, "COMPLETIONS %s", root_commands[i].command ); 639 639 640 640 for( h = global.help; h; h = h->next ) -
irc_im.c
r2af3e23 r8e9e2b7 192 192 } 193 193 194 static gboolean bee_irc_user_msg( bee_t *bee, bee_user_t *bu, const char *msg , time_t sent_at )194 static gboolean bee_irc_user_msg( bee_t *bee, bee_user_t *bu, const char *msg_, time_t sent_at ) 195 195 { 196 196 irc_t *irc = bee->ui_data; … … 199 199 char *wrapped, *ts = NULL; 200 200 irc_channel_t *ic = NULL; 201 char *msg = g_strdup( msg_ ); 202 GSList *l; 201 203 202 204 if( sent_at > 0 && set_getbool( &irc->b->set, "display_timestamps" ) ) … … 224 226 } 225 227 228 for( l = irc_plugins; l; l = l->next ) 229 { 230 irc_plugin_t *p = l->data; 231 if( p->filter_msg_in ) 232 { 233 char *s = p->filter_msg_in( iu, msg, 0 ); 234 if( s ) 235 { 236 if( s != msg ) 237 g_free( msg ); 238 msg = s; 239 } 240 else 241 { 242 /* Modules can swallow messages. */ 243 return TRUE; 244 } 245 } 246 } 247 248 if( ( g_strcasecmp( set_getstr( &bee->set, "strip_html" ), "always" ) == 0 ) || 249 ( ( bu->ic->flags & OPT_DOES_HTML ) && set_getbool( &bee->set, "strip_html" ) ) ) 250 { 251 char *s = g_strdup( msg ); 252 strip_html( s ); 253 g_free( msg ); 254 msg = s; 255 } 256 226 257 wrapped = word_wrap( msg, 425 ); 227 258 irc_send_msg( iu, "PRIVMSG", dst, wrapped, prefix ); … … 229 260 g_free( wrapped ); 230 261 g_free( prefix ); 262 g_free( msg ); 231 263 g_free( ts ); 232 264 … … 349 381 } 350 382 383 if( iu->pastebuf == NULL ) 384 iu->pastebuf = g_string_new( msg ); 385 else 386 { 387 b_event_remove( iu->pastebuf_timer ); 388 g_string_append_printf( iu->pastebuf, "\n%s", msg ); 389 } 390 351 391 if( set_getbool( &iu->irc->b->set, "paste_buffer" ) ) 352 392 { 353 393 int delay; 354 355 if( iu->pastebuf == NULL )356 iu->pastebuf = g_string_new( msg );357 else358 {359 b_event_remove( iu->pastebuf_timer );360 g_string_append_printf( iu->pastebuf, "\n%s", msg );361 }362 394 363 395 if( ( delay = set_getint( &iu->irc->b->set, "paste_buffer_delay" ) ) <= 5 ) … … 369 401 } 370 402 else 371 return bee_user_msg( iu->irc->b, iu->bu, msg, 0 ); 403 { 404 bee_irc_user_privmsg_cb( iu, 0, 0 ); 405 406 return TRUE; 407 } 372 408 } 373 409 … … 375 411 { 376 412 irc_user_t *iu = data; 377 378 bee_user_msg( iu->irc->b, iu->bu, iu->pastebuf->str, 0 ); 379 380 g_string_free( iu->pastebuf, TRUE ); 381 iu->pastebuf = 0; 413 char *msg = g_string_free( iu->pastebuf, FALSE ); 414 GSList *l; 415 416 for( l = irc_plugins; l; l = l->next ) 417 { 418 irc_plugin_t *p = l->data; 419 if( p->filter_msg_out ) 420 { 421 char *s = p->filter_msg_out( iu, msg, 0 ); 422 if( s ) 423 { 424 if( s != msg ) 425 g_free( msg ); 426 msg = s; 427 } 428 else 429 { 430 /* Modules can swallow messages. */ 431 iu->pastebuf = NULL; 432 g_free( msg ); 433 return FALSE; 434 } 435 } 436 } 437 438 bee_user_msg( iu->irc->b, iu->bu, msg, 0 ); 439 440 g_free( msg ); 441 iu->pastebuf = NULL; 382 442 iu->pastebuf_timer = 0; 383 443 -
lib/misc.c
r2af3e23 r8e9e2b7 157 157 char *s = out, *cs; 158 158 int i, matched; 159 int taglen; 159 160 160 161 memset( out, 0, sizeof( out ) ); … … 173 174 in ++; 174 175 176 taglen = in - cs - 1; /* not <0 because the above loop runs at least once */ 175 177 if( *in ) 176 178 { 177 if( g_strncasecmp( cs+1, "br", 2) == 0 ) 179 if( g_strncasecmp( cs+1, "b", taglen) == 0 ) 180 *(s++) = '\x02'; 181 else if( g_strncasecmp( cs+1, "/b", taglen) == 0 ) 182 *(s++) = '\x02'; 183 else if( g_strncasecmp( cs+1, "i", taglen) == 0 ) 184 *(s++) = '\x1f'; 185 else if( g_strncasecmp( cs+1, "/i", taglen) == 0 ) 186 *(s++) = '\x1f'; 187 else if( g_strncasecmp( cs+1, "br", taglen) == 0 ) 178 188 *(s++) = '\n'; 179 189 in ++; -
lib/ssl_bogus.c
r2af3e23 r8e9e2b7 27 27 28 28 int ssl_errno; 29 30 void ssl_init( void ) 31 { 32 } 29 33 30 34 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data ) … … 66 70 return 0; 67 71 } 72 73 int ssl_pending( void *conn ) 74 { 75 return 0; 76 } -
lib/ssl_client.h
r2af3e23 r8e9e2b7 47 47 48 48 49 /* Perform any global initialization the SSL library might need. */ 50 G_MODULE_EXPORT void ssl_init( void ); 51 49 52 /* Connect to host:port, call the given function when the connection is 50 53 ready to be used for SSL traffic. This is all done asynchronously, no -
lib/ssl_gnutls.c
r2af3e23 r8e9e2b7 60 60 static gboolean ssl_handshake( gpointer data, gint source, b_input_condition cond ); 61 61 62 63 void ssl_init( void ) 64 { 65 gnutls_global_init(); 66 initialized = TRUE; 67 atexit( gnutls_global_deinit ); 68 } 62 69 63 70 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data ) … … 122 129 if( !initialized ) 123 130 { 124 gnutls_global_init(); 125 initialized = TRUE; 126 atexit( gnutls_global_deinit ); 131 ssl_init(); 127 132 } 128 133 -
lib/ssl_nss.c
r2af3e23 r8e9e2b7 91 91 92 92 93 void ssl_init( void ) 94 { 95 PR_Init( PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1); 96 NSS_NoDB_Init(NULL); 97 NSS_SetDomesticPolicy(); 98 initialized = TRUE; 99 } 100 93 101 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data ) 94 102 { … … 107 115 if( !initialized ) 108 116 { 109 PR_Init( PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1); 110 NSS_NoDB_Init(NULL); 111 NSS_SetDomesticPolicy(); 117 ssl_init(); 112 118 } 113 119 -
lib/ssl_openssl.c
r2af3e23 r8e9e2b7 56 56 static gboolean ssl_handshake( gpointer data, gint source, b_input_condition cond ); 57 57 58 59 void ssl_init( void ) 60 { 61 initialized = TRUE; 62 SSL_library_init(); 63 // SSLeay_add_ssl_algorithms(); 64 } 58 65 59 66 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data ) … … 115 122 if( !initialized ) 116 123 { 117 initialized = TRUE; 118 SSL_library_init(); 119 //SSLeay_add_ssl_algorithms(); 120 //OpenSSL_add_all_algorithms(); 124 ssl_init(); 121 125 } 122 126 -
log.c
r2af3e23 r8e9e2b7 30 30 static log_t logoutput; 31 31 32 static void log_null(int level, c har *logmessage);33 static void log_irc(int level, c har *logmessage);34 static void log_syslog(int level, c har *logmessage);35 static void log_console(int level, c har *logmessage);32 static void log_null(int level, const char *logmessage); 33 static void log_irc(int level, const char *logmessage); 34 static void log_syslog(int level, const char *logmessage); 35 static void log_console(int level, const char *logmessage); 36 36 37 37 void log_init(void) { … … 97 97 } 98 98 99 void log_message(int level, c har *message, ... ) {99 void log_message(int level, const char *message, ... ) { 100 100 101 101 va_list ap; … … 122 122 } 123 123 124 void log_error(c har *functionname) {124 void log_error(const char *functionname) { 125 125 log_message(LOGLVL_ERROR, "%s: %s", functionname, strerror(errno)); 126 126 … … 128 128 } 129 129 130 static void log_null(int level, c har *message) {130 static void log_null(int level, const char *message) { 131 131 return; 132 132 } 133 133 134 static void log_irc(int level, c har *message) {134 static void log_irc(int level, const char *message) { 135 135 if(level == LOGLVL_ERROR) 136 136 irc_write_all(1, "ERROR :Error: %s", message); … … 147 147 } 148 148 149 static void log_syslog(int level, c har *message) {149 static void log_syslog(int level, const char *message) { 150 150 if(level == LOGLVL_ERROR) 151 151 syslog(LOG_ERR, "%s", message); … … 161 161 } 162 162 163 static void log_console(int level, c har *message) {163 static void log_console(int level, const char *message) { 164 164 if(level == LOGLVL_ERROR) 165 165 fprintf(stderr, "Error: %s\n", message); -
log.h
r2af3e23 r8e9e2b7 44 44 45 45 typedef struct log_t { 46 void (*error)(int level, c har *logmessage);47 void (*warning)(int level, c har *logmessage);48 void (*informational)(int level, c har *logmessage);46 void (*error)(int level, const char *logmessage); 47 void (*warning)(int level, const char *logmessage); 48 void (*informational)(int level, const char *logmessage); 49 49 #ifdef DEBUG 50 void (*debug)(int level, c har *logmessage);50 void (*debug)(int level, const char *logmessage); 51 51 #endif 52 52 } log_t; … … 54 54 void log_init(void); 55 55 void log_link(int level, int output); 56 void log_message(int level, c har *message, ...) G_GNUC_PRINTF( 2, 3 );57 void log_error(c har *functionname);56 void log_message(int level, const char *message, ...) G_GNUC_PRINTF( 2, 3 ); 57 void log_error(const char *functionname); 58 58 59 59 #endif -
nick.c
r2af3e23 r8e9e2b7 196 196 LC_CTYPE being set to something other than C/POSIX. */ 197 197 if( part ) 198 part = asc = g_convert ( part, -1, "ASCII//TRANSLIT//IGNORE",199 "UTF-8", NULL, NULL, NULL );198 part = asc = g_convert_with_fallback( part, -1, "ASCII//TRANSLIT", 199 "UTF-8", "", NULL, NULL, NULL ); 200 200 201 201 if( ret->len == 0 && part && isdigit( *part ) ) -
protocols/bee_user.c
r2af3e23 r8e9e2b7 265 265 } 266 266 267 if( ( g_strcasecmp( set_getstr( &ic->bee->set, "strip_html" ), "always" ) == 0 ) ||268 ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->bee->set, "strip_html" ) ) )269 strip_html( msg );270 271 267 if( bee->ui->user_msg && bu ) 272 268 bee->ui->user_msg( bee, bu, msg, sent_at ); -
protocols/jabber/jabber.c
r2af3e23 r8e9e2b7 557 557 558 558 ret->name = "jabber"; 559 ret->mms = 0; /* no limit */ 559 560 ret->login = jabber_login; 560 561 ret->init = jabber_init; -
protocols/msn/msn.c
r2af3e23 r8e9e2b7 355 355 356 356 ret->name = "msn"; 357 ret->mms = 1409; /* this guess taken from libotr UPGRADING file */ 357 358 ret->login = msn_login; 358 359 ret->init = msn_init; -
protocols/nogaim.h
r2af3e23 r8e9e2b7 68 68 #define OPT_TYPING 0x00000100 /* Some pieces of code make assumptions */ 69 69 #define OPT_THINKING 0x00000200 /* about these values... Stupid me! */ 70 #define OPT_NOOTR 0x00001000 /* protocol not suitable for OTR */ 70 71 71 72 /* ok. now the fun begins. first we create a connection structure */ … … 142 143 const char *name; 143 144 void *data; 145 /* Maximum Message Size of this protocol. 146 * - Introduced for OTR, in order to fragment large protocol messages. 147 * - 0 means "unlimited". */ 148 unsigned int mms; 144 149 145 150 /* Added this one to be able to add per-account settings, don't think -
protocols/oscar/oscar.c
r2af3e23 r8e9e2b7 2612 2612 struct prpl *ret = g_new0(struct prpl, 1); 2613 2613 ret->name = "oscar"; 2614 ret->mms = 2343; /* this guess taken from libotr UPGRADING file */ 2614 2615 ret->away_states = oscar_away_states; 2615 2616 ret->init = oscar_init; -
protocols/twitter/twitter.c
r2af3e23 r8e9e2b7 534 534 struct prpl *ret = g_new0(struct prpl, 1); 535 535 536 ret->options = OPT_NOOTR; 536 537 ret->name = "twitter"; 537 538 ret->login = twitter_login; -
protocols/yahoo/yahoo.c
r2af3e23 r8e9e2b7 379 379 struct prpl *ret = g_new0(struct prpl, 1); 380 380 ret->name = "yahoo"; 381 ret->mms = 832; /* this guess taken from libotr UPGRADING file */ 381 382 ret->init = byahoo_init; 382 383 -
query.c
r2af3e23 r8e9e2b7 106 106 int count = 0; 107 107 108 if( !ic ) 109 return; 110 108 111 q = irc->queries; 109 112 def = query_default( irc ); … … 148 151 else 149 152 irc_usermsg( irc, "Accepted: %s", q->question ); 150 q->yes( q->data ); 153 if( q->yes ) 154 q->yes( q->data ); 151 155 } 152 156 else … … 156 160 else 157 161 irc_usermsg( irc, "Rejected: %s", q->question ); 158 q->no( q->data ); 162 if( q->no ) 163 q->no( q->data ); 159 164 } 160 165 q->data = NULL; -
root_commands.c
r2af3e23 r8e9e2b7 55 55 56 56 len = strlen( cmd[0] ); 57 for( i = 0; commands[i].command; i++ )58 if( g_strncasecmp( commands[i].command, cmd[0], len ) == 0 )59 { 60 if( commands[i+1].command &&61 g_strncasecmp( commands[i+1].command, cmd[0], len ) == 0 )57 for( i = 0; root_commands[i].command; i++ ) 58 if( g_strncasecmp( root_commands[i].command, cmd[0], len ) == 0 ) 59 { 60 if( root_commands[i+1].command && 61 g_strncasecmp( root_commands[i+1].command, cmd[0], len ) == 0 ) 62 62 /* Only match on the first letters if the match is unique. */ 63 63 break; 64 64 65 MIN_ARGS( commands[i].required_parameters );65 MIN_ARGS( root_commands[i].required_parameters ); 66 66 67 commands[i].execute( irc, cmd );67 root_commands[i].execute( irc, cmd ); 68 68 return; 69 69 } … … 1313 1313 1314 1314 /* IMPORTANT: Keep this list sorted! The short command logic needs that. */ 1315 co nst command_tcommands[] = {1315 command_t root_commands[] = { 1316 1316 { "account", 1, cmd_account, 0 }, 1317 1317 { "add", 2, cmd_add, 0 }, … … 1337 1337 { "transfer", 0, cmd_transfer, 0 }, 1338 1338 { "yes", 0, cmd_yesno, 0 }, 1339 { NULL } 1339 /* Not expecting too many plugins adding root commands so just make a 1340 dumb array with some empty entried at the end. */ 1341 { NULL }, 1342 { NULL }, 1343 { NULL }, 1344 { NULL }, 1345 { NULL }, 1346 { NULL }, 1347 { NULL }, 1348 { NULL }, 1349 { NULL }, 1340 1350 }; 1351 static const int num_root_commands = sizeof( root_commands ) / sizeof( command_t ); 1352 1353 gboolean root_command_add( const char *command, int params, void (*func)(irc_t *, char **args), int flags ) 1354 { 1355 int i; 1356 1357 if( root_commands[num_root_commands-2].command ) 1358 /* Planning fail! List is full. */ 1359 return FALSE; 1360 1361 for( i = 0; root_commands[i].command; i++ ) 1362 { 1363 if( g_strcasecmp( root_commands[i].command, command ) == 0 ) 1364 return FALSE; 1365 else if( g_strcasecmp( root_commands[i].command, command ) > 0 ) 1366 break; 1367 } 1368 memmove( root_commands + i + 1, root_commands + i, 1369 sizeof( command_t ) * ( num_root_commands - i - 1 ) ); 1370 1371 root_commands[i].command = g_strdup( command ); 1372 root_commands[i].required_parameters = params; 1373 root_commands[i].execute = func; 1374 root_commands[i].flags = flags; 1375 1376 return TRUE; 1377 } -
storage.c
r2af3e23 r8e9e2b7 115 115 status = st->load(irc, password); 116 116 if (status == STORAGE_OK) 117 { 118 GSList *l; 119 for( l = irc_plugins; l; l = l->next ) 120 { 121 irc_plugin_t *p = l->data; 122 if( p->storage_load ) 123 p->storage_load( irc ); 124 } 117 125 return status; 126 } 118 127 119 128 if (status != STORAGE_NO_SUCH_USER) … … 127 136 { 128 137 storage_status_t st; 138 GSList *l; 129 139 130 140 if (password != NULL) { … … 140 150 st = ((storage_t *)global.storage->data)->save(irc, overwrite); 141 151 152 for( l = irc_plugins; l; l = l->next ) 153 { 154 irc_plugin_t *p = l->data; 155 if( p->storage_save ) 156 p->storage_save( irc ); 157 } 158 142 159 if (password != NULL) { 143 160 irc_setpass(irc, NULL); … … 151 168 GList *gl; 152 169 storage_status_t ret = STORAGE_OK; 170 gboolean ok = FALSE; 171 GSList *l; 153 172 154 173 /* Remove this account from all storage backends. If this isn't … … 160 179 161 180 status = st->remove(nick, password); 181 ok |= status == STORAGE_OK; 162 182 if (status != STORAGE_NO_SUCH_USER && status != STORAGE_OK) 163 183 ret = status; 164 184 } 185 186 /* If at least one succeeded, remove plugin data. */ 187 if( ok ) 188 for( l = irc_plugins; l; l = l->next ) 189 { 190 irc_plugin_t *p = l->data; 191 if( p->storage_remove ) 192 p->storage_remove( nick ); 193 } 165 194 166 195 return ret; -
unix.c
r2af3e23 r8e9e2b7 29 29 #include "base64.h" 30 30 #include "commands.h" 31 #include "otr.h" 31 32 #include "protocols/nogaim.h" 32 33 #include "help.h" 33 34 #include "ipc.h" 35 #include "lib/ssl_client.h" 34 36 #include "md5.h" 35 37 #include "misc.h" … … 68 70 69 71 b_main_init(); 72 73 /* Ugly Note: libotr and gnutls both use libgcrypt. libgcrypt 74 has a process-global config state whose initialization happpens 75 twice if libotr and gnutls are used together. libotr installs custom 76 memory management functions for libgcrypt while our gnutls module 77 uses the defaults. Therefore we initialize OTR after SSL. *sigh* */ 78 ssl_init(); 79 #ifdef OTR_BI 80 otr_init(); 81 #endif 82 /* And in case OTR is loaded as a plugin, it'll also get loaded after 83 this point. */ 70 84 71 85 srand( time( NULL ) ^ getpid() );
Note: See TracChangeset
for help on using the changeset viewer.