Changes in / [f4bcc22:814aa52]
- Files:
-
- 3 added
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile
rf4bcc22 r814aa52 11 11 # Program variables 12 12 objects = account.o bitlbee.o chat.o crypting.o help.o ipc.o irc.o irc_commands.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS) user.o 13 headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.h lib/events.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/nogaim.h13 headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ipc.h irc.h log.h nick.h otr.h query.h set.h sock.h storage.h user.h lib/events.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/nogaim.h 14 14 subdirs = lib protocols 15 15 … … 20 20 OUTFILE=bitlbee.exe 21 21 else 22 objects += unix.o conf.o log.o 22 objects += unix.o conf.o log.o otr.o 23 23 OUTFILE=bitlbee 24 24 endif … … 94 94 mkdir -p $(DESTDIR)$(ETCDIR) 95 95 install -m 0644 motd.txt $(DESTDIR)$(ETCDIR)/motd.txt 96 install -m 0644 welcome.txt $(DESTDIR)$(ETCDIR)/welcome.txt 96 97 install -m 0644 bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf 97 98 98 99 uninstall-etc: 99 100 rm -f $(DESTDIR)$(ETCDIR)/motd.txt 101 rm -f $(DESTDIR)$(ETCDIR)/welcome.txt 100 102 rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf 101 103 -rmdir $(DESTDIR)$(ETCDIR) -
bitlbee.conf
rf4bcc22 r814aa52 85 85 # MotdFile = /etc/bitlbee/motd.txt 86 86 87 ## WelcomeFile 88 ## 89 ## Specify an alternative file for the welcome message displayed when joining the 90 ## control channel. Default value depends on the --etcdir argument to configure. 91 ## 92 # WelcomeFile = /etc/bitlbee/welcome.txt 93 87 94 ## ConfigDir 88 95 ## -
bitlbee.h
rf4bcc22 r814aa52 30 30 #define _GNU_SOURCE /* Stupid GNU :-P */ 31 31 #endif 32 33 /* Depend on Windows 2000 for now since we need getaddrinfo() */ 34 #define _WIN32_WINNT 0x0501 32 35 33 36 /* Depend on Windows 2000 for now since we need getaddrinfo() */ … … 141 144 #include "misc.h" 142 145 #include "proxy.h" 146 #include "otr.h" 143 147 144 148 typedef struct global { … … 152 156 char *helpfile; 153 157 int restart; 158 OtrlMessageAppOps otr_ops; /* collects interface functions required by OTR */ 154 159 } global_t; 155 160 -
conf.c
rf4bcc22 r814aa52 60 60 conf->pidfile = g_strdup( PIDFILE ); 61 61 conf->motdfile = g_strdup( ETCDIR "/motd.txt" ); 62 conf->welcomefile = g_strdup( ETCDIR "/welcome.txt" ); 62 63 conf->ping_interval = 180; 63 64 conf->ping_timeout = 300; … … 258 259 conf->motdfile = g_strdup( ini->value ); 259 260 } 261 else if( g_strcasecmp( ini->key, "welcomefile" ) == 0 ) 262 { 263 g_free( conf->welcomefile ); 264 conf->welcomefile = g_strdup( ini->value ); 265 } 260 266 else if( g_strcasecmp( ini->key, "account_storage" ) == 0 ) 261 267 { -
conf.h
rf4bcc22 r814aa52 45 45 char *pidfile; 46 46 char *motdfile; 47 char *welcomefile; 47 48 char *primary_storage; 48 49 char **migrate_storage; -
configure
rf4bcc22 r814aa52 32 32 gcov=0 33 33 plugins=1 34 otr=auto 34 35 35 36 events=glib … … 73 74 --gcov=0/1 Disable/enable test coverage reporting $gcov 74 75 --plugins=0/1 Disable/enable plugins support $plugins 76 --otr=0/1 Disable/enable OTR encryption support $otr 75 77 76 78 --events=... Event handler (glib, libevent) $events … … 452 454 fi 453 455 456 otrprefix="" 457 for i in / /usr /usr/local; do 458 if [ -f ${i}/lib/libotr.a ]; then 459 otrprefix=${i} 460 break 461 fi 462 done 463 if [ "$otr" = "auto" ]; then 464 if [ -n "$otrprefix" ]; then 465 otr=1 466 else 467 otr=0 468 fi 469 fi 470 if [ "$otr" = 1 ]; then 471 echo '#define WITH_OTR' >> config.h 472 echo "EFLAGS+=-L${otrprefix}/lib -lotr" >> Makefile.settings 473 echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings 474 else 475 echo '#undef WITH_OTR' >> config.h 476 fi 477 454 478 if [ ! -e doc/user-guide/help.txt ] && ! type xmlto > /dev/null 2> /dev/null; then 455 479 echo … … 606 630 fi 607 631 632 if [ "$otr" = "1" ]; then 633 echo ' Off-the-Record (OTR) Messaging enabled.' 634 else 635 echo ' Off-the-Record (OTR) Messaging disabled.' 636 fi 637 608 638 echo ' Using event handler: '$events 609 639 echo ' Using SSL library: '$ssl -
doc/README
rf4bcc22 r814aa52 67 67 BitlBee's only real dependency is GLib. This is available on virtually every 68 68 platform. Any recent version of GLib (2.4 or higher) will work. 69 70 Off-the-Record encryption support will be included by default if the 71 configure script finds libotr in one of the usual places. You can pass 72 --otr=1 or --otr=0 to force it on or off, respectively. 69 73 70 74 These days, MSN Messenger clients have to connect to the MS Passport servers … … 143 147 144 148 145 A NOTE ON ENCRYPTION146 ==================== 149 A NOTE ON PASSWORD ENCRYPTION 150 ============================= 147 151 148 152 There used to be a note here about the simple obfuscation method used to -
doc/user-guide/commands.xml
rf4bcc22 r814aa52 345 345 </description> 346 346 </bitlbee-command> 347 348 <bitlbee-command name="otr"> 349 <short-description>Off-the-Record encryption control</short-description> 350 <syntax>otr <subcommand> [<arguments>]</syntax> 351 352 <description> 353 354 <para> 355 Available subcommands: connect, disconnect, smp, trust, info, keygen, and forget. See <emphasis>help otr <subcommand></emphasis> for more information. 356 </para> 357 358 </description> 359 360 <bitlbee-command name="connect"> 361 <syntax>otr connect <nick></syntax> 362 363 <description> 364 365 <para> 366 Attempts to establish an encrypted connection with the specified user by sending a magic string. 367 </para> 368 369 </description> 370 371 </bitlbee-command> 372 373 <bitlbee-command name="disconnect"> 374 <syntax>otr disconnect <nick></syntax> 375 376 <description> 377 378 <para> 379 Resets the connection with the specified user to cleartext. 380 </para> 381 382 </description> 383 384 </bitlbee-command> 385 386 <bitlbee-command name="smp"> 387 <syntax>otr smp <nick> <secret></syntax> 388 389 <description> 390 391 <para> 392 Attempts to authenticate the given user's active fingerprint via the Socialist Millionaires' Protocol. 393 </para> 394 395 <para> 396 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. 397 </para> 398 399 </description> 400 401 </bitlbee-command> 402 403 <bitlbee-command name="trust"> 404 <syntax>otr trust <nick> <fp1> <fp2> <fp3> <fp4> <fp5></syntax> 405 406 <description> 407 408 <para> 409 Manually affirms trust in the specified fingerprint, given as five blocks of precisely eight (hexadecimal) digits each. 410 </para> 411 412 </description> 413 414 </bitlbee-command> 415 416 <bitlbee-command name="info"> 417 <syntax>otr info</syntax> 418 <syntax>otr info <nick></syntax> 419 420 <description> 421 422 <para> 423 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. 424 </para> 425 426 </description> 427 428 </bitlbee-command> 429 430 <bitlbee-command name="keygen"> 431 <syntax>otr keygen <account-no></syntax> 432 433 <description> 434 435 <para> 436 Generates a new OTR private key for the given account. 437 </para> 438 439 </description> 440 441 </bitlbee-command> 442 443 <bitlbee-command name="forget"> 444 <syntax>otr forget <thing> <arguments></syntax> 445 446 <description> 447 448 <para> 449 Forgets some part of our OTR userstate. Available things: fingerprint, context, and key. See <emphasis>help otr forget <thing></emphasis> for more information. 450 </para> 451 452 </description> 453 454 <bitlbee-command name="fingerprint"> 455 <syntax>otr forget fingerprint <nick> <fingerprint></syntax> 456 457 <description> 458 459 <para> 460 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. 461 </para> 462 463 </description> 464 465 </bitlbee-command> 466 467 <bitlbee-command name="context"> 468 <syntax>otr forget context <nick></syntax> 469 470 <description> 471 472 <para> 473 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. 474 </para> 475 476 </description> 477 478 </bitlbee-command> 479 480 <bitlbee-command name="key"> 481 <syntax>otr forget key <fingerprint></syntax> 482 483 <description> 484 485 <para> 486 Forgets an OTR private key matching the specified fingerprint. It is allowed to specify only a (unique) prefix of the fingerprint. 487 </para> 488 489 </description> 490 491 </bitlbee-command> 492 493 </bitlbee-command> 494 495 </bitlbee-command> 347 496 348 497 <bitlbee-command name="set"> … … 529 678 </bitlbee-setting> 530 679 680 <bitlbee-setting name="color_encrypted" type="boolean" scope="global"> 681 <default>true</default> 682 683 <description> 684 <para> 685 If set to true, BitlBee will color incoming encrypted messages according to their fingerprint trust level: untrusted=red, trusted=green. 686 </para> 687 </description> 688 </bitlbee-setting> 689 531 690 <bitlbee-setting name="control_channel" type="string" scope="global"> 532 691 <default>&bitlbee</default> … … 615 774 </bitlbee-setting> 616 775 776 <bitlbee-setting name="halfop_buddies" type="string" scope="global"> 777 <default>encrypted</default> 778 <possible-values>encrypted, trusted, notaway, false</possible-values> 779 780 <description> 781 <para> 782 Specifies under which circumstances BitlBee should give the "halfop" mode flag (+h) to buddies. 783 </para> 784 785 <para> 786 If "false", the flag is never set. On "notaway", the flag is removed for users marked as "away" and set for all others. On "encrypted", the flag is set for users with whom we have an encrypted connection. On "trusted", it is set only for encrypted connections using a trusted key. 787 </para> 788 </description> 789 </bitlbee-setting> 790 617 791 <bitlbee-setting name="ignore_auth_requests" type="boolean" scope="account"> 618 792 <default>true</default> … … 623 797 </para> 624 798 </description> 625 626 799 </bitlbee-setting> 627 800 … … 657 830 </description> 658 831 832 </bitlbee-setting> 833 834 <bitlbee-setting name="op_buddies" type="string" scope="global"> 835 <default>trusted</default> 836 <possible-values>encrypted, trusted, notaway, false</possible-values> 837 838 <description> 839 <para> 840 Specifies under which circumstances BitlBee should give the "op" mode flag (+o) to buddies. 841 </para> 842 843 <para> 844 If "false", the flag is never set. On "notaway", the flag is removed for users marked as "away" and set for all others. On "encrypted", the flag is set for users with whom we have an encrypted connection. On "trusted", it is set only for encrypted connections using a trusted key. 845 </para> 846 </description> 847 848 </bitlbee-setting> 849 850 <bitlbee-setting name="op_root" type="bool" scope="global"> 851 <default>true</default> 852 853 <description> 854 <para> 855 Some people prefer themself and root to have operator status in &bitlbee, other people don't. You can set the desired state for root using this setting. 856 </para> 857 </description> 858 </bitlbee-setting> 859 860 <bitlbee-setting name="op_user" type="bool" scope="global"> 861 <default>true</default> 862 863 <description> 864 <para> 865 Some people prefer themself and root to have operator status in &bitlbee, other people don't. You can set the desired state for yourself using this setting. 866 </para> 867 </description> 868 </bitlbee-setting> 869 870 <bitlbee-setting name="otr_policy" type="string" scope="global"> 871 <default>opportunistic</default> 872 <possible-values>never, opportunistic, manual, always</possible-values> 873 874 <description> 875 <para> 876 This setting controls the policy for establishing Off-the-Record connections. 877 </para> 878 <para> 879 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. 880 </para> 881 </description> 659 882 </bitlbee-setting> 660 883 … … 676 899 </para> 677 900 </description> 678 679 901 </bitlbee-setting> 680 902 … … 956 1178 </para> 957 1179 </description> 1180 </bitlbee-setting> 1181 1182 <bitlbee-setting name="voice_buddies" type="string" scope="global"> 1183 <default>trusted</default> 1184 <possible-values>encrypted, trusted, notaway, false</possible-values> 1185 1186 <description> 1187 <para> 1188 Specifies under which circumstances BitlBee should give the "voice" mode flag (+v) to buddies. 1189 </para> 1190 1191 <para> 1192 If "false", the flag is never set. On "notaway", the flag is removed for users marked as "away" and set for all others. On "encrypted", the flag is set for users with whom we have an encrypted connection. On "trusted", it is set only for encrypted connections using a trusted key. 1193 </para> 1194 </description> 1195 958 1196 </bitlbee-setting> 959 1197 -
ipc.c
rf4bcc22 r814aa52 33 33 34 34 GSList *child_list = NULL; 35 static char *statefile = NULL; 35 36 36 37 static void ipc_master_cmd_client( irc_t *data, char **cmd ) … … 62 63 } 63 64 64 static void ipc_master_cmd_deaf( irc_t *data, char **cmd )65 {66 if( global.conf->runmode == RUNMODE_DAEMON )67 {68 b_event_remove( global.listen_watch_source_id );69 close( global.listen_socket );70 71 global.listen_socket = global.listen_watch_source_id = -1;72 73 ipc_to_children_str( "OPERMSG :Closed listening socket, waiting "74 "for all users to disconnect." );75 }76 else77 {78 ipc_to_children_str( "OPERMSG :The DEAF command only works in "79 "normal daemon mode. Try DIE instead." );80 }81 }82 83 65 void ipc_master_cmd_rehash( irc_t *data, char **cmd ) 84 66 { … … 116 98 { "hello", 0, ipc_master_cmd_client, 0 }, 117 99 { "die", 0, ipc_master_cmd_die, 0 }, 118 { "deaf", 0, ipc_master_cmd_deaf, 0 },119 100 { "wallops", 1, NULL, IPC_CMD_TO_CHILDREN }, 120 101 { "wall", 1, NULL, IPC_CMD_TO_CHILDREN }, … … 460 441 } 461 442 462 #ifndef _WIN32463 443 char *ipc_master_save_state() 464 444 { … … 501 481 } 502 482 483 void ipc_master_set_statefile( char *fn ) 484 { 485 statefile = g_strdup( fn ); 486 } 487 503 488 504 489 static gboolean new_ipc_client( gpointer data, gint serversock, b_input_condition cond ) … … 521 506 } 522 507 508 #ifndef _WIN32 523 509 int ipc_master_listen_socket() 524 510 { … … 557 543 } 558 544 #else 559 int ipc_master_listen_socket()560 {561 545 /* FIXME: Open named pipe \\.\BITLBEE */ 562 return 0;563 }564 546 #endif 565 547 566 int ipc_master_load_state( char *statefile)548 int ipc_master_load_state() 567 549 { 568 550 struct bitlbee_child *child; … … 572 554 if( statefile == NULL ) 573 555 return 0; 574 575 556 fp = fopen( statefile, "r" ); 576 557 unlink( statefile ); /* Why do it later? :-) */ -
ipc.h
rf4bcc22 r814aa52 58 58 59 59 char *ipc_master_save_state(); 60 int ipc_master_load_state( char *statefile ); 60 void ipc_master_set_statefile( char *fn ); 61 int ipc_master_load_state(); 61 62 int ipc_master_listen_socket(); 62 63 -
irc.c
rf4bcc22 r814aa52 29 29 #include "crypting.h" 30 30 #include "ipc.h" 31 #include <sys/types.h> 32 #include <sys/wait.h> 31 33 32 34 static gboolean irc_userping( gpointer _irc, int fd, b_input_condition cond ); 35 static void irc_welcome( irc_t* irc ); 33 36 34 37 GSList *irc_connection_list = NULL; … … 177 180 178 181 irc_connection_list = g_slist_append( irc_connection_list, irc ); 182 179 183 180 184 s = set_add( &irc->set, "away", NULL, set_eval_away_status, irc ); 181 185 s->flags |= SET_NULL_OK; 182 s = set_add( &irc->set, "away_devoice", "true", set_eval_away_devoice, irc );183 186 s = set_add( &irc->set, "auto_connect", "true", set_eval_bool, irc ); 184 187 s = set_add( &irc->set, "auto_reconnect", "true", set_eval_bool, irc ); … … 187 190 s = set_add( &irc->set, "buddy_sendbuffer_delay", "200", set_eval_int, irc ); 188 191 s = set_add( &irc->set, "charset", "utf-8", set_eval_charset, irc ); 192 s = set_add( &irc->set, "color_encrypted", "true", set_eval_bool, irc ); 189 193 s = set_add( &irc->set, "control_channel", irc->channel, set_eval_control_channel, irc ); 190 194 s = set_add( &irc->set, "debug", "false", set_eval_bool, irc ); … … 193 197 s = set_add( &irc->set, "display_timestamps", "true", set_eval_bool, irc ); 194 198 s = set_add( &irc->set, "handle_unknown", "root", NULL, irc ); 199 s = set_add( &irc->set, "halfop_buddies", "encrypted", set_eval_halfop_buddies, irc ); 195 200 s = set_add( &irc->set, "lcnicks", "true", set_eval_bool, irc ); 196 s = set_add( &irc->set, "ops", "both", set_eval_ops, irc ); 201 s = set_add( &irc->set, "op_buddies", "trusted", set_eval_op_buddies, irc ); 202 s = set_add( &irc->set, "op_root", "true", set_eval_op_root, irc ); 203 s = set_add( &irc->set, "otr_policy", "oppurtunistic", set_eval_otr_policy, irc ); 197 204 s = set_add( &irc->set, "password", NULL, set_eval_password, irc ); 198 205 s->flags |= SET_NULL_OK; … … 202 209 s = set_add( &irc->set, "save_on_quit", "true", set_eval_bool, irc ); 203 210 s = set_add( &irc->set, "simulate_netsplit", "true", set_eval_bool, irc ); 204 s = set_add( &irc->set, "status", NULL, set_eval_away_status, irc );205 s->flags |= SET_NULL_OK;206 211 s = set_add( &irc->set, "strip_html", "true", NULL, irc ); 207 212 s = set_add( &irc->set, "timezone", "local", set_eval_timezone, irc ); 208 213 s = set_add( &irc->set, "to_char", ": ", set_eval_to_char, irc ); 209 214 s = set_add( &irc->set, "typing_notice", "false", set_eval_bool, irc ); 215 s = set_add( &irc->set, "voice_buddies", "notaway", set_eval_voice_buddies, irc); 210 216 211 217 conf_loaddefaults( irc ); 212 218 219 irc->otr = otr_new(); 220 213 221 /* Evaluator sets the iconv/oconv structures. */ 214 222 set_eval_charset( set_find( &irc->set, "charset" ), set_getstr( &irc->set, "charset" ) ); … … 362 370 363 371 g_free( irc->last_target ); 372 373 otr_free(irc->otr); 364 374 365 375 g_free( irc ); 366 376 367 377 if( global.conf->runmode == RUNMODE_INETD || 368 378 global.conf->runmode == RUNMODE_FORKDAEMON || … … 733 743 } 734 744 745 const char *user_mode_prefix( irc_t *irc, user_t *u ) 746 { 747 static char op[] = "@"; 748 static char halfop[] = "%"; 749 static char voice[] = "+"; 750 static char none[] = ""; 751 752 int or = set_getbool(&irc->set, "op_root"); 753 int ou = set_getbool(&irc->set, "op_user"); 754 char *ob = set_getstr(&irc->set, "op_buddies"); 755 char *hb = set_getstr(&irc->set, "halfop_buddies"); 756 char *vb = set_getstr(&irc->set, "voice_buddies"); 757 758 if( (!strcmp(u->nick, irc->mynick) && or) || 759 (!strcmp(u->nick, irc->nick) && ou) || 760 (!u->away && !strcmp(ob, "notaway")) || 761 (u->encrypted && !strcmp(ob, "encrypted")) || 762 (u->encrypted>1 && !strcmp(ob, "trusted")) 763 ) 764 return op; 765 else if( (!u->away && !strcmp(hb, "notaway")) || 766 (u->encrypted && !strcmp(hb, "encrypted")) || 767 (u->encrypted>1 && !strcmp(hb, "trusted")) 768 ) 769 return halfop; 770 else if( (!u->away && !strcmp(vb, "notaway")) || 771 (u->encrypted && !strcmp(vb, "encrypted")) || 772 (u->encrypted>1 && !strcmp(vb, "trusted")) 773 ) 774 return voice; 775 else 776 return none; 777 } 778 735 779 void irc_names( irc_t *irc, char *channel ) 736 780 { … … 738 782 char namelist[385] = ""; 739 783 struct groupchat *c = NULL; 740 char *ops = set_getstr( &irc->set, "ops" );741 784 742 785 /* RFCs say there is no error reply allowed on NAMES, so when the … … 753 796 } 754 797 755 if( u->ic && !u->away && set_getbool( &irc->set, "away_devoice" ) ) 756 strcat( namelist, "+" ); 757 else if( ( strcmp( u->nick, irc->mynick ) == 0 && ( strcmp( ops, "root" ) == 0 || strcmp( ops, "both" ) == 0 ) ) || 758 ( strcmp( u->nick, irc->nick ) == 0 && ( strcmp( ops, "user" ) == 0 || strcmp( ops, "both" ) == 0 ) ) ) 759 strcat( namelist, "@" ); 760 798 strcat( namelist, user_mode_prefix(irc, u) ); 761 799 strcat( namelist, u->nick ); 762 800 strcat( namelist, " " ); … … 769 807 /* root and the user aren't in the channel userlist but should 770 808 show up in /NAMES, so list them first: */ 771 sprintf( namelist, "%s%s %s%s ", s trcmp( ops, "root" ) == 0 || strcmp( ops, "both") ? "@" : "", irc->mynick,772 s trcmp( ops, "user" ) == 0 || strcmp( ops, "both") ? "@" : "", irc->nick );809 sprintf( namelist, "%s%s %s%s ", set_getbool(&irc->set, "op_root") ? "@" : "", irc->mynick, 810 set_getbool(&irc->set, "op_user") ? "@" : "", irc->nick ); 773 811 774 812 for( l = c->in_room; l; l = l->next ) if( ( u = user_findhandle( c->ic, l->data ) ) ) … … 780 818 } 781 819 820 strcat( namelist, user_mode_prefix(irc, u) ); 782 821 strcat( namelist, u->nick ); 783 822 strcat( namelist, " " ); … … 821 860 irc_reply( irc, 3, ":%s", IRCD_INFO ); 822 861 irc_reply( irc, 4, "%s %s %s %s", irc->myhost, BITLBEE_VERSION, UMODES UMODES_PRIV, CMODES ); 823 irc_reply( irc, 5, "PREFIX=(o v)@+ CHANTYPES=%s CHANMODES=,,,%s NICKLEN=%d NETWORK=BitlBee "862 irc_reply( irc, 5, "PREFIX=(ohv)@%%+ CHANTYPES=%s CHANMODES=,,,%s NICKLEN=%d NETWORK=BitlBee " 824 863 "CASEMAPPING=rfc1459 MAXTARGETS=1 WATCH=128 :are supported by this server", 825 864 CTYPES, CMODES, MAX_NICK_LENGTH - 1 ); … … 827 866 irc->umode[0] = '\0'; 828 867 irc_umode_set( irc, "+" UMODE, 1 ); 829 830 u = user_add( irc, irc->mynick ); 868 u = user_add( irc, irc->mynick ); 831 869 u->host = g_strdup( irc->myhost ); 832 870 u->realname = g_strdup( ROOT_FN ); … … 850 888 irc_spawn( irc, u ); 851 889 852 irc_usermsg( irc, "Welcome to the BitlBee gateway!\n\n" 853 "If you've never used BitlBee before, please do read the help " 854 "information using the \x02help\x02 command. Lots of FAQs are " 855 "answered there.\n" 856 "If you already have an account on this server, just use the " 857 "\x02identify\x02 command to identify yourself." ); 890 irc_welcome( irc ); 858 891 859 892 if( global.conf->runmode == RUNMODE_FORKDAEMON || global.conf->runmode == RUNMODE_DAEMON ) … … 870 903 root_command( irc, send_cmd ); 871 904 g_free( send_cmd[1] ); 905 } 906 } 907 908 static void irc_welcome( irc_t *irc ) 909 { 910 FILE *f; 911 912 f = fopen( global.conf->welcomefile, "r" ); 913 if( !f ) 914 { 915 irc_usermsg( irc, "Welcome to the BitlBee gateway!\n\n" 916 "If you've never used BitlBee before, please do read the help " 917 "information using the \x02help\x02 command. Lots of FAQs are " 918 "answered there.\n" 919 "OTR users please note: Private key files are owned by the user " 920 "BitlBee is running as.\n" 921 "If you already have an account on this server, just use the " 922 "\x02identify\x02 command to identify yourself." ); 923 } 924 else 925 { 926 char linebuf[380]; 927 928 while( fgets( linebuf, 380, f ) ) 929 { 930 irc_usermsg( irc, linebuf ); 931 } 932 933 fclose( f ); 872 934 } 873 935 } -
irc.h
rf4bcc22 r814aa52 27 27 #define _IRC_H 28 28 29 #include "otr.h" 30 29 31 #define IRC_MAX_LINE 512 30 #define IRC_MAX_ARGS 832 #define IRC_MAX_ARGS 16 31 33 32 34 #define IRC_LOGIN_TIMEOUT 60 … … 94 96 gint w_watch_source_id; 95 97 gint ping_source_id; 98 99 otr_t *otr; /* OTR state and book keeping */ 96 100 } irc_t; 97 101 -
irc_commands.c
rf4bcc22 r814aa52 604 604 { "completions", 0, irc_cmd_completions, IRC_CMD_LOGGED_IN }, 605 605 { "die", 0, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, 606 { "deaf", 0, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER },607 606 { "wallops", 1, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, 608 607 { "wall", 1, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, -
lib/misc.c
rf4bcc22 r814aa52 157 157 char *s = out, *cs; 158 158 int i, matched; 159 int taglen; 159 160 160 161 memset( out, 0, strlen( in ) + 1 ); … … 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", 2) == 0 ) 178 188 *(s++) = '\n'; 179 189 in ++; -
lib/ssl_bogus.c
rf4bcc22 r814aa52 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
rf4bcc22 r814aa52 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
rf4bcc22 r814aa52 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
rf4bcc22 r814aa52 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
rf4bcc22 r814aa52 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 SSLeay_add_ssl_algorithms(); 63 } 58 64 59 65 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data ) … … 115 121 if( !initialized ) 116 122 { 117 initialized = TRUE; 118 SSLeay_add_ssl_algorithms(); 123 ssl_init(); 119 124 } 120 125 -
log.c
rf4bcc22 r814aa52 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
rf4bcc22 r814aa52 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 -
protocols/jabber/jabber.c
rf4bcc22 r814aa52 526 526 527 527 ret->name = "jabber"; 528 ret->mms = 0; /* no limit */ 528 529 ret->login = jabber_login; 529 530 ret->init = jabber_init; -
protocols/msn/msn.c
rf4bcc22 r814aa52 307 307 308 308 ret->name = "msn"; 309 ret->mms = 1409; /* this guess taken from libotr UPGRADING file */ 309 310 ret->login = msn_login; 310 311 ret->init = msn_init; -
protocols/msn/ns.c
rf4bcc22 r814aa52 271 271 if( num_parts == 5 ) 272 272 { 273 int i, groupcount; 274 275 groupcount = atoi( cmd[4] ); 276 if( groupcount > 0 ) 277 { 278 /* valgrind says this is leaking memory, I'm guessing 279 that this happens during server redirects. */ 280 if( md->grouplist ) 281 { 282 for( i = 0; i < md->groupcount; i ++ ) 283 g_free( md->grouplist[i] ); 284 g_free( md->grouplist ); 285 } 286 287 md->groupcount = groupcount; 273 md->buddycount = atoi( cmd[3] ); 274 md->groupcount = atoi( cmd[4] ); 275 if( md->groupcount > 0 ) 288 276 md->grouplist = g_new0( char *, md->groupcount ); 289 } 290 291 md->buddycount = atoi( cmd[3] ); 277 292 278 if( !*cmd[3] || md->buddycount == 0 ) 293 279 msn_logged_in( ic ); -
protocols/nogaim.c
rf4bcc22 r814aa52 699 699 700 700 /* LISPy... */ 701 if( ( set_getbool( &ic->irc->set, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */ 702 ( u->online ) && /* Don't touch offline people */ 703 ( ( ( u->online != oo ) && !u->away ) || /* Voice joining people */ 704 ( ( u->online == oo ) && ( oa == !u->away ) ) ) ) /* (De)voice people changing state */ 701 if( ( u->online ) && /* Don't touch offline people */ 702 ( ( ( u->online != oo ) && !u->away ) || /* Do joining people */ 703 ( ( u->online == oo ) && ( oa == !u->away ) ) ) ) /* Do people changing state */ 705 704 { 706 705 char *from; … … 715 714 ic->irc->myhost ); 716 715 } 717 irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel, 718 u->away?'-':'+', u->nick ); 716 if(!strcmp(set_getstr(&ic->irc->set, "voice_buddies"), "notaway")) { 717 irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel, 718 u->away?'-':'+', u->nick ); 719 } 720 if(!strcmp(set_getstr(&ic->irc->set, "halfop_buddies"), "notaway")) { 721 irc_write( ic->irc, ":%s MODE %s %ch %s", from, ic->irc->channel, 722 u->away?'-':'+', u->nick ); 723 } 724 if(!strcmp(set_getstr(&ic->irc->set, "op_buddies"), "notaway")) { 725 irc_write( ic->irc, ":%s MODE %s %co %s", from, ic->irc->channel, 726 u->away?'-':'+', u->nick ); 727 } 719 728 g_free( from ); 720 729 } … … 726 735 char *wrapped, *ts = NULL; 727 736 user_t *u; 728 737 738 /* pass the message through OTR */ 739 msg = otr_handle_message(ic, handle, msg); 740 if(!msg) { 741 /* this was an internal OTR protocol message */ 742 return; 743 } 744 729 745 u = user_findhandle( ic, handle ); 730 731 746 if( !u ) 732 747 { … … 738 753 imcb_log( ic, "Ignoring message from unknown handle %s", handle ); 739 754 755 g_free(msg); 740 756 return; 741 757 } … … 778 794 irc_msgfrom( irc, u->nick, wrapped ); 779 795 g_free( wrapped ); 796 g_free( msg ); 780 797 g_free( ts ); 781 798 } … … 1054 1071 /* Misc. BitlBee stuff which shouldn't really be here */ 1055 1072 1056 char *set_eval_away_devoice( set_t *set, char *value )1057 {1058 irc_t *irc = set->data;1059 int st;1060 1061 if( !is_bool( value ) )1062 return SET_INVALID;1063 1064 st = bool2int( value );1065 1066 /* Horror.... */1067 1068 if( st != set_getbool( &irc->set, "away_devoice" ) )1069 {1070 char list[80] = "";1071 user_t *u = irc->users;1072 int i = 0, count = 0;1073 char pm;1074 char v[80];1075 1076 if( st )1077 pm = '+';1078 else1079 pm = '-';1080 1081 while( u )1082 {1083 if( u->ic && u->online && !u->away )1084 {1085 if( ( strlen( list ) + strlen( u->nick ) ) >= 79 )1086 {1087 for( i = 0; i < count; v[i++] = 'v' ); v[i] = 0;1088 irc_write( irc, ":%s MODE %s %c%s%s",1089 irc->myhost,1090 irc->channel, pm, v, list );1091 1092 *list = 0;1093 count = 0;1094 }1095 1096 sprintf( list + strlen( list ), " %s", u->nick );1097 count ++;1098 }1099 u = u->next;1100 }1101 1102 /* $v = 'v' x $i */1103 for( i = 0; i < count; v[i++] = 'v' ); v[i] = 0;1104 irc_write( irc, ":%s MODE %s %c%s%s", irc->myhost,1105 irc->channel, pm, v, list );1106 }1107 1108 return value;1109 }1110 1111 1073 char *set_eval_timezone( set_t *set, char *value ) 1112 1074 { … … 1211 1173 msg = buf; 1212 1174 } 1213 1214 st = ic->acc->prpl->buddy_msg( ic, handle, msg, flags ); 1215 g_free( buf ); 1216 1175 1176 /* if compiled without otr support, this just calls the prpl buddy_msg */ 1177 st = otr_send_message(ic, handle, msg, flags); 1178 1179 g_free(buf); 1217 1180 return st; 1218 1181 } -
protocols/nogaim.h
rf4bcc22 r814aa52 132 132 * - The user sees this name ie. when imcb_log() is used. */ 133 133 const char *name; 134 /* Maximum Message Size of this protocol. 135 * - Introduced for OTR, in order to fragment large protocol messages. 136 * - 0 means "unlimited". */ 137 unsigned int mms; 134 138 135 139 /* Added this one to be able to add per-account settings, don't think … … 326 330 /* Misc. stuff */ 327 331 char *set_eval_timezone( set_t *set, char *value ); 328 char *set_eval_away_devoice( set_t *set, char *value );329 332 gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond ); 330 333 void cancel_auto_reconnect( struct account *a ); -
protocols/oscar/oscar.c
rf4bcc22 r814aa52 2683 2683 struct prpl *ret = g_new0(struct prpl, 1); 2684 2684 ret->name = "oscar"; 2685 ret->mms = 2343; /* this guess taken from libotr UPGRADING file */ 2685 2686 ret->away_states = oscar_away_states; 2686 2687 ret->init = oscar_init; -
protocols/yahoo/libyahoo2.c
rf4bcc22 r814aa52 69 69 #ifdef __MINGW32__ 70 70 # include <winsock2.h> 71 # define write(a,b,c) send(a,b,c,0) 72 # define read(a,b,c) recv(a,b,c,0) 71 73 #endif 72 74 -
protocols/yahoo/yahoo.c
rf4bcc22 r814aa52 350 350 struct prpl *ret = g_new0(struct prpl, 1); 351 351 ret->name = "yahoo"; 352 ret->mms = 832; /* this guess taken from libotr UPGRADING file */ 352 353 ret->init = byahoo_init; 353 354 -
protocols/yahoo/yahoo_httplib.c
rf4bcc22 r814aa52 51 51 #ifdef __MINGW32__ 52 52 # include <winsock2.h> 53 # define write(a,b,c) send(a,b,c,0) 54 # define read(a,b,c) recv(a,b,c,0) 53 55 # define snprintf _snprintf 54 56 #endif -
query.c
rf4bcc22 r814aa52 103 103 int count = 0; 104 104 105 if(!ic) 106 return; 107 105 108 q = irc->queries; 106 109 def = query_default( irc ); … … 145 148 else 146 149 irc_usermsg( irc, "Accepted: %s", q->question ); 147 q->yes( q->data ); 150 if( q->yes ) 151 q->yes( q->data ); 148 152 } 149 153 else … … 153 157 else 154 158 irc_usermsg( irc, "Rejected: %s", q->question ); 155 q->no( q->data ); 159 if( q->no ) 160 q->no( q->data ); 156 161 } 157 162 q->data = NULL; -
root_commands.c
rf4bcc22 r814aa52 29 29 #include "bitlbee.h" 30 30 #include "help.h" 31 #include "otr.h" 31 32 #include "chat.h" 32 33 … … 414 415 415 416 irc_usermsg( irc, "Account successfully added" ); 417 418 if(otr_check_for_key(a)) { 419 irc_usermsg(irc, "otr: you will be notified when it completes"); 420 } 416 421 } 417 422 else if( g_strcasecmp( cmd[1], "del" ) == 0 ) … … 1177 1182 { "qlist", 0, cmd_qlist, 0 }, 1178 1183 { "join_chat", 2, cmd_join_chat, 0 }, 1184 { "otr", 1, cmd_otr, 0 }, 1179 1185 { "chat", 1, cmd_chat, 0 }, 1180 1186 { NULL } -
set.c
rf4bcc22 r814aa52 225 225 } 226 226 227 char *set_eval_ops( set_t *set, char *value )227 char* set_eval_op_root( set_t *set, char* value ) 228 228 { 229 229 irc_t *irc = set->data; 230 231 if( g_strcasecmp( value, "user" ) == 0 ) 232 irc_write( irc, ":%s!%s@%s MODE %s %s %s %s", irc->mynick, irc->mynick, irc->myhost, 233 irc->channel, "+o-o", irc->nick, irc->mynick ); 234 else if( g_strcasecmp( value, "root" ) == 0 ) 235 irc_write( irc, ":%s!%s@%s MODE %s %s %s %s", irc->mynick, irc->mynick, irc->myhost, 236 irc->channel, "-o+o", irc->nick, irc->mynick ); 237 else if( g_strcasecmp( value, "both" ) == 0 ) 238 irc_write( irc, ":%s!%s@%s MODE %s %s %s %s", irc->mynick, irc->mynick, irc->myhost, 239 irc->channel, "+oo", irc->nick, irc->mynick ); 240 else if( g_strcasecmp( value, "none" ) == 0 ) 241 irc_write( irc, ":%s!%s@%s MODE %s %s %s %s", irc->mynick, irc->mynick, irc->myhost, 242 irc->channel, "-oo", irc->nick, irc->mynick ); 230 char* ret = set_eval_bool(set, value); 231 int b = bool2int(ret); 232 233 irc_write( irc, ":%s!%s@%s MODE %s %s %s", irc->mynick, irc->mynick, irc->myhost, 234 irc->channel, b?"+o":"-o", irc->mynick); 235 236 return ret; 237 } 238 239 char* set_eval_op_user( set_t *set, char* value ) 240 { 241 irc_t *irc = set->data; 242 char* ret = set_eval_bool(set, value); 243 int b = bool2int(ret); 244 245 irc_write( irc, ":%s!%s@%s MODE %s %s %s", irc->mynick, irc->mynick, irc->myhost, 246 irc->channel, b?"+o":"-o", irc->nick); 247 248 return ret; 249 } 250 251 /* generalized version of set_eval_op/voice_buddies */ 252 char *set_eval_mode_buddies( set_t *set, char *value, char modeflag ) 253 { 254 irc_t *irc = set->data; 255 char op[64], deop[64]; 256 int nop=0, ndeop=0; 257 user_t *u; 258 int mode; 259 260 if(!strcmp(value, "false")) 261 mode=0; 262 else if(!strcmp(value, "encrypted")) 263 mode=1; 264 else if(!strcmp(value, "trusted")) 265 mode=2; 266 else if(!strcmp(value, "notaway")) 267 mode=3; 243 268 else 244 269 return SET_INVALID; 245 270 271 /* sorry for calling them op/deop - too lazy for search+replace :P */ 272 op[0]='\0'; 273 deop[0]='\0'; 274 for(u=irc->users; u; u=u->next) { 275 /* we're only concerned with online buddies */ 276 if(!u->ic || !u->online) 277 continue; 278 279 /* just in case... */ 280 if(strlen(u->nick) >= 64) 281 continue; 282 283 /* dump out ops/deops when the corresponding name list fills up */ 284 if(strlen(op)+strlen(u->nick)+2 > 64) { 285 char *flags = g_strnfill(nop, modeflag); 286 irc_write( irc, ":%s!%s@%s MODE %s +%s%s", irc->mynick, irc->mynick, irc->myhost, 287 irc->channel, flags, op ); 288 op[0]='\0'; 289 nop=0; 290 g_free(flags); 291 } 292 if(strlen(deop)+strlen(u->nick)+2 > 64) { 293 char *flags = g_strnfill(ndeop, modeflag); 294 irc_write( irc, ":%s!%s@%s MODE %s -%s%s", irc->mynick, irc->mynick, irc->myhost, 295 irc->channel, flags, deop ); 296 deop[0]='\0'; 297 ndeop=0; 298 g_free(flags); 299 } 300 301 switch(mode) { 302 /* "false" */ 303 case 0: 304 g_strlcat(deop, " ", 64); 305 g_strlcat(deop, u->nick, 64); 306 ndeop++; 307 break; 308 /* "encrypted" */ 309 case 1: 310 if(u->encrypted) { 311 g_strlcat(op, " ", 64); 312 g_strlcat(op, u->nick, 64); 313 nop++; 314 } else { 315 g_strlcat(deop, " ", 64); 316 g_strlcat(deop, u->nick, 64); 317 ndeop++; 318 } 319 break; 320 /* "trusted" */ 321 case 2: 322 if(u->encrypted > 1) { 323 g_strlcat(op, " ", 64); 324 g_strlcat(op, u->nick, 64); 325 nop++; 326 } else { 327 g_strlcat(deop, " ", 64); 328 g_strlcat(deop, u->nick, 64); 329 ndeop++; 330 } 331 break; 332 /* "notaway" */ 333 case 3: 334 if(u->away) { 335 g_strlcat(deop, " ", 64); 336 g_strlcat(deop, u->nick, 64); 337 ndeop++; 338 } else { 339 g_strlcat(op, " ", 64); 340 g_strlcat(op, u->nick, 64); 341 nop++; 342 } 343 } 344 } 345 /* dump anything left in op/deop lists */ 346 if(*op) { 347 char *flags = g_strnfill(nop, modeflag); 348 irc_write( irc, ":%s!%s@%s MODE %s +%s%s", irc->mynick, irc->mynick, irc->myhost, 349 irc->channel, flags, op ); 350 g_free(flags); 351 } 352 if(*deop) { 353 char *flags = g_strnfill(ndeop, modeflag); 354 irc_write( irc, ":%s!%s@%s MODE %s -%s%s", irc->mynick, irc->mynick, irc->myhost, 355 irc->channel, flags, deop ); 356 g_free(flags); 357 } 358 246 359 return value; 247 360 } 361 362 char *set_eval_op_buddies( set_t *set, char *value ) 363 { 364 return set_eval_mode_buddies(set, value, 'o'); 365 } 366 367 char *set_eval_halfop_buddies( set_t *set, char *value ) 368 { 369 return set_eval_mode_buddies(set, value, 'h'); 370 } 371 372 char *set_eval_voice_buddies( set_t *set, char *value ) 373 { 374 return set_eval_mode_buddies(set, value, 'v'); 375 } 376 377 /* possible values: never, opportunistic, manual, always */ 378 char *set_eval_otr_policy( set_t *set, char *value ) 379 { 380 if ( !strcmp(value, "never") ) 381 return value; 382 if ( !strcmp(value, "opportunistic") ) 383 return value; 384 if ( !strcmp(value, "manual") ) 385 return value; 386 if ( !strcmp(value, "always") ) 387 return value; 388 return NULL; 389 } 390 -
set.h
rf4bcc22 r814aa52 100 100 /* Some not very generic evaluators that really shouldn't be here... */ 101 101 char *set_eval_to_char( set_t *set, char *value ); 102 char *set_eval_ops( set_t *set, char *value ); 102 char *set_eval_op_root( set_t *set, char *value ); 103 char *set_eval_op_user( set_t *set, char *value ); 104 char *set_eval_op_buddies( set_t *set, char *value ); 105 char *set_eval_halfop_buddies( set_t *set, char *value ); 106 char *set_eval_voice_buddies( set_t *set, char *value ); 107 char *set_eval_otr_policy( set_t *set, char *value ); 103 108 104 109 #endif /* __SET_H__ */ -
sock.h
rf4bcc22 r814aa52 16 16 #else 17 17 # include <winsock2.h> 18 # include <ws2tcpip.h> 18 # ifndef _MSC_VER 19 # include <ws2tcpip.h> 20 # endif 19 21 # if !defined(BITLBEE_CORE) && defined(_MSC_VER) 20 22 # pragma comment(lib,"bitlbee.lib") 21 23 # endif 22 24 # include <io.h> 25 # define read(a,b,c) recv(a,b,c,0) 26 # define write(a,b,c) send(a,b,c,0) 27 # define umask _umask 28 # define mode_t int 23 29 # define sock_make_nonblocking(fd) { int non_block = 1; ioctlsocket(fd, FIONBIO, &non_block); } 24 30 # define sock_make_blocking(fd) { int non_block = 0; ioctlsocket(fd, FIONBIO, &non_block); } -
storage.c
rf4bcc22 r814aa52 29 29 #include "bitlbee.h" 30 30 #include "crypting.h" 31 #include "otr.h" 31 32 32 33 extern storage_t storage_text; … … 116 117 117 118 status = st->load(irc, password); 118 if (status == STORAGE_OK) 119 if (status == STORAGE_OK) { 120 otr_load(irc); 119 121 return status; 120 122 } 121 123 if (status != STORAGE_NO_SUCH_USER) 122 124 return status; … … 139 141 return STORAGE_NO_SUCH_USER; 140 142 } 141 143 144 otr_save(irc); 142 145 st = ((storage_t *)global.storage->data)->save(irc, overwrite); 143 146 … … 165 168 ret = status; 166 169 } 170 if (ret == STORAGE_OK) { 171 otr_remove(nick); 172 } 167 173 168 174 return ret; … … 178 184 storage_t *primary_storage = gl->data; 179 185 irc_t *irc; 180 186 181 187 /* First, try to rename in the current write backend, assuming onick 182 188 * is stored there */ 183 189 status = primary_storage->rename(onick, nnick, password); 184 if (status != STORAGE_NO_SUCH_USER) 190 if (status != STORAGE_NO_SUCH_USER) { 191 otr_rename(onick, nnick); 185 192 return status; 193 } 186 194 187 195 /* Try to load from a migration backend and save to the current backend. … … 207 215 208 216 storage_remove(onick, password); 217 otr_rename(onick, nnick); 209 218 210 219 return STORAGE_OK; -
storage_text.c
rf4bcc22 r814aa52 27 27 #include "bitlbee.h" 28 28 #include "crypting.h" 29 #ifdef _WIN3230 # define umask _umask31 # define mode_t int32 #endif33 34 #ifndef F_OK35 #define F_OK 036 #endif37 29 38 30 static void text_init (void) -
unix.c
rf4bcc22 r814aa52 29 29 #include "base64.h" 30 30 #include "commands.h" 31 #include "crypting.h" 32 #include "otr.h" 31 33 #include "protocols/nogaim.h" 32 34 #include "help.h" 33 35 #include "ipc.h" 36 #include "lib/ssl_client.h" 34 37 #include "md5.h" 35 38 #include "misc.h" … … 63 66 b_main_init(); 64 67 nogaim_init(); 68 /* Ugly Note: libotr and gnutls both use libgcrypt. libgcrypt 69 has a process-global config state whose initialization happpens 70 twice if libotr and gnutls are used together. libotr installs custom 71 memory management functions for libgcrypt while our gnutls module 72 uses the defaults. Therefore we initialize OTR after SSL. *sigh* */ 73 ssl_init(); 74 otr_init(); 65 75 66 76 srand( time( NULL ) ^ getpid() ); -
user.h
rf4bcc22 r814aa52 38 38 char is_private; 39 39 char online; 40 char encrypted; 40 41 41 42 char *handle;
Note: See TracChangeset
for help on using the changeset viewer.