Changeset b308cf9
- Timestamp:
- 2010-06-05T23:21:02Z (14 years ago)
- Branches:
- master
- Children:
- 1fdb0a4
- Parents:
- 3ab1d31 (diff), e774815 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 16 added
- 1 deleted
- 64 edited
- 5 moved
Legend:
- Unmodified
- Added
- Removed
-
Makefile
r3ab1d31 rb308cf9 11 11 # Program variables 12 12 objects = account.o bitlbee.o chat.o dcc.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.hhelp.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.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/ft.h protocols/nogaim.h13 headers = account.h bitlbee.h commands.h conf.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/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/ft.h protocols/nogaim.h 14 14 subdirs = lib protocols 15 15 … … 82 82 install-dev: 83 83 mkdir -p $(DESTDIR)$(INCLUDEDIR) 84 install -m 0644 $(headers) $(DESTDIR)$(INCLUDEDIR) 84 install -m 0644 config.h $(DESTDIR)$(INCLUDEDIR) 85 for i in $(headers); do install -m 0644 $(SRCDIR)$$i $(DESTDIR)$(INCLUDEDIR); done 85 86 mkdir -p $(DESTDIR)$(PCDIR) 86 87 install -m 0644 bitlbee.pc $(DESTDIR)$(PCDIR) … … 93 94 install-etc: 94 95 mkdir -p $(DESTDIR)$(ETCDIR) 95 install -m 0644 motd.txt $(DESTDIR)$(ETCDIR)/motd.txt96 install -m 0644 bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf96 install -m 0644 $(SRCDIR)motd.txt $(DESTDIR)$(ETCDIR)/motd.txt 97 install -m 0644 $(SRCDIR)bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf 97 98 98 99 uninstall-etc: … … 110 111 @$(MAKE) -C $@ $(MAKECMDGOALS) 111 112 112 $(objects): %.o: %.c113 $(objects): %.o: $(SRCDIR)%.c 113 114 @echo '*' Compiling $< 114 115 @$(CC) -c $(CFLAGS) $< -o $@ … … 126 127 ctags: 127 128 ctags `find . -name "*.c"` `find . -name "*.h"` 129 130 # Using this as a bogus Make target to test if a GNU-compatible version of 131 # make is available. 132 helloworld: 133 @echo Hello World -
bitlbee.c
r3ab1d31 rb308cf9 36 36 static gboolean bitlbee_io_new_client( gpointer data, gint fd, b_input_condition condition ); 37 37 38 static gboolean try_listen( struct addrinfo *res ) 39 { 40 int i; 41 42 global.listen_socket = socket( res->ai_family, res->ai_socktype, res->ai_protocol ); 43 if( global.listen_socket < 0 ) 44 { 45 log_error( "socket" ); 46 return FALSE; 47 } 48 49 #ifdef IPV6_V6ONLY 50 if( res->ai_family == AF_INET6 ) 51 { 52 i = 0; 53 setsockopt( global.listen_socket, IPPROTO_IPV6, IPV6_V6ONLY, 54 (char *) &i, sizeof( i ) ); 55 } 56 #endif 57 58 /* TIME_WAIT (?) sucks.. */ 59 i = 1; 60 setsockopt( global.listen_socket, SOL_SOCKET, SO_REUSEADDR, &i, sizeof( i ) ); 61 62 i = bind( global.listen_socket, res->ai_addr, res->ai_addrlen ); 63 if( i == -1 ) 64 { 65 closesocket( global.listen_socket ); 66 global.listen_socket = -1; 67 68 log_error( "bind" ); 69 return FALSE; 70 } 71 72 return TRUE; 73 } 74 38 75 int bitlbee_daemon_init() 39 76 { … … 42 79 FILE *fp; 43 80 44 log_link( LOGLVL_ERROR, LOGOUTPUT_ SYSLOG);45 log_link( LOGLVL_WARNING, LOGOUTPUT_ SYSLOG);81 log_link( LOGLVL_ERROR, LOGOUTPUT_CONSOLE ); 82 log_link( LOGLVL_WARNING, LOGOUTPUT_CONSOLE ); 46 83 47 84 memset( &hints, 0, sizeof( hints ) ); … … 63 100 64 101 global.listen_socket = -1; 65 102 103 /* Try IPv6 first (which will become an IPv6+IPv4 socket). */ 66 104 for( res = addrinfo_bind; res; res = res->ai_next ) 67 { 68 global.listen_socket = socket( res->ai_family, res->ai_socktype, res->ai_protocol ); 69 if( global.listen_socket < 0 ) 70 continue; 71 72 /* TIME_WAIT (?) sucks.. */ 73 i = 1; 74 setsockopt( global.listen_socket, SOL_SOCKET, SO_REUSEADDR, &i, sizeof( i ) ); 75 76 i = bind( global.listen_socket, res->ai_addr, res->ai_addrlen ); 77 if( i == -1 ) 78 { 79 log_error( "bind" ); 80 return( -1 ); 81 } 82 83 break; 84 } 85 105 if( res->ai_family == AF_INET6 && try_listen( res ) ) 106 break; 107 108 /* The rest (so IPv4, I guess). */ 109 if( res == NULL ) 110 for( res = addrinfo_bind; res; res = res->ai_next ) 111 if( res->ai_family != AF_INET6 && try_listen( res ) ) 112 break; 113 86 114 freeaddrinfo( addrinfo_bind ); 87 115 … … 93 121 } 94 122 95 global.listen_watch_source_id = b_input_add( global.listen_socket, GAIM_INPUT_READ, bitlbee_io_new_client, NULL );123 global.listen_watch_source_id = b_input_add( global.listen_socket, B_EV_IO_READ, bitlbee_io_new_client, NULL ); 96 124 97 125 #ifndef _WIN32 … … 107 135 exit( 0 ); 108 136 137 setsid(); 109 138 chdir( "/" ); 110 139 … … 137 166 #endif 138 167 168 if( !global.conf->nofork ) 169 { 170 log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG ); 171 log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG ); 172 } 173 139 174 return( 0 ); 140 175 } … … 286 321 child->pid = client_pid; 287 322 child->ipc_fd = fds[0]; 288 child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );323 child->ipc_inpa = b_input_add( child->ipc_fd, B_EV_IO_READ, ipc_master_read, child ); 289 324 child_list = g_slist_append( child_list, child ); 290 325 … … 314 349 /* We can store the IPC fd there now. */ 315 350 global.listen_socket = fds[1]; 316 global.listen_watch_source_id = b_input_add( fds[1], GAIM_INPUT_READ, ipc_child_read, irc );351 global.listen_watch_source_id = b_input_add( fds[1], B_EV_IO_READ, ipc_child_read, irc ); 317 352 318 353 close( fds[0] ); -
bitlbee.h
r3ab1d31 rb308cf9 35 35 36 36 #define PACKAGE "BitlBee" 37 #define BITLBEE_VERSION "1.2. 5"37 #define BITLBEE_VERSION "1.2.6a" 38 38 #define VERSION BITLBEE_VERSION 39 #define BITLBEE_VER(a,b,c) (((a) << 16) + ((b) << 8) + (c)) 40 #define BITLBEE_VERSION_CODE BITLBEE_VER(1, 2, 6) 39 41 40 42 #define MAX_STRING 511 41 43 42 44 #if HAVE_CONFIG_H 43 #include "config.h"45 #include <config.h> 44 46 #endif 45 47 -
conf.c
r3ab1d31 rb308cf9 82 82 } 83 83 84 while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR:u: " ) ) >= 0 )84 while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR:u:V" ) ) >= 0 ) 85 85 /* ^^^^ Just to make sure we skip this step from the REHASH handler. */ 86 86 { … … 148 148 " -d Specify alternative user configuration directory\n" 149 149 " -x Command-line interface to password encryption/hashing\n" 150 " -h Show this help page.\n" ); 150 " -h Show this help page.\n" 151 " -V Show version info.\n" ); 152 return NULL; 153 } 154 else if( opt == 'V' ) 155 { 156 printf( "BitlBee %s\nAPI version %06x\n", 157 BITLBEE_VERSION, BITLBEE_VERSION_CODE ); 151 158 return NULL; 152 159 } -
configure
r3ab1d31 rb308cf9 26 26 oscar=1 27 27 yahoo=1 28 twitter=1 29 purple=0 28 30 29 31 debug=0 … … 66 68 --oscar=0/1 Disable/enable Oscar part (ICQ, AIM) $oscar 67 69 --yahoo=0/1 Disable/enable Yahoo part $yahoo 70 --twitter=0/1 Disable/enable Twitter part $twitter 71 72 --purple=0/1 Disable/enable libpurple support $purple 68 73 69 74 --debug=0/1 Disable/enable debugging $debug … … 119 124 EOF 120 125 126 srcdir="$(dirname $0)" 127 if [ "$srcdir" != "." ]; then 128 echo 129 echo "configure script run from a different directory. Will create some symlinks..." 130 if [ ! -e Makefile -o -L Makefile ]; then 131 COPYDIRS="doc lib protocols tests utils" 132 mkdir -p $(cd "$srcdir"; find $COPYDIRS -type d) 133 find . -name Makefile -type l -print0 | xargs -0 rm 2> /dev/null 134 dst="$PWD" 135 cd "$srcdir" 136 for i in $(find . -name Makefile -type f); do 137 ln -s "$PWD${i#.}" "$dst/$i"; 138 done 139 cd "$dst" 140 rm -rf .bzr 141 fi 142 143 echo "SRCDIR=$srcdir/" >> Makefile.settings 144 CFLAGS="$CFLAGS -I${dst}" 145 else 146 srcdir=$PWD 147 fi 148 121 149 cat<<EOF>config.h 122 150 /* BitlBee settings, generated by configure … … 156 184 157 185 echo CFLAGS=$CFLAGS >> Makefile.settings 158 echo CFLAGS+=-I `pwd` -I`pwd`/lib -I`pwd`/protocols -I. >> Makefile.settings186 echo CFLAGS+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols -I. >> Makefile.settings 159 187 160 188 echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings … … 267 295 detect_ldap() 268 296 { 269 TMPFILE=$(mktemp )297 TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) 270 298 if $CC -o $TMPFILE -shared -lldap 2>/dev/null >/dev/null; then 271 299 cat<<EOF>>Makefile.settings … … 295 323 detect_resolv_dynamic() 296 324 { 297 TMPFILE=$(mktemp )325 TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) 298 326 ret=1 299 327 echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -lresolv >/dev/null 2>/dev/null … … 309 337 detect_resolv_static() 310 338 { 311 TMPFILE=$(mktemp )339 TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) 312 340 ret=1 313 341 for i in $systemlibdirs; do … … 476 504 fi 477 505 506 if ! make helloworld > /dev/null 2>&1; then 507 echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles." 508 echo "BitlBee needs GNU make to build properly. On most systems GNU make is available" 509 echo "under the name 'gmake'." 510 echo 511 if gmake helloworld > /dev/null 2>&1; then 512 echo "gmake seems to be available on your machine, great." 513 echo 514 else 515 echo "gmake is not installed (or not working). Please try to install it." 516 echo 517 fi 518 fi 519 478 520 cat <<EOF>bitlbee.pc 479 521 prefix=$prefix … … 492 534 protoobjs='' 493 535 536 if [ "$purple" = 0 ]; then 537 echo '#undef WITH_PURPLE' >> config.h 538 else 539 if ! $PKG_CONFIG purple; then 540 echo 541 echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)' 542 exit 1 543 fi 544 echo '#define WITH_PURPLE' >> config.h 545 cat<<EOF>>Makefile.settings 546 EFLAGS += $($PKG_CONFIG purple --libs) 547 PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags) 548 EOF 549 protocols=$protocols'purple ' 550 protoobjs=$protoobjs'purple_mod.o ' 551 552 # Having both libpurple and native IM modules in one binary may 553 # do strange things. Let's not do that. 554 msn=0 555 jabber=0 556 oscar=0 557 yahoo=0 558 twitter=0 559 560 if [ "$events" = "libevent" ]; then 561 echo 562 echo 'Warning: Some libpurple modules (including msn-pecan) do their event handling' 563 echo 'outside libpurple, talking to GLib directly. At least for now the combination' 564 echo 'libpurple + libevent is *not* recommended!' 565 fi 566 fi 567 494 568 if [ "$msn" = 0 ]; then 495 569 echo '#undef WITH_MSN' >> config.h … … 524 598 fi 525 599 600 if [ "$twitter" = 0 ]; then 601 echo '#undef WITH_TWITTER' >> config.h 602 else 603 echo '#define WITH_TWITTER' >> config.h 604 protocols=$protocols'twitter ' 605 protoobjs=$protoobjs'twitter_mod.o ' 606 fi 607 526 608 if [ "$protocols" = "PROTOCOLS = " ]; then 527 609 echo "Warning: You haven't selected any communication protocol to compile!" -
dcc.c
r3ab1d31 rb308cf9 154 154 155 155 /* watch */ 156 df->watch_in = b_input_add( df->fd, GAIM_INPUT_READ, dccs_send_proto, df );156 df->watch_in = b_input_add( df->fd, B_EV_IO_READ, dccs_send_proto, df ); 157 157 158 158 df->ic->irc->file_transfers = g_slist_prepend( df->ic->irc->file_transfers, file ); … … 267 267 file_transfer_t *file = df->ft; 268 268 269 if( ( cond & GAIM_INPUT_READ ) &&269 if( ( cond & B_EV_IO_READ ) && 270 270 ( file->status & FT_STATUS_LISTENING ) ) 271 271 { … … 287 287 288 288 /* reschedule for reading on new fd */ 289 df->watch_in = b_input_add( fd, GAIM_INPUT_READ, dccs_send_proto, df );289 df->watch_in = b_input_add( fd, B_EV_IO_READ, dccs_send_proto, df ); 290 290 291 291 return FALSE; 292 292 } 293 293 294 if( cond & GAIM_INPUT_READ )294 if( cond & B_EV_IO_READ ) 295 295 { 296 296 int ret; … … 364 364 365 365 /* watch */ 366 df->watch_out = b_input_add( df->fd, GAIM_INPUT_WRITE, dccs_recv_proto, df );366 df->watch_out = b_input_add( df->fd, B_EV_IO_WRITE, dccs_recv_proto, df ); 367 367 ft->write_request = dccs_recv_write_request; 368 368 … … 377 377 file_transfer_t *ft = df->ft; 378 378 379 if( ( cond & GAIM_INPUT_WRITE ) &&379 if( ( cond & B_EV_IO_WRITE ) && 380 380 ( ft->status & FT_STATUS_CONNECTING ) ) 381 381 { 382 382 ft->status = FT_STATUS_TRANSFERRING; 383 383 384 //df->watch_in = b_input_add( df->fd, GAIM_INPUT_READ, dccs_recv_proto, df );384 //df->watch_in = b_input_add( df->fd, B_EV_IO_READ, dccs_recv_proto, df ); 385 385 386 386 df->watch_out = 0; … … 388 388 } 389 389 390 if( cond & GAIM_INPUT_READ )390 if( cond & B_EV_IO_READ ) 391 391 { 392 392 int ret, done; … … 445 445 return dcc_abort( df, "BUG: write_request() called while watching" ); 446 446 447 df->watch_in = b_input_add( df->fd, GAIM_INPUT_READ, dccs_recv_proto, df );447 df->watch_in = b_input_add( df->fd, B_EV_IO_READ, dccs_recv_proto, df ); 448 448 449 449 return TRUE; … … 488 488 489 489 if( df->bytes_sent < df->ft->file_size ) 490 df->watch_out = b_input_add( df->fd, GAIM_INPUT_WRITE, dccs_send_can_write, df );490 df->watch_out = b_input_add( df->fd, B_EV_IO_WRITE, dccs_send_can_write, df ); 491 491 492 492 return TRUE; -
debian/bitlbee-common.config
-
Property
mode
changed from
100755
to100644
-
Property
mode
changed from
-
debian/bitlbee.init
-
Property
mode
changed from
100755
to100644
r3ab1d31 rb308cf9 38 38 d_start() { 39 39 # Make sure BitlBee can actually write its PID... 40 touch /var/run/bitlbee.pid41 chown bitlbee: /var/run/bitlbee.pid40 touch $PIDFILE 41 chown bitlbee: $PIDFILE 42 42 43 43 start-stop-daemon --start --quiet --pidfile $PIDFILE \ -
Property
mode
changed from
-
debian/bitlbee.postinst
-
Property
mode
changed from
100755
to100644
-
Property
mode
changed from
-
debian/bitlbee.postrm
-
Property
mode
changed from
100755
to100644
-
Property
mode
changed from
-
debian/bitlbee.prerm
-
Property
mode
changed from
100755
to100644
-
Property
mode
changed from
-
debian/changelog
r3ab1d31 rb308cf9 1 bitlbee (1.3-0) unstable; urgency=low 2 3 * Setting some bogus version number, fix that later. 4 * Now using debhelper to improve maintainability. 5 * Added a bitlbee-libpurple package, and split off docs and stuff into 6 bitlbee-common. 7 8 -- Wilmer van der Gaast <wilmer@gaast.net> Sat, 05 Jun 2010 15:16:38 +0100 9 10 bitlbee (1.2.6a-1) unstable; urgency=low 11 12 * New upstream version. 13 * Native support for Twitter. 14 * Fixed /WHOIS response format. (Closes: #576120) 15 * Problems with bitlbee-skype are solved by now. (Closes: #575572) 16 17 -- Wilmer van der Gaast <wilmer@peer.gaast.net> Tue, 20 Apr 2010 00:34:51 +0200 18 1 19 bitlbee (1.2.5-1) unstable; urgency=low 2 20 -
debian/control
r3ab1d31 rb308cf9 4 4 Maintainer: Wilmer van der Gaast <wilmer@gaast.net> 5 5 Uploaders: Jelmer Vernooij <jelmer@samba.org> 6 Standards-Version: 3.8. 07 Build-Depends: libglib2.0-dev (>= 2.4), libevent-dev, libgnutls-dev | libnss-dev (>= 1.6), debconf-2.0, po-debconf6 Standards-Version: 3.8.4 7 Build-Depends: libglib2.0-dev (>= 2.4), libevent-dev, libgnutls-dev | libnss-dev (>= 1.6), po-debconf, libpurple-dev, debhelper (>= 7) 8 8 Homepage: http://www.bitlbee.org/ 9 9 Vcs-Bzr: http://code.bitlbee.org/bitlbee/ … … 12 12 Package: bitlbee 13 13 Architecture: any 14 Depends: ${shlibs:Depends}, adduser, net-tools, ${debconf-depends}, debianutils (>= 1.16) 15 Description: An IRC to other chat networks gateway 14 Depends: ${shlibs:Depends}, adduser, debianutils (>= 1.16), bitlbee-common (= ${bee:Version}) 15 Conflicts: bitlbee-libpurple 16 Replaces: bitlbee-libpurple 17 Description: An IRC to other chat networks gateway (default version) 16 18 This program can be used as an IRC server which forwards everything you 17 19 say to people on other chat networks: Jabber, ICQ, AIM, MSN and Yahoo. 18 20 21 Package: bitlbee-libpurple 22 Architecture: any 23 Depends: ${shlibs:Depends}, adduser, debianutils (>= 1.16), bitlbee-common (= ${bee:Version}) 24 Conflicts: bitlbee 25 Replaces: bitlbee 26 Description: An IRC to other chat networks gateway (using libpurple) 27 This program can be used as an IRC server which forwards everything you 28 say to people on other chat networks: Jabber, ICQ, AIM, MSN and Yahoo. 29 . 30 This package contains a version of BitlBee that uses the libpurple instant 31 messaging library instead of built-in code, which adds support for more IM 32 protocols (all protocols supported by Pidgin/Finch) and features (like file 33 transfers), at the price of being less lightweight. 34 . 35 This variant may not be very suitable for BitlBee instances used by many 36 (tens or hundreds) of clients. 37 38 Package: bitlbee-common 39 Architecture: all 40 Depends: ${misc:Depends}, net-tools 41 Replaces: bitlbee 42 Description: An IRC to other chat networks gateway (common files/docs) 43 This program can be used as an IRC server which forwards everything you 44 say to people on other chat networks: Jabber, ICQ, AIM, MSN and Yahoo. 45 . 46 This package contains common files (mostly documentation) for bitlbee and 47 bitlbee-libpurple. 48 19 49 Package: bitlbee-dev 20 50 Architecture: all 21 Depends: bitlbee (>= ${source:Version}), bitlbee (<< ${source:Version}.1~)22 Description: An IRC to other chat networks gateway 51 Depends: ${misc:Depends}, bitlbee (>= ${bee:Version}), bitlbee (<< ${bee:Version}.1~) 52 Description: An IRC to other chat networks gateway (dev files) 23 53 This program can be used as an IRC server which forwards everything you 24 54 say to people on other chat networks: Jabber, ICQ, AIM, MSN and Yahoo. -
debian/patches/bitlbee.conf.diff
r3ab1d31 rb308cf9 1 --- debian/bitlbee/etc/bitlbee/bitlbee.conf 2009-06-01 00:20:24.000000000 +01002 +++ debian/bitlbee/etc/bitlbee/bitlbee.conf 2009-06-07 21:16:19.000000000 +01001 --- bitlbee.conf 2009-06-01 00:20:24.000000000 +0100 2 +++ bitlbee.conf 2009-06-07 21:16:19.000000000 +0100 3 3 @@ -23,13 +23,18 @@ 4 4 ## If BitlBee is started by root as a daemon, it can drop root privileges, -
debian/po/POTFILES.in
r3ab1d31 rb308cf9 1 [type: gettext/rfc822deb] templates1 [type: gettext/rfc822deb] bitlbee-common.templates -
debian/rules
r3ab1d31 rb308cf9 1 1 #!/usr/bin/make -f 2 # 3 # Finally switching to debhelper. 4 # 5 # Not using debhelper was an exercise suggested to me by my AM (Gergely 6 # Nagy). It was educating at the time but I finally decided that the 7 # exercise is over now. 8 # 2 9 10 BITLBEE_CONFIGURE_FLAGS ?= 3 11 DEBUG ?= 0 4 12 5 ifdef BITLBEE_VERSION 6 BITLBEE_FORCE_VERSION=1 7 else 13 ifndef BITLBEE_VERSION 8 14 # Want to use the full package version number instead of just the release. 9 BITLBEE_VERSION ?= "$(shell dpkg-parsechangelog | grep ^Version: | awk '{print $$2}')" 10 export BITLBEE_VERSION 15 BITLBEE_CONFIGURE_VERSION ?= BITLBEE_VERSION=\"$(shell dpkg-parsechangelog | grep ^Version: | awk '{print $$2}')\" 11 16 endif 12 17 13 build-arch: build-arch-stamp 14 build-arch-stamp: 15 [ -d debian ] 16 ./configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --events=libevent 17 $(MAKE) 18 # $(MAKE) -C doc/ all 19 touch build-arch-stamp 18 build: build-stamp 19 build-stamp: 20 dh_testdir 21 22 mkdir -p debian/build-native 23 ROOT=$$PWD; cd debian/build-native; $(BITLBEE_CONFIGURE_VERSION) $$ROOT/configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --events=libevent $(BITLBEE_CONFIGURE_FLAGS) 24 $(MAKE) -C debian/build-native 25 26 mkdir -p debian/build-libpurple 27 ROOT=$$PWD; cd debian/build-libpurple; $(BITLBEE_CONFIGURE_VERSION) $$ROOT/configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --purple=1 $(BITLBEE_CONFIGURE_FLAGS) 28 $(MAKE) -C debian/build-libpurple 29 30 touch build-stamp 20 31 21 32 clean: 22 [ "`whoami`" = "root" -a -d debian ] 23 rm -rf build-arch-stamp debian/bitlbee debian/*.substvars debian/files debian/bitlbee-dev 33 dh_testdir 34 dh_testroot 35 rm -f build-stamp 36 37 rm -rf build-arch-stamp debian/build-* 24 38 $(MAKE) distclean 25 # -$(MAKE) -C doc/ clean26 27 39 28 install-arch: build-arch 29 [ "`whoami`" = "root" -a -d debian ] 30 mkdir -p debian/bitlbee/DEBIAN/ 31 $(MAKE) install install-etc DESTDIR=`pwd`/debian/bitlbee 40 dh_clean 32 41 33 mkdir -p debian/bitlbee/usr/share/doc/bitlbee/ 34 cp doc/user-guide/user-guide.txt debian/bitlbee/usr/share/doc/bitlbee/ 35 cp doc/user-guide/user-guide.html debian/bitlbee/usr/share/doc/bitlbee/ 42 install: build 43 dh_testdir 44 dh_testroot 45 dh_prep 46 dh_installdirs 36 47 37 install-indep: install-arch 38 [ "`whoami`" = "root" -a -d debian ] 39 mkdir -p debian/bitlbee-dev/DEBIAN/ 40 $(MAKE) install-dev DESTDIR=`pwd`/debian/bitlbee-dev 48 $(MAKE) -C debian/build-native install install-etc DESTDIR=`pwd`/debian/bitlbee 49 $(MAKE) -C debian/build-libpurple install install-etc DESTDIR=`pwd`/debian/bitlbee-libpurple 50 $(MAKE) -C debian/build-native install-dev DESTDIR=`pwd`/debian/bitlbee-dev 41 51 42 mkdir -p debian/bitlbee-dev/usr/share/doc/bitlbee-dev/ 52 patch debian/bitlbee/etc/bitlbee/bitlbee.conf debian/patches/bitlbee.conf.diff 53 patch debian/bitlbee-libpurple/etc/bitlbee/bitlbee.conf debian/patches/bitlbee.conf.diff 43 54 44 binary-arch: build-arch install-arch 45 [ "`whoami`" = "root" -a -d debian ] 55 mkdir -p debian/bitlbee-common/usr 56 mv debian/bitlbee/usr/share debian/bitlbee-common/usr 57 rm -rf debian/bitlbee-libpurple/usr/share 46 58 47 chmod 755 debian/post* debian/pre* debian/config debian/bitlbee.init 59 binary-common: 60 dh_testdir 61 dh_testroot 48 62 49 mkdir -p debian/bitlbee/usr/share/doc/bitlbee/examples/ debian/bitlbee/etc/init.d/ 50 -cp doc/RELEASE-SPEECH* debian/bitlbee/usr/share/doc/bitlbee/ && gzip -9 debian/bitlbee/usr/share/doc/bitlbee/RELEASE-SPEECH* 51 cp doc/CREDITS doc/AUTHORS doc/README doc/FAQ debian/README.Debian debian/bitlbee/usr/share/doc/bitlbee/ 52 cp debian/changelog debian/bitlbee/usr/share/doc/bitlbee/changelog.Debian 53 cp debian/copyright debian/bitlbee/usr/share/doc/bitlbee/copyright 54 cp doc/CHANGES debian/bitlbee/usr/share/doc/bitlbee/changelog 55 cp utils/* debian/bitlbee/usr/share/doc/bitlbee/examples/ 56 cp debian/bitlbee.init debian/bitlbee/etc/init.d/bitlbee 57 patch -p0 < debian/patches/bitlbee.conf.diff 58 cd debian/bitlbee/usr/share/; \ 59 gzip -9 doc/bitlbee/changelog.Debian doc/bitlbee/changelog doc/bitlbee/user-guide.txt \ 60 doc/bitlbee/examples/* man/man8/bitlbee.8 man/man5/bitlbee.conf.5 61 62 chown -R root:root debian/bitlbee/ 63 find debian/bitlbee/usr/share/ -type d -exec chmod 755 {} \; 64 find debian/bitlbee/usr/share/ -type f -exec chmod 644 {} \; 65 66 cp debian/prerm debian/bitlbee/DEBIAN/ 67 cp debian/postinst debian/bitlbee/DEBIAN/ 68 cp debian/postrm debian/bitlbee/DEBIAN/ 69 cp debian/config debian/bitlbee/DEBIAN/ 63 dh_installdocs --link-doc=bitlbee-common 64 dh_installchangelogs doc/CHANGES 65 dh_installexamples 66 dh_installdebconf 67 dh_installinit 68 ifeq ($(DH_OPTIONS),-a) 69 cp -a debian/bitlbee/etc debian/bitlbee-libpurple 70 endif 71 dh_installman 72 dh_strip 73 dh_link 74 dh_compress 75 dh_fixperms 76 dh_installdeb 77 ifeq ($(DH_OPTIONS),-a) 78 cp -a debian/bitlbee/DEBIAN/{post,pre}* debian/bitlbee-libpurple/DEBIAN 79 endif 80 dh_shlibdeps 81 ifdef BITLBEE_VERSION 82 echo source:Version=1:$(BITLBEE_VERSION)-0 > debian/substvars 83 dh_gencontrol -- -v1:$(BITLBEE_VERSION)-0 -Vbee:Version=1:$(BITLBEE_VERSION)-0 84 else 85 dh_gencontrol -- -Vbee:Version=$(shell dpkg-parsechangelog | grep ^Version: | awk '{print $$2}' | sed -e 's/+[^+]*$$//') 86 endif 87 dh_md5sums 88 dh_builddeb 70 89 71 po2debconf debian/templates > debian/bitlbee/DEBIAN/templates 72 cp debian/conffiles debian/bitlbee/DEBIAN/ 73 74 if [ "$(DEBUG)" = "0" ]; then strip -R .comment -R .note debian/bitlbee/usr/sbin/bitlbee; fi 90 binary-indep: build install 91 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common 75 92 76 cd debian/bitlbee; \ 77 find usr -type f -exec md5sum {} \; > DEBIAN/md5sums 78 dpkg-shlibdeps -Tdebian/bitlbee.substvars -dDepends debian/bitlbee/usr/sbin/bitlbee 79 ifdef BITLBEE_FORCE_VERSION 80 dpkg-gencontrol -ldebian/changelog -isp -pbitlbee -Tdebian/bitlbee.substvars -Pdebian/bitlbee -v1:$(BITLBEE_VERSION)-0 -V'debconf-depends=debconf (>= 1.2.0) | debconf-2.0' 81 else 82 dpkg-gencontrol -ldebian/changelog -isp -pbitlbee -Tdebian/bitlbee.substvars -Pdebian/bitlbee -V'debconf-depends=debconf (>= 1.2.0) | debconf-2.0' 83 endif 93 binary-arch: build install 94 $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common 84 95 85 dpkg --build debian/bitlbee .. 96 binary-%: build install 97 make -f debian/rules binary-common DH_OPTIONS=-p$* 86 98 87 binary-indep: install-indep 88 [ "`whoami`" = "root" -a -d debian ] 89 90 chown -R root.root debian/bitlbee-dev/ 91 find debian/bitlbee-dev/usr/share/ -type d -exec chmod 755 {} \; 92 find debian/bitlbee-dev/usr/share/ -type f -exec chmod 644 {} \; 93 94 cp debian/changelog debian/bitlbee-dev/usr/share/doc/bitlbee-dev/changelog.Debian 95 gzip -9 debian/bitlbee-dev/usr/share/doc/bitlbee-dev/changelog.Debian 96 cp debian/copyright debian/bitlbee-dev/usr/share/doc/bitlbee-dev/copyright 97 98 cd debian/bitlbee-dev; \ 99 find usr -type f -exec md5sum {} \; > DEBIAN/md5sums 100 101 dpkg-gencontrol -ldebian/changelog -isp -pbitlbee-dev -Pdebian/bitlbee-dev 102 103 dpkg --build debian/bitlbee-dev .. 104 105 binary: binary-arch binary-indep 106 build: build-arch 107 install: install-arch install-indep 108 109 .PHONY: build-arch build clean binary-arch binary install-arch install binary-indep install-indep 99 binary: binary-indep binary-arch 100 .PHONY: build clean binary-indep binary-arch binary-common binary install -
doc/CHANGES
r3ab1d31 rb308cf9 3 3 4 4 http://bugs.bitlbee.org/bitlbee/timeline?daysback=90&changeset=on 5 6 Version 1.2.6a: 7 - Fixed a typo that renders the Twitter groupchat mode unusable. A last- 8 minute change that came a few minutes late. 9 10 Finished 19 Apr 2010 11 12 Version 1.2.6: 13 - Native (very basic) support for Twitter, implemented by Geert Mulders. 14 Currently supported are posting tweets, reading the ones of people you 15 follow, and sending (not yet receiving!) direct messages. 16 - Fixed format of status messages in /WHOIS to improve IRC client 17 compatibility. 18 - Show timestamps of offline messages/channel backlogs. 19 - Allow saving MSN display names locally since sometimes this stuff breaks 20 server-side. (Use the local_display_name per-account setting.) 21 - Suppress empty "Headline:" messages for certain new XMPP broadcast 22 messages. 23 - Better handling of XMPP contacts with multiple resources on-line. Default 24 behaviour now is to write to wherever the last message came from, or to 25 the bare JID (usually becomes a broadcast) if there wasn't any recent msg. 26 - Added a switchboard_keepalives setting which should solve some issues with 27 talking to offline MSN contacts. (Although full support for offline 28 messages is not ready yet!) 29 - The usual misc. bug fixes. 30 31 Finished 19 Apr 2010 5 32 6 33 Version 1.2.5: … … 23 50 the main client). 24 51 25 Fi xed 17 Mar 201052 Finished 17 Mar 2010 26 53 27 54 Version 1.2.4: -
doc/Makefile
r3ab1d31 rb308cf9 1 1 -include ../Makefile.settings 2 ifdef SRCDIR 3 SRCDIR := $(SRCDIR)doc/ 4 endif 2 5 3 6 all: … … 7 10 install: 8 11 mkdir -p $(DESTDIR)$(MANDIR)/man8/ $(DESTDIR)$(MANDIR)/man5/ 9 install -m 0644 bitlbee.8 $(DESTDIR)$(MANDIR)/man8/10 install -m 0644 bitlbee.conf.5 $(DESTDIR)$(MANDIR)/man5/12 install -m 0644 $(SRCDIR)bitlbee.8 $(DESTDIR)$(MANDIR)/man8/ 13 install -m 0644 $(SRCDIR)bitlbee.conf.5 $(DESTDIR)$(MANDIR)/man5/ 11 14 $(MAKE) -C user-guide $@ 12 15 -
doc/user-guide/Makefile
r3ab1d31 rb308cf9 1 1 -include ../../Makefile.settings 2 ifdef SRCDIR 3 SRCDIR := $(SRCDIR)doc/user-guide/ 4 endif 5 2 6 EXTRAPARANEWLINE = 1 3 7 # EXTRAPARANEWLINE = 0 … … 38 42 chmod 0755 $(DESTDIR)$(DATADIR) 39 43 rm -f $(DESTDIR)$(DATADIR)/help.txt # Prevent help function from breaking in running sessions 40 install -m 0644 help.txt $(DESTDIR)$(DATADIR)/help.txt44 install -m 0644 $(SRCDIR)help.txt $(DESTDIR)$(DATADIR)/help.txt 41 45 42 46 uninstall: -
doc/user-guide/commands.xml
r3ab1d31 rb308cf9 21 21 <description> 22 22 <para> 23 Adds an account on the given server with the specified protocol, username and password to the account list. Supported protocols right now are: Jabber, MSN, OSCAR (AIM/ICQ) and Yahoo. For more information about adding an account, see <emphasis>help account add <protocol></emphasis>.23 Adds an account on the given server with the specified protocol, username and password to the account list. Supported protocols right now are: Jabber, MSN, OSCAR (AIM/ICQ), Yahoo and Twitter. For more information about adding an account, see <emphasis>help account add <protocol></emphasis>. 24 24 </para> 25 25 </description> … … 63 63 </ircexample> 64 64 </bitlbee-command> 65 66 <bitlbee-command name="twitter"> 67 <syntax>account add twitter <handle> <password></syntax> 68 69 <description> 70 <para> 71 This module gives you simple access to Twitter. Although it uses the Twitter API, only Twitter itself is supported at the moment. 72 </para> 73 74 <para> 75 By default all your Twitter contacts will come from a contact called twitter_(yourusername). You can change this behaviour using the <emphasis>mode</emphasis> setting (see <emphasis>help set mode</emphasis>). 76 </para> 77 78 <para> 79 To send tweets yourself, send them to the twitter_(yourusername) contact, or just write in the groupchat channel if you enabled that option. 80 </para> 81 82 <para> 83 Since Twitter now requires OAuth authentication, you should not enter your Twitter password into BitlBee. Just type a bogus password. The first time you log in, BitlBee will start OAuth authentication. (See <emphasis>help set oauth</emphasis>.) 84 </para> 85 </description> 86 </bitlbee-command> 65 87 66 88 <bitlbee-command name="yahoo"> … … 401 423 402 424 <bitlbee-setting name="auto_reconnect" type="boolean" scope="both"> 403 <default> false</default>425 <default>true</default> 404 426 405 427 <description> … … 556 578 <para> 557 579 With this option enabled, root will inform you when someone in your buddy list changes his/her "friendly name". 580 </para> 581 </description> 582 </bitlbee-setting> 583 584 <bitlbee-setting name="display_timestamps" type="boolean" scope="global"> 585 <default>true</default> 586 587 <description> 588 <para> 589 When incoming messages are old (i.e. offline messages and channel backlogs), BitlBee will prepend them with a timestamp. If you find them ugly or useless, you can use this setting to hide them. 558 590 </para> 559 591 </description> … … 609 641 </bitlbee-setting> 610 642 643 <bitlbee-setting name="local_display_name" type="boolean" scope="account"> 644 <default>false</default> 645 646 <description> 647 <para> 648 Mostly meant to work around a bug in MSN servers (forgetting the display name set by the user), this setting tells BitlBee to store your display name locally and set this name on the MSN servers when connecting. 649 </para> 650 </description> 651 652 </bitlbee-setting> 653 611 654 <bitlbee-setting name="mail_notifications" type="boolean" scope="account"> 612 655 <default>false</default> … … 615 658 <para> 616 659 Some protocols (MSN, Yahoo!) can notify via IM about new e-mail. Since most people use their Hotmail/Yahoo! addresses as a spam-box, this is disabled default. If you want these notifications, you can enable this setting. 660 </para> 661 </description> 662 663 </bitlbee-setting> 664 665 <bitlbee-setting name="message_length" type="integer" scope="account"> 666 <default>140</default> 667 668 <description> 669 <para> 670 Since Twitter rejects messages longer than 140 characters, BitlBee can count message length and emit a warning instead of waiting for Twitter to reject it. 671 </para> 672 673 <para> 674 You can change this limit here but this won't disable length checks on Twitter's side. You can also set it to 0 to disable the check in case you believe BitlBee doesn't count the characters correctly. 675 </para> 676 </description> 677 678 </bitlbee-setting> 679 680 <bitlbee-setting name="mode" type="string" scope="account"> 681 <possible-values>one, many, chat</possible-values> 682 <default>one</default> 683 684 <description> 685 <para> 686 By default, everything from the Twitter module will come from one nick, twitter_(yourusername). If you prefer to have individual nicks for everyone, you can set this setting to "many" instead. 687 </para> 688 689 <para> 690 If you prefer to have all your Twitter things in a separate channel, you can set this setting to "chat". 691 </para> 692 693 <para> 694 In the last two modes, you can send direct messages by /msg'ing your contacts directly. Note, however, that incoming DMs are not fetched yet. 617 695 </para> 618 696 </description> … … 644 722 </bitlbee-setting> 645 723 724 <bitlbee-setting name="oauth" type="boolean" scope="account"> 725 <default>true</default> 726 727 <description> 728 <para> 729 This enables OAuth authentication for Twitter accounts. From June 2010 this will be mandatory. 730 </para> 731 732 <para> 733 With OAuth enabled, you shouldn't tell BitlBee your Twitter password. Just add your account with a bogus password and type <emphasis>account on</emphasis>. BitlBee will then give you a URL to authenticate with Twitter. If this succeeds, Twitter will return a PIN code which you can give back to BitlBee to finish the process. 734 </para> 735 736 <para> 737 The resulting access token will be saved permanently, so you have to do this only once. 738 </para> 739 </description> 740 741 </bitlbee-setting> 742 646 743 <bitlbee-setting name="ops" type="string" scope="global"> 647 744 <default>both</default> … … 779 876 </bitlbee-setting> 780 877 878 <bitlbee-setting name="show_offline" type="boolean" scope="global"> 879 <default>false</default> 880 881 <description> 882 <para> 883 If enabled causes BitlBee to also show offline users in Channel. Online-users will get op, away-users voice and offline users none of both. This option takes effect as soon as you reconnect. 884 </para> 885 </description> 886 </bitlbee-setting> 887 781 888 <bitlbee-setting name="simulate_netsplit" type="boolean" scope="global"> 782 889 <default>true</default> … … 824 931 <para> 825 932 If BitlBee fails to detect this sometimes (most likely in AIM messages over an ICQ connection), you can set this setting to <emphasis>always</emphasis>, but this might sometimes accidentally strip non-HTML things too. 933 </para> 934 </description> 935 </bitlbee-setting> 936 937 <bitlbee-setting name="switchboard_keepalives" type="boolean" scope="account"> 938 <default>false</default> 939 940 <description> 941 <para> 942 Turn on this flag if you have difficulties talking to offline/invisible contacts. 943 </para> 944 945 <para> 946 With this setting enabled, BitlBee will send keepalives to MSN switchboards with offline/invisible contacts every twenty seconds. This should keep the server and client on the other side from shutting it down. 947 </para> 948 949 <para> 950 This is useful because BitlBee doesn't support MSN offline messages yet and the MSN servers won't let the user reopen switchboards to offline users. Once offline messaging is supported, this flag might be removed. 951 </para> 952 </description> 953 </bitlbee-setting> 954 955 <bitlbee-setting name="timezone" type="string" scope="global"> 956 <default>local</default> 957 <possible-values>local, utc, gmt, timezone-spec</possible-values> 958 959 <description> 960 <para> 961 If message timestamps are available for offline messages or chatroom backlogs, BitlBee will display them as part of the message. By default it will use the local timezone. If you're not in the same timezone as the BitlBee server, you can adjust the timestamps using this setting. 962 </para> 963 964 <para> 965 Values local/utc/gmt should be self-explanatory. timezone-spec is a time offset in hours:minutes, for example: -8 for Pacific Standard Time, +2 for Central European Summer Time, +5:30 for Indian Standard Time. 826 966 </para> 827 967 </description> -
help.c
r3ab1d31 rb308cf9 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-200 5Wilmer van der Gaast and others *4 * Copyright 2002-2009 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 169 169 return NULL; 170 170 } 171 172 int help_add_mem( help_t **help, const char *title, const char *content ) 173 { 174 help_t *h, *l = NULL; 175 176 for( h = *help; h; h = h->next ) 177 { 178 if( g_strcasecmp( h->title, title ) == 0 ) 179 return 0; 180 181 l = h; 182 } 183 184 if( l ) 185 h = l->next = g_new0( struct help, 1 ); 186 else 187 *help = h = g_new0( struct help, 1 ); 188 h->fd = -1; 189 h->title = g_strdup( title ); 190 h->length = strlen( content ); 191 h->offset.mem_offset = g_strdup( content ); 192 193 return 1; 194 } -
help.h
r3ab1d31 rb308cf9 46 46 void help_free( help_t **help ); 47 47 char *help_get( help_t **help, char *title ); 48 int help_add_mem( help_t **help, const char *title, const char *content_ ); 48 49 49 50 #endif -
ipc.c
r3ab1d31 rb308cf9 514 514 } 515 515 516 child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );516 child->ipc_inpa = b_input_add( child->ipc_fd, B_EV_IO_READ, ipc_master_read, child ); 517 517 518 518 child_list = g_slist_append( child_list, child ); … … 552 552 } 553 553 554 b_input_add( serversock, GAIM_INPUT_READ, new_ipc_client, NULL );554 b_input_add( serversock, B_EV_IO_READ, new_ipc_client, NULL ); 555 555 556 556 return 1; … … 597 597 return 0; 598 598 } 599 child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );599 child->ipc_inpa = b_input_add( child->ipc_fd, B_EV_IO_READ, ipc_master_read, child ); 600 600 601 601 child_list = g_slist_append( child_list, child ); -
irc.c
r3ab1d31 rb308cf9 52 52 { 53 53 irc_t *irc = set->data; 54 char *test; 55 gsize test_bytes = 0; 54 56 GIConv ic, oc; 55 57 … … 57 59 value = g_strdup( "utf-8" ); 58 60 61 if( ( oc = g_iconv_open( value, "utf-8" ) ) == (GIConv) -1 ) 62 { 63 return NULL; 64 } 65 66 /* Do a test iconv to see if the user picked an IRC-compatible 67 charset (for example utf-16 goes *horribly* wrong). */ 68 if( ( test = g_convert_with_iconv( " ", 1, oc, NULL, &test_bytes, NULL ) ) == NULL || 69 test_bytes > 1 ) 70 { 71 g_free( test ); 72 g_iconv_close( oc ); 73 irc_usermsg( irc, "Unsupported character set: The IRC protocol " 74 "only supports 8-bit character sets." ); 75 return NULL; 76 } 77 g_free( test ); 78 59 79 if( ( ic = g_iconv_open( "utf-8", value ) ) == (GIConv) -1 ) 60 80 { 61 return NULL; 62 } 63 if( ( oc = g_iconv_open( value, "utf-8" ) ) == (GIConv) -1 ) 64 { 65 g_iconv_close( ic ); 81 g_iconv_close( oc ); 66 82 return NULL; 67 83 } … … 109 125 sock_make_nonblocking( irc->fd ); 110 126 111 irc->r_watch_source_id = b_input_add( irc->fd, GAIM_INPUT_READ, bitlbee_io_current_client_read, irc );127 irc->r_watch_source_id = b_input_add( irc->fd, B_EV_IO_READ, bitlbee_io_current_client_read, irc ); 112 128 113 129 irc->status = USTATUS_OFFLINE; … … 175 191 s = set_add( &irc->set, "default_target", "root", NULL, irc ); 176 192 s = set_add( &irc->set, "display_namechanges", "false", set_eval_bool, irc ); 193 s = set_add( &irc->set, "display_timestamps", "true", set_eval_bool, irc ); 177 194 s = set_add( &irc->set, "handle_unknown", "root", NULL, irc ); 178 195 s = set_add( &irc->set, "lcnicks", "true", set_eval_bool, irc ); … … 184 201 s = set_add( &irc->set, "root_nick", irc->mynick, set_eval_root_nick, irc ); 185 202 s = set_add( &irc->set, "save_on_quit", "true", set_eval_bool, irc ); 203 s = set_add( &irc->set, "show_offline", "false", set_eval_bool, irc ); 186 204 s = set_add( &irc->set, "simulate_netsplit", "true", set_eval_bool, irc ); 187 205 s = set_add( &irc->set, "status", NULL, set_eval_away_status, irc ); 188 206 s->flags |= SET_NULL_OK; 189 207 s = set_add( &irc->set, "strip_html", "true", NULL, irc ); 208 s = set_add( &irc->set, "timezone", "local", set_eval_timezone, irc ); 190 209 s = set_add( &irc->set, "to_char", ": ", set_eval_to_char, irc ); 191 210 s = set_add( &irc->set, "typing_notice", "false", set_eval_bool, irc ); … … 195 214 /* Evaluator sets the iconv/oconv structures. */ 196 215 set_eval_charset( set_find( &irc->set, "charset" ), set_getstr( &irc->set, "charset" ) ); 216 217 nogaim_init(); 197 218 198 219 return( irc ); … … 677 698 in the event queue. */ 678 699 /* Really can't be done as long as the code doesn't do error checking very well: 679 if( bitlbee_io_current_client_write( irc, irc->fd, GAIM_INPUT_WRITE ) ) */700 if( bitlbee_io_current_client_write( irc, irc->fd, B_EV_IO_WRITE ) ) */ 680 701 681 702 /* So just always do it via the event handler. */ 682 irc->w_watch_source_id = b_input_add( irc->fd, GAIM_INPUT_WRITE, bitlbee_io_current_client_write, irc );703 irc->w_watch_source_id = b_input_add( irc->fd, B_EV_IO_WRITE, bitlbee_io_current_client_write, irc ); 683 704 } 684 705 … … 706 727 if( now ) 707 728 { 708 bitlbee_io_current_client_write( irc, irc->fd, GAIM_INPUT_WRITE );729 bitlbee_io_current_client_write( irc, irc->fd, B_EV_IO_WRITE ); 709 730 } 710 731 temp = temp->next; -
irc_commands.c
r3ab1d31 rb308cf9 498 498 irc_reply( irc, 301, "%s :%s", u->nick, u->away ); 499 499 if( u->status_msg ) 500 irc_reply( irc, 3 33, "%s :Status:%s", u->nick, u->status_msg );500 irc_reply( irc, 320, "%s :%s", u->nick, u->status_msg ); 501 501 502 502 irc_reply( irc, 318, "%s :End of /WHOIS list", nick ); -
lib/Makefile
r3ab1d31 rb308cf9 8 8 9 9 -include ../Makefile.settings 10 ifdef SRCDIR 11 SRCDIR := $(SRCDIR)lib/ 12 endif 10 13 11 14 # [SH] Program variables 12 objects = arc.o base64.o $(EVENT_HANDLER) http_client.o ini.o md5.o misc.o proxy.o sha1.o $(SSL_CLIENT) url.o xmltree.o ftutil.o15 objects = arc.o base64.o $(EVENT_HANDLER) ftutil.o http_client.o ini.o md5.o misc.o oauth.o proxy.o sha1.o $(SSL_CLIENT) url.o xmltree.o 13 16 14 17 CFLAGS += -Wall … … 37 40 $(objects): ../Makefile.settings Makefile 38 41 39 $(objects): %.o: %.c42 $(objects): %.o: $(SRCDIR)%.c 40 43 @echo '*' Compiling $< 41 44 @$(CC) -c $(CFLAGS) $< -o $@ -
lib/events.h
r3ab1d31 rb308cf9 48 48 the given callback function. */ 49 49 typedef enum { 50 GAIM_INPUT_READ = 1 << 1, 51 GAIM_INPUT_WRITE = 1 << 2 50 B_EV_IO_READ = 1 << 0, 51 B_EV_IO_WRITE = 1 << 1, 52 B_EV_FLAG_FORCE_ONCE = 1 << 16, 53 B_EV_FLAG_FORCE_REPEAT = 1 << 17, 52 54 } b_input_condition; 53 55 typedef gboolean (*b_event_handler)(gpointer data, gint fd, b_input_condition cond); -
lib/events_glib.c
r3ab1d31 rb308cf9 49 49 b_event_handler function; 50 50 gpointer data; 51 guint flags; 51 52 } GaimIOClosure; 52 53 … … 76 77 77 78 if (condition & GAIM_READ_COND) 78 gaim_cond |= GAIM_INPUT_READ;79 gaim_cond |= B_EV_IO_READ; 79 80 if (condition & GAIM_WRITE_COND) 80 gaim_cond |= GAIM_INPUT_WRITE;81 gaim_cond |= B_EV_IO_WRITE; 81 82 82 83 event_debug( "gaim_io_invoke( %d, %d, 0x%x )\n", g_io_channel_unix_get_fd(source), condition, data ); … … 87 88 event_debug( "Returned FALSE, cancelling.\n" ); 88 89 89 return st; 90 if (closure->flags & B_EV_FLAG_FORCE_ONCE) 91 return FALSE; 92 else if (closure->flags & B_EV_FLAG_FORCE_REPEAT) 93 return TRUE; 94 else 95 return st; 90 96 } 91 97 … … 105 111 closure->function = function; 106 112 closure->data = data; 113 closure->flags = condition; 107 114 108 if (condition & GAIM_INPUT_READ)115 if (condition & B_EV_IO_READ) 109 116 cond |= GAIM_READ_COND; 110 if (condition & GAIM_INPUT_WRITE)117 if (condition & B_EV_IO_WRITE) 111 118 cond |= GAIM_WRITE_COND; 112 119 -
lib/events_libevent.c
r3ab1d31 rb308cf9 60 60 b_event_handler function; 61 61 void *data; 62 guint flags; 62 63 }; 63 64 … … 126 127 { 127 128 if( event & EV_READ ) 128 cond |= GAIM_INPUT_READ;129 cond |= B_EV_IO_READ; 129 130 if( event & EV_WRITE ) 130 cond |= GAIM_INPUT_WRITE;131 cond |= B_EV_IO_WRITE; 131 132 } 132 133 … … 150 151 return; 151 152 } 152 else if( !st )153 else if( !st && !( b_ev->flags & B_EV_FLAG_FORCE_REPEAT ) ) 153 154 { 154 155 event_debug( "Handler returned FALSE: " ); … … 174 175 event_debug( "b_input_add( %d, %d, 0x%x, 0x%x ) ", fd, condition, function, data ); 175 176 176 if( ( condition & GAIM_INPUT_READ && ( b_ev = g_hash_table_lookup( read_hash, &fd ) ) ) ||177 ( condition & GAIM_INPUT_WRITE && ( b_ev = g_hash_table_lookup( write_hash, &fd ) ) ) )177 if( ( condition & B_EV_IO_READ && ( b_ev = g_hash_table_lookup( read_hash, &fd ) ) ) || 178 ( condition & B_EV_IO_WRITE && ( b_ev = g_hash_table_lookup( write_hash, &fd ) ) ) ) 178 179 { 179 180 /* We'll stick with this libevent entry, but give it a new BitlBee id. */ … … 198 199 199 200 out_cond = EV_PERSIST; 200 if( condition & GAIM_INPUT_READ )201 if( condition & B_EV_IO_READ ) 201 202 out_cond |= EV_READ; 202 if( condition & GAIM_INPUT_WRITE )203 if( condition & B_EV_IO_WRITE ) 203 204 out_cond |= EV_WRITE; 204 205 … … 212 213 } 213 214 215 b_ev->flags = condition; 214 216 g_hash_table_insert( id_hash, &b_ev->id, b_ev ); 215 217 return b_ev->id; -
lib/http_client.c
r3ab1d31 rb308cf9 149 149 if( req->bytes_written < req->request_length ) 150 150 req->inpa = b_input_add( source, 151 req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_WRITE,151 req->ssl ? ssl_getdirection( req->ssl ) : B_EV_IO_WRITE, 152 152 http_connected, req ); 153 153 else 154 req->inpa = b_input_add( source, GAIM_INPUT_READ, http_incoming_data, req );154 req->inpa = b_input_add( source, B_EV_IO_READ, http_incoming_data, req ); 155 155 156 156 return FALSE; … … 234 234 /* There will be more! */ 235 235 req->inpa = b_input_add( req->fd, 236 req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_READ,236 req->ssl ? ssl_getdirection( req->ssl ) : B_EV_IO_READ, 237 237 http_incoming_data, req ); 238 238 -
lib/misc.c
r3ab1d31 rb308cf9 77 77 78 78 return mktime(&tm); 79 } 80 81 time_t mktime_utc( struct tm *tp ) 82 { 83 struct tm utc; 84 time_t res, tres; 85 86 tp->tm_isdst = -1; 87 res = mktime( tp ); 88 /* Problem is, mktime() just gave us the GMT timestamp for the 89 given local time... While the given time WAS NOT local. So 90 we should fix this now. 91 92 Now I could choose between messing with environment variables 93 (kludgy) or using timegm() (not portable)... Or doing the 94 following, which I actually prefer... 95 96 tzset() may also work but in other places I actually want to 97 use local time. 98 99 FFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUU!! */ 100 gmtime_r( &res, &utc ); 101 utc.tm_isdst = -1; 102 if( utc.tm_hour == tp->tm_hour && utc.tm_min == tp->tm_min ) 103 /* Sweet! We're in UTC right now... */ 104 return res; 105 106 tres = mktime( &utc ); 107 res += res - tres; 108 109 /* Yes, this is a hack. And it will go wrong around DST changes. 110 BUT this is more likely to be threadsafe than messing with 111 environment variables, and possibly more portable... */ 112 113 return res; 79 114 } 80 115 … … 271 306 for( i = j = 0; t[i]; i ++, j ++ ) 272 307 { 273 /* if( t[i] <= ' ' || ((unsigned char *)t)[i] >= 128 || t[i] == '%' ) */ 274 if( !isalnum( t[i] ) ) 308 if( !isalnum( t[i] ) && !strchr( "._-~", t[i] ) ) 275 309 { 276 310 sprintf( s + j, "%%%02X", ((unsigned char*)t)[i] ); -
lib/misc.h
r3ab1d31 rb308cf9 43 43 44 44 G_MODULE_EXPORT time_t get_time( int year, int month, int day, int hour, int min, int sec ); 45 G_MODULE_EXPORT time_t mktime_utc( struct tm *tp ); 45 46 double gettime( void ); 46 47 -
lib/proxy.c
r3ab1d31 rb308cf9 91 91 b_event_remove(phb->inpa); 92 92 if( phb->proxy_func ) 93 phb->proxy_func(phb->proxy_data, -1, GAIM_INPUT_READ);93 phb->proxy_func(phb->proxy_data, -1, B_EV_IO_READ); 94 94 else { 95 phb->func(phb->data, -1, GAIM_INPUT_READ);95 phb->func(phb->data, -1, B_EV_IO_READ); 96 96 g_free(phb); 97 97 } … … 102 102 b_event_remove(phb->inpa); 103 103 if( phb->proxy_func ) 104 phb->proxy_func(phb->proxy_data, source, GAIM_INPUT_READ);104 phb->proxy_func(phb->proxy_data, source, B_EV_IO_READ); 105 105 else { 106 phb->func(phb->data, source, GAIM_INPUT_READ);106 phb->func(phb->data, source, B_EV_IO_READ); 107 107 g_free(phb); 108 108 } … … 147 147 return -1; 148 148 } else { 149 phb->inpa = b_input_add(fd, GAIM_INPUT_WRITE, gaim_io_connected, phb);149 phb->inpa = b_input_add(fd, B_EV_IO_WRITE, gaim_io_connected, phb); 150 150 phb->fd = fd; 151 151 … … 179 179 if ((memcmp(HTTP_GOODSTRING, inputline, strlen(HTTP_GOODSTRING)) == 0) || 180 180 (memcmp(HTTP_GOODSTRING2, inputline, strlen(HTTP_GOODSTRING2)) == 0)) { 181 phb->func(phb->data, source, GAIM_INPUT_READ);181 phb->func(phb->data, source, B_EV_IO_READ); 182 182 g_free(phb->host); 183 183 g_free(phb); … … 186 186 187 187 close(source); 188 phb->func(phb->data, -1, GAIM_INPUT_READ);188 phb->func(phb->data, -1, B_EV_IO_READ); 189 189 g_free(phb->host); 190 190 g_free(phb); … … 204 204 if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { 205 205 close(source); 206 phb->func(phb->data, -1, GAIM_INPUT_READ);206 phb->func(phb->data, -1, B_EV_IO_READ); 207 207 g_free(phb->host); 208 208 g_free(phb); … … 215 215 if (send(source, cmd, strlen(cmd), 0) < 0) { 216 216 close(source); 217 phb->func(phb->data, -1, GAIM_INPUT_READ);217 phb->func(phb->data, -1, B_EV_IO_READ); 218 218 g_free(phb->host); 219 219 g_free(phb); … … 230 230 if (send(source, cmd, strlen(cmd), 0) < 0) { 231 231 close(source); 232 phb->func(phb->data, -1, GAIM_INPUT_READ);232 phb->func(phb->data, -1, B_EV_IO_READ); 233 233 g_free(phb->host); 234 234 g_free(phb); … … 240 240 if (send(source, cmd, strlen(cmd), 0) < 0) { 241 241 close(source); 242 phb->func(phb->data, -1, GAIM_INPUT_READ);243 g_free(phb->host); 244 g_free(phb); 245 return FALSE; 246 } 247 248 phb->inpa = b_input_add(source, GAIM_INPUT_READ, http_canread, phb);242 phb->func(phb->data, -1, B_EV_IO_READ); 243 g_free(phb->host); 244 g_free(phb); 245 return FALSE; 246 } 247 248 phb->inpa = b_input_add(source, B_EV_IO_READ, http_canread, phb); 249 249 250 250 return FALSE; … … 273 273 memset(packet, 0, sizeof(packet)); 274 274 if (read(source, packet, 9) >= 4 && packet[1] == 90) { 275 phb->func(phb->data, source, GAIM_INPUT_READ);275 phb->func(phb->data, source, B_EV_IO_READ); 276 276 g_free(phb->host); 277 277 g_free(phb); … … 280 280 281 281 close(source); 282 phb->func(phb->data, -1, GAIM_INPUT_READ);282 phb->func(phb->data, -1, B_EV_IO_READ); 283 283 g_free(phb->host); 284 284 g_free(phb); … … 299 299 if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { 300 300 close(source); 301 phb->func(phb->data, -1, GAIM_INPUT_READ);301 phb->func(phb->data, -1, B_EV_IO_READ); 302 302 g_free(phb->host); 303 303 g_free(phb); … … 309 309 if (!(hp = gethostbyname(phb->host))) { 310 310 close(source); 311 phb->func(phb->data, -1, GAIM_INPUT_READ);311 phb->func(phb->data, -1, B_EV_IO_READ); 312 312 g_free(phb->host); 313 313 g_free(phb); … … 326 326 if (write(source, packet, 9) != 9) { 327 327 close(source); 328 phb->func(phb->data, -1, GAIM_INPUT_READ);329 g_free(phb->host); 330 g_free(phb); 331 return FALSE; 332 } 333 334 phb->inpa = b_input_add(source, GAIM_INPUT_READ, s4_canread, phb);328 phb->func(phb->data, -1, B_EV_IO_READ); 329 g_free(phb->host); 330 g_free(phb); 331 return FALSE; 332 } 333 334 phb->inpa = b_input_add(source, B_EV_IO_READ, s4_canread, phb); 335 335 336 336 return FALSE; … … 359 359 if (read(source, buf, 10) < 10) { 360 360 close(source); 361 phb->func(phb->data, -1, GAIM_INPUT_READ);361 phb->func(phb->data, -1, B_EV_IO_READ); 362 362 g_free(phb->host); 363 363 g_free(phb); … … 366 366 if ((buf[0] != 0x05) || (buf[1] != 0x00)) { 367 367 close(source); 368 phb->func(phb->data, -1, GAIM_INPUT_READ);369 g_free(phb->host); 370 g_free(phb); 371 return FALSE; 372 } 373 374 phb->func(phb->data, source, GAIM_INPUT_READ);368 phb->func(phb->data, -1, B_EV_IO_READ); 369 g_free(phb->host); 370 g_free(phb); 371 return FALSE; 372 } 373 374 phb->func(phb->data, source, B_EV_IO_READ); 375 375 g_free(phb->host); 376 376 g_free(phb); … … 396 396 if (write(source, buf, (5 + strlen(phb->host) + 2)) < (5 + strlen(phb->host) + 2)) { 397 397 close(source); 398 phb->func(phb->data, -1, GAIM_INPUT_READ);398 phb->func(phb->data, -1, B_EV_IO_READ); 399 399 g_free(phb->host); 400 400 g_free(phb); … … 402 402 } 403 403 404 phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_canread_again, phb);404 phb->inpa = b_input_add(source, B_EV_IO_READ, s5_canread_again, phb); 405 405 } 406 406 … … 414 414 if (read(source, buf, 2) < 2) { 415 415 close(source); 416 phb->func(phb->data, -1, GAIM_INPUT_READ);416 phb->func(phb->data, -1, B_EV_IO_READ); 417 417 g_free(phb->host); 418 418 g_free(phb); … … 422 422 if ((buf[0] != 0x01) || (buf[1] != 0x00)) { 423 423 close(source); 424 phb->func(phb->data, -1, GAIM_INPUT_READ);424 phb->func(phb->data, -1, B_EV_IO_READ); 425 425 g_free(phb->host); 426 426 g_free(phb); … … 442 442 if (read(source, buf, 2) < 2) { 443 443 close(source); 444 phb->func(phb->data, -1, GAIM_INPUT_READ);444 phb->func(phb->data, -1, B_EV_IO_READ); 445 445 g_free(phb->host); 446 446 g_free(phb); … … 450 450 if ((buf[0] != 0x05) || (buf[1] == 0xff)) { 451 451 close(source); 452 phb->func(phb->data, -1, GAIM_INPUT_READ);452 phb->func(phb->data, -1, B_EV_IO_READ); 453 453 g_free(phb->host); 454 454 g_free(phb); … … 465 465 if (write(source, buf, 3 + i + j) < 3 + i + j) { 466 466 close(source); 467 phb->func(phb->data, -1, GAIM_INPUT_READ);467 phb->func(phb->data, -1, B_EV_IO_READ); 468 468 g_free(phb->host); 469 469 g_free(phb); … … 471 471 } 472 472 473 phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_readauth, phb);473 phb->inpa = b_input_add(source, B_EV_IO_READ, s5_readauth, phb); 474 474 } else { 475 475 s5_sendconnect(phb, source); … … 491 491 if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { 492 492 close(source); 493 phb->func(phb->data, -1, GAIM_INPUT_READ);493 phb->func(phb->data, -1, B_EV_IO_READ); 494 494 g_free(phb->host); 495 495 g_free(phb); … … 513 513 if (write(source, buf, i) < i) { 514 514 close(source); 515 phb->func(phb->data, -1, GAIM_INPUT_READ);516 g_free(phb->host); 517 g_free(phb); 518 return FALSE; 519 } 520 521 phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_canread, phb);515 phb->func(phb->data, -1, B_EV_IO_READ); 516 g_free(phb->host); 517 g_free(phb); 518 return FALSE; 519 } 520 521 phb->inpa = b_input_add(source, B_EV_IO_READ, s5_canread, phb); 522 522 523 523 return FALSE; -
lib/ssl_bogus.c
r3ab1d31 rb308cf9 59 59 b_input_condition ssl_getdirection( void *conn ) 60 60 { 61 return GAIM_INPUT_READ;61 return B_EV_IO_READ; 62 62 } 63 63 -
lib/ssl_client.h
r3ab1d31 rb308cf9 71 71 G_MODULE_EXPORT int ssl_getfd( void *conn ); 72 72 73 /* This function returns GAIM_INPUT_READ/WRITE. With SSL connections it's73 /* This function returns B_EV_IO_READ/WRITE. With SSL connections it's 74 74 possible that something has to be read while actually were trying to 75 75 write something (think about key exchange/refresh/etc). So when an -
lib/ssl_gnutls.c
r3ab1d31 rb308cf9 106 106 struct scd *conn = data; 107 107 108 return ssl_connected( conn, conn->fd, GAIM_INPUT_WRITE );108 return ssl_connected( conn, conn->fd, B_EV_IO_WRITE ); 109 109 } 110 110 … … 244 244 { 245 245 return( gnutls_record_get_direction( ((struct scd*)conn)->session ) ? 246 GAIM_INPUT_WRITE : GAIM_INPUT_READ );247 } 246 B_EV_IO_WRITE : B_EV_IO_READ ); 247 } -
lib/ssl_nss.c
r3ab1d31 rb308cf9 193 193 { 194 194 /* Just in case someone calls us, let's return the most likely case: */ 195 return GAIM_INPUT_READ;195 return B_EV_IO_READ; 196 196 } -
lib/ssl_openssl.c
r3ab1d31 rb308cf9 102 102 struct scd *conn = data; 103 103 104 return ssl_connected( conn, conn->fd, GAIM_INPUT_WRITE );104 return ssl_connected( conn, conn->fd, B_EV_IO_WRITE ); 105 105 } 106 106 … … 270 270 b_input_condition ssl_getdirection( void *conn ) 271 271 { 272 return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? GAIM_INPUT_WRITE : GAIM_INPUT_READ );273 } 272 return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? B_EV_IO_WRITE : B_EV_IO_READ ); 273 } -
lib/ssl_sspi.c
r3ab1d31 rb308cf9 275 275 GaimInputCondition ssl_getdirection( void *conn ) 276 276 { 277 return GAIM_INPUT_WRITE; /* FIXME: or GAIM_INPUT_READ */278 } 277 return B_EV_IO_WRITE; /* FIXME: or B_EV_IO_READ */ 278 } -
lib/url.c
r3ab1d31 rb308cf9 27 27 28 28 /* Convert an URL to a url_t structure */ 29 int url_set( url_t *url, c har *set_url )29 int url_set( url_t *url, const char *set_url ) 30 30 { 31 31 char s[MAX_STRING+1]; -
lib/url.h
r3ab1d31 rb308cf9 42 42 } url_t; 43 43 44 int url_set( url_t *url, c har *set_url );44 int url_set( url_t *url, const char *set_url ); -
lib/xmltree.c
r3ab1d31 rb308cf9 449 449 while( node ) 450 450 { 451 if( g_strcasecmp( node->name, name ) == 0 ) 451 char *colon; 452 453 if( g_strcasecmp( node->name, name ) == 0 || 454 ( ( colon = strchr( node->name, ':' ) ) && 455 g_strcasecmp( colon + 1, name ) == 0 ) ) 452 456 break; 453 457 … … 461 465 { 462 466 int i; 467 char *colon; 463 468 464 469 if( !node ) … … 468 473 if( g_strcasecmp( node->attr[i].key, key ) == 0 ) 469 474 break; 475 476 /* This is an awful hack that only takes care of namespace prefixes 477 inside a tag. Since IMHO excessive namespace usage in XMPP is 478 massive overkill anyway (this code exists for almost four years 479 now and never really missed it): Meh. */ 480 if( !node->attr[i].key && strcmp( key, "xmlns" ) == 0 && 481 ( colon = strchr( node->name, ':' ) ) ) 482 { 483 *colon = '\0'; 484 for( i = 0; node->attr[i].key; i ++ ) 485 if( strncmp( node->attr[i].key, "xmlns:", 6 ) == 0 && 486 strcmp( node->attr[i].key + 6, node->name ) == 0 ) 487 break; 488 *colon = ':'; 489 } 470 490 471 491 return node->attr[i].value; -
log.c
r3ab1d31 rb308cf9 172 172 fprintf(stdout, "Debug: %s\n", message); 173 173 #endif 174 /* Always log stuff in syslogs too. */ 175 log_syslog(level, message); 174 176 return; 175 177 } -
protocols/Makefile
r3ab1d31 rb308cf9 8 8 9 9 -include ../Makefile.settings 10 ifdef SRCDIR 11 SRCDIR := $(SRCDIR)protocols/ 12 endif 10 13 11 14 # [SH] Program variables … … 49 52 $(objects): ../Makefile.settings Makefile 50 53 51 $(objects): %.o: %.c54 $(objects): %.o: $(SRCDIR)%.c 52 55 @echo '*' Compiling $< 53 56 @$(CC) -c $(CFLAGS) $< -o $@ -
protocols/jabber/Makefile
r3ab1d31 rb308cf9 8 8 9 9 -include ../../Makefile.settings 10 ifdef SRCDIR 11 SRCDIR := $(SRCDIR)protocols/jabber/ 12 endif 10 13 11 14 # [SH] Program variables … … 33 36 $(objects): ../../Makefile.settings Makefile 34 37 35 $(objects): %.o: %.c38 $(objects): %.o: $(SRCDIR)%.c 36 39 @echo '*' Compiling $< 37 40 @$(CC) -c $(CFLAGS) $< -o $@ -
protocols/jabber/conference.c
r3ab1d31 rb308cf9 272 272 } 273 273 274 if( bud != jc->me ) 275 { 274 if( bud != jc->me && bud->flags & JBFLAG_IS_ANONYMOUS ) 275 { 276 /* If JIDs are anonymized, add them to the local 277 list for the duration of this chat. */ 276 278 imcb_add_buddy( ic, bud->ext_jid, NULL ); 277 279 imcb_buddy_nick_hint( ic, bud->ext_jid, bud->resource ); -
protocols/jabber/io.c
r3ab1d31 rb308cf9 64 64 most cases it probably won't be necessary.) */ 65 65 if( ( ret = jabber_write_queue( ic ) ) && jd->tx_len > 0 ) 66 jd->w_inpa = b_input_add( jd->fd, GAIM_INPUT_WRITE, jabber_write_callback, ic );66 jd->w_inpa = b_input_add( jd->fd, B_EV_IO_WRITE, jabber_write_callback, ic ); 67 67 } 68 68 else … … 504 504 505 505 if( jd->r_inpa <= 0 ) 506 jd->r_inpa = b_input_add( jd->fd, GAIM_INPUT_READ, jabber_read_callback, ic );506 jd->r_inpa = b_input_add( jd->fd, B_EV_IO_READ, jabber_read_callback, ic ); 507 507 508 508 greet = g_strdup_printf( "%s<stream:stream to=\"%s\" xmlns=\"jabber:client\" " -
protocols/jabber/jabber_util.c
r3ab1d31 rb308cf9 671 671 time_t jabber_get_timestamp( struct xt_node *xt ) 672 672 { 673 struct tm tp, utc;674 673 struct xt_node *c; 675 time_t res, tres;676 674 char *s = NULL; 675 struct tm tp; 677 676 678 677 for( c = xt->children; ( c = xt_find_node( c, "x" ) ); c = c->next ) … … 692 691 tp.tm_year -= 1900; 693 692 tp.tm_mon --; 694 tp.tm_isdst = -1; /* GRRRRRRRRRRR */ 695 696 res = mktime( &tp ); 697 /* Problem is, mktime() just gave us the GMT timestamp for the 698 given local time... While the given time WAS NOT local. So 699 we should fix this now. 700 701 Now I could choose between messing with environment variables 702 (kludgy) or using timegm() (not portable)... Or doing the 703 following, which I actually prefer... */ 704 gmtime_r( &res, &utc ); 705 utc.tm_isdst = -1; /* Once more: GRRRRRRRRRRRRRRRRRR!!! */ 706 if( utc.tm_hour == tp.tm_hour && utc.tm_min == tp.tm_min ) 707 /* Sweet! We're in UTC right now... */ 708 return res; 709 710 tres = mktime( &utc ); 711 res += res - tres; 712 713 /* Yes, this is a hack. And it will go wrong around DST changes. 714 BUT this is more likely to be threadsafe than messing with 715 environment variables, and possibly more portable... */ 716 717 return res; 693 694 return mktime_utc( &tp ); 718 695 } 719 696 -
protocols/jabber/message.c
r3ab1d31 rb308cf9 80 80 if( type && strcmp( type, "headline" ) == 0 ) 81 81 { 82 c = xt_find_node( node->children, "subject" );83 g_string_append_printf( fullmsg, "Headline: %s\n", c && c->text_len > 0 ? c->text : "");82 if( ( c = xt_find_node( node->children, "subject" ) ) && c->text_len > 0 ) 83 g_string_append_printf( fullmsg, "Headline: %s\n", c->text ); 84 84 85 85 /* <x xmlns="jabber:x:oob"><url>http://....</url></x> can contain a URL, it seems. */ -
protocols/jabber/s5bytestream.c
r3ab1d31 rb308cf9 406 406 bt->phase = BS_PHASE_CONNECTED; 407 407 408 bt->tf->watch_out = b_input_add( fd, GAIM_INPUT_WRITE, jabber_bs_recv_handshake, bt );408 bt->tf->watch_out = b_input_add( fd, B_EV_IO_WRITE, jabber_bs_recv_handshake, bt ); 409 409 410 410 /* since it takes forever(3mins?) till connect() fails on itself we schedule a timeout */ … … 433 433 bt->phase = BS_PHASE_REQUEST; 434 434 435 bt->tf->watch_in = b_input_add( fd, GAIM_INPUT_READ, jabber_bs_recv_handshake, bt );435 bt->tf->watch_in = b_input_add( fd, B_EV_IO_READ, jabber_bs_recv_handshake, bt ); 436 436 437 437 bt->tf->watch_out = 0; … … 590 590 591 591 tf->ft->data = tf; 592 tf->watch_in = b_input_add( tf->fd, GAIM_INPUT_READ, jabber_bs_recv_read, bt );592 tf->watch_in = b_input_add( tf->fd, B_EV_IO_READ, jabber_bs_recv_read, bt ); 593 593 tf->ft->write_request = jabber_bs_recv_write_request; 594 594 … … 632 632 if( ( ret == -1 ) && ( errno == EAGAIN ) ) 633 633 { 634 tf->watch_in = b_input_add( tf->fd, GAIM_INPUT_READ, jabber_bs_recv_read, bt );634 tf->watch_in = b_input_add( tf->fd, B_EV_IO_READ, jabber_bs_recv_read, bt ); 635 635 return FALSE; 636 636 } … … 708 708 imcb_file_finished( ft ); 709 709 else 710 bt->tf->watch_out = b_input_add( tf->fd, GAIM_INPUT_WRITE, jabber_bs_send_can_write, bt );710 bt->tf->watch_out = b_input_add( tf->fd, B_EV_IO_WRITE, jabber_bs_send_can_write, bt ); 711 711 712 712 return TRUE; … … 919 919 bt->streamhosts = g_slist_append( bt->streamhosts, sh ); 920 920 921 bt->tf->watch_in = b_input_add( tf->fd, GAIM_INPUT_READ, jabber_bs_send_handshake, bt );921 bt->tf->watch_in = b_input_add( tf->fd, B_EV_IO_READ, jabber_bs_send_handshake, bt ); 922 922 bt->connect_timeout = b_timeout_add( JABBER_BS_LISTEN_TIMEOUT * 1000, jabber_bs_connect_timeout, bt ); 923 923 } else { … … 1056 1056 bt->phase = BS_PHASE_CONNECTED; 1057 1057 1058 bt->tf->watch_in = b_input_add( fd, GAIM_INPUT_READ, jabber_bs_send_handshake, bt );1058 bt->tf->watch_in = b_input_add( fd, B_EV_IO_READ, jabber_bs_send_handshake, bt ); 1059 1059 return FALSE; 1060 1060 } -
protocols/msn/Makefile
r3ab1d31 rb308cf9 8 8 9 9 -include ../../Makefile.settings 10 ifdef SRCDIR 11 SRCDIR := $(SRCDIR)protocols/msn/ 12 endif 10 13 11 14 # [SH] Program variables … … 33 36 $(objects): ../../Makefile.settings Makefile 34 37 35 $(objects): %.o: %.c38 $(objects): %.o: $(SRCDIR)%.c 36 39 @echo '*' Compiling $< 37 40 @$(CC) -c $(CFLAGS) $< -o $@ -
protocols/msn/invitation.c
r3ab1d31 rb308cf9 209 209 sock_make_nonblocking( fd ); 210 210 211 msn_file->r_event_id = b_input_add( fd, GAIM_INPUT_READ, msn_ftp_read, file );211 msn_file->r_event_id = b_input_add( fd, B_EV_IO_READ, msn_ftp_read, file ); 212 212 213 213 return FALSE; … … 230 230 } 231 231 232 msn_file->r_event_id = b_input_add( msn_file->fd, GAIM_INPUT_READ, msn_ftps_connected, file );232 msn_file->r_event_id = b_input_add( msn_file->fd, B_EV_IO_READ, msn_ftps_connected, file ); 233 233 234 234 g_snprintf( buf, sizeof( buf ), … … 318 318 319 319 sock_make_nonblocking( msn_file->fd ); 320 msn_file->r_event_id = b_input_add( msn_file->fd, GAIM_INPUT_READ, msn_ftp_read, file );320 msn_file->r_event_id = b_input_add( msn_file->fd, B_EV_IO_READ, msn_ftp_read, file ); 321 321 322 322 return FALSE; … … 415 415 ( msn_file->data_sent + msn_file->sbufpos - 3 < file->file_size ) ) { 416 416 if( !msn_file->w_event_id ) 417 msn_file->w_event_id = b_input_add( msn_file->fd, GAIM_INPUT_WRITE, msn_ftp_send, file );417 msn_file->w_event_id = b_input_add( msn_file->fd, B_EV_IO_WRITE, msn_ftp_send, file ); 418 418 return TRUE; 419 419 } … … 452 452 /* we might already be listening if this is data from an overflow */ 453 453 if( !msn_file->w_event_id ) 454 msn_file->w_event_id = b_input_add( msn_file->fd, GAIM_INPUT_WRITE, msn_ftp_send, file );454 msn_file->w_event_id = b_input_add( msn_file->fd, B_EV_IO_WRITE, msn_ftp_send, file ); 455 455 } 456 456 … … 617 617 618 618 msn_file->r_event_id = 619 b_input_add( msn_file->fd, GAIM_INPUT_READ, msn_ftp_read, file );619 b_input_add( msn_file->fd, B_EV_IO_READ, msn_ftp_read, file ); 620 620 621 621 return TRUE; -
protocols/msn/msn.c
r3ab1d31 rb308cf9 31 31 GSList *msn_switchboards; 32 32 33 static char * msn_set_display_name( set_t *set, char *value );33 static char *set_eval_display_name( set_t *set, char *value ); 34 34 35 35 static void msn_init( account_t *acc ) 36 36 { 37 set_t *s; 38 39 s = set_add( &acc->set, "display_name", NULL, msn_set_display_name, acc ); 40 s->flags |= ACC_SET_NOSAVE | ACC_SET_ONLINE_ONLY; 41 42 s = set_add( &acc->set, "mail_notifications", "false", set_eval_bool, acc ); 37 set_add( &acc->set, "display_name", NULL, set_eval_display_name, acc ); 38 set_add( &acc->set, "local_display_name", "false", set_eval_bool, acc ); 39 set_add( &acc->set, "mail_notifications", "false", set_eval_bool, acc ); 40 set_add( &acc->set, "switchboard_keepalives", "false", set_eval_bool, acc ); 43 41 } 44 42 … … 171 169 static void msn_set_my_name( struct im_connection *ic, char *info ) 172 170 { 173 msn_set_display_name( set_find( &ic->acc->set, "display_name" ), info );171 msn_set_display_name( ic, info ); 174 172 } 175 173 … … 287 285 } 288 286 289 static char * msn_set_display_name( set_t *set, char *value )287 static char *set_eval_display_name( set_t *set, char *value ) 290 288 { 291 289 account_t *acc = set->data; 292 290 struct im_connection *ic = acc->ic; 293 struct msn_data *md; 294 char buf[1024], *fn; 295 296 /* Double-check. */ 291 292 /* Allow any name if we're offline. */ 297 293 if( ic == NULL ) 298 return NULL; 299 300 md = ic->proto_data; 294 return value; 301 295 302 296 if( strlen( value ) > 129 ) … … 305 299 return NULL; 306 300 } 307 308 fn = msn_http_encode( value );309 310 g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, ic->acc->user, fn );311 msn_write( ic, buf, strlen( buf ) );312 g_free( fn );313 301 314 302 /* Returning NULL would be better, because the server still has to 315 303 confirm the name change. However, it looks a bit confusing to the 316 304 user. */ 317 return value;305 return msn_set_display_name( ic, value ) ? value : NULL; 318 306 } 319 307 -
protocols/msn/msn.h
r3ab1d31 rb308cf9 31 31 #define TYPING_NOTIFICATION_MESSAGE "\r\r\rBEWARE, ME R TYPINK MESSAGE!!!!\r\r\r" 32 32 #define GROUPCHAT_SWITCHBOARD_MESSAGE "\r\r\rME WANT TALK TO MANY PEOPLE\r\r\r" 33 #define SB_KEEPALIVE_MESSAGE "\r\r\rDONT HANG UP ON ME!\r\r\r" 33 34 34 35 #ifdef DEBUG_MSN … … 53 54 "TypingUser: %s\r\n" \ 54 55 "\r\n\r\n" 56 57 #define SB_KEEPALIVE_HEADERS "MIME-Version: 1.0\r\n" \ 58 "Content-Type: text/x-ping\r\n" \ 59 "\r\n\r\n" 55 60 56 61 #define PROFILE_URL "http://members.msn.com/" … … 84 89 gint inp; 85 90 struct msn_handler_data *handler; 91 gint keepalive; 86 92 87 93 int trId; … … 162 168 char *msn_http_encode( const char *input ); 163 169 void msn_msgq_purge( struct im_connection *ic, GSList **list ); 170 gboolean msn_set_display_name( struct im_connection *ic, const char *rawname ); 164 171 165 172 /* tables.c */ … … 180 187 gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond ); 181 188 int msn_sb_write_msg( struct im_connection *ic, struct msn_message *m ); 189 void msn_sb_start_keepalives( struct msn_switchboard *sb, gboolean initial ); 190 void msn_sb_stop_keepalives( struct msn_switchboard *sb ); 182 191 183 192 /* invitation.c */ -
protocols/msn/msn_util.c
r3ab1d31 rb308cf9 38 38 imcb_error( ic, "Short write() to main server" ); 39 39 imc_logout( ic, TRUE ); 40 return ( 0 );41 } 42 43 return ( 1 );40 return 0; 41 } 42 43 return 1; 44 44 } 45 45 … … 377 377 g_string_free( ret, TRUE ); 378 378 } 379 380 gboolean msn_set_display_name( struct im_connection *ic, const char *rawname ) 381 { 382 char *fn = msn_http_encode( rawname ); 383 struct msn_data *md = ic->proto_data; 384 char buf[1024]; 385 386 g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, ic->acc->user, fn ); 387 g_free( fn ); 388 389 return msn_write( ic, buf, strlen( buf ) ) != 0; 390 } -
protocols/msn/ns.c
r3ab1d31 rb308cf9 35 35 36 36 static void msn_auth_got_passport_token( struct msn_auth_data *mad ); 37 static gboolean msn_ns_got_display_name( struct im_connection *ic, char *name ); 37 38 38 39 gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond ) … … 75 76 if( msn_write( ic, s, strlen( s ) ) ) 76 77 { 77 ic->inpa = b_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, ic );78 ic->inpa = b_input_add( md->fd, B_EV_IO_READ, msn_ns_callback, ic ); 78 79 imcb_log( ic, "Connected to server, waiting for reply" ); 79 80 } … … 231 232 else if( num_parts >= 7 && strcmp( cmd[2], "OK" ) == 0 ) 232 233 { 233 set_t *s;234 235 234 if( num_parts == 7 ) 236 { 237 http_decode( cmd[4] ); 238 239 strncpy( ic->displayname, cmd[4], sizeof( ic->displayname ) ); 240 ic->displayname[sizeof(ic->displayname)-1] = 0; 241 242 if( ( s = set_find( &ic->acc->set, "display_name" ) ) ) 243 { 244 g_free( s->value ); 245 s->value = g_strdup( cmd[4] ); 246 } 247 } 235 msn_ns_got_display_name( ic, cmd[4] ); 248 236 else 249 {250 237 imcb_log( ic, "Warning: Friendly name in server response was corrupted" ); 251 }252 238 253 239 imcb_log( ic, "Authenticated, getting buddy list" ); … … 436 422 else if( strcmp( cmd[0], "FLN" ) == 0 ) 437 423 { 438 if( cmd[1] ) 439 imcb_buddy_status( ic, cmd[1], 0, NULL, NULL ); 424 if( cmd[1] == NULL ) 425 return 1; 426 427 imcb_buddy_status( ic, cmd[1], 0, NULL, NULL ); 428 429 msn_sb_start_keepalives( msn_sb_by_handle( ic, cmd[1] ), TRUE ); 440 430 } 441 431 else if( strcmp( cmd[0], "NLN" ) == 0 ) … … 463 453 ( st != msn_away_state_list ? OPT_AWAY : 0 ), 464 454 st->name, NULL ); 455 456 msn_sb_stop_keepalives( msn_sb_by_handle( ic, cmd[2] ) ); 465 457 } 466 458 else if( strcmp( cmd[0], "RNG" ) == 0 ) … … 567 559 return( 0 ); 568 560 } 561 #if 0 562 /* Discard this one completely for now since I don't care about the ack 563 and since MSN servers can apparently screw up the formatting. */ 569 564 else if( strcmp( cmd[0], "REA" ) == 0 ) 570 565 { … … 597 592 } 598 593 } 594 #endif 599 595 else if( strcmp( cmd[0], "IPG" ) == 0 ) 600 596 { … … 746 742 } 747 743 } 744 745 static gboolean msn_ns_got_display_name( struct im_connection *ic, char *name ) 746 { 747 set_t *s; 748 749 if( ( s = set_find( &ic->acc->set, "display_name" ) ) == NULL ) 750 return FALSE; /* Shouldn't happen.. */ 751 752 http_decode( name ); 753 754 if( s->value && strcmp( s->value, name ) == 0 ) 755 { 756 return TRUE; 757 /* The names match, nothing to worry about. */ 758 } 759 else if( s->value != NULL && 760 ( strcmp( name, ic->acc->user ) == 0 || 761 set_getbool( &ic->acc->set, "local_display_name" ) ) ) 762 { 763 /* The server thinks our display name is our e-mail address 764 which is probably wrong, or the user *wants* us to do this: 765 Always use the locally set display_name. */ 766 return msn_set_display_name( ic, s->value ); 767 } 768 else 769 { 770 if( s->value && *s->value ) 771 imcb_log( ic, "BitlBee thinks your display name is `%s' but " 772 "the MSN server says it's `%s'. Using the MSN " 773 "server's name. Set local_display_name to true " 774 "to use the local name.", s->value, name ); 775 776 if( g_utf8_validate( name, -1, NULL ) ) 777 { 778 g_free( s->value ); 779 s->value = g_strdup( name ); 780 } 781 else 782 { 783 imcb_log( ic, "Warning: Friendly name in server response was corrupted" ); 784 } 785 786 return TRUE; 787 } 788 } -
protocols/msn/sb.c
r3ab1d31 rb308cf9 180 180 i = strlen( buf ); 181 181 } 182 else if( strcmp( text, SB_KEEPALIVE_MESSAGE ) == 0 ) 183 { 184 buf = g_strdup( SB_KEEPALIVE_HEADERS ); 185 i = strlen( buf ); 186 } 182 187 else 183 188 { … … 256 261 257 262 msn_msgq_purge( ic, &sb->msgq ); 263 msn_sb_stop_keepalives( sb ); 258 264 259 265 if( sb->key ) g_free( sb->key ); … … 315 321 316 322 if( msn_sb_write( sb, buf, strlen( buf ) ) ) 317 sb->inp = b_input_add( sb->fd, GAIM_INPUT_READ, msn_sb_callback, sb );323 sb->inp = b_input_add( sb->fd, B_EV_IO_READ, msn_sb_callback, sb ); 318 324 else 319 325 debug( "Error %d while connecting to switchboard server", 2 ); … … 328 334 struct msn_data *md = ic->proto_data; 329 335 330 if( msn_handler( sb->handler ) == -1 ) 336 if( msn_handler( sb->handler ) != -1 ) 337 return TRUE; 338 339 if( sb->msgq != NULL ) 331 340 { 332 341 time_t now = time( NULL ); 342 char buf[1024]; 333 343 334 344 if( now - md->first_sb_failure > 600 ) … … 347 357 "There might be problems delivering your messages." ); 348 358 349 if( sb->msgq != NULL ) 350 { 351 char buf[1024]; 352 353 if( md->msgq == NULL ) 354 { 355 md->msgq = sb->msgq; 356 } 357 else 358 { 359 GSList *l; 360 361 for( l = md->msgq; l->next; l = l->next ); 362 l->next = sb->msgq; 363 } 364 sb->msgq = NULL; 365 366 debug( "Moved queued messages back to the main queue, creating a new switchboard to retry." ); 367 g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId ); 368 if( !msn_write( ic, buf, strlen( buf ) ) ) 369 return FALSE; 370 } 371 372 msn_sb_destroy( sb ); 373 374 return FALSE; 375 } 376 else 377 { 378 return TRUE; 379 } 359 if( md->msgq == NULL ) 360 { 361 md->msgq = sb->msgq; 362 } 363 else 364 { 365 GSList *l; 366 367 for( l = md->msgq; l->next; l = l->next ); 368 l->next = sb->msgq; 369 } 370 sb->msgq = NULL; 371 372 debug( "Moved queued messages back to the main queue, " 373 "creating a new switchboard to retry." ); 374 g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId ); 375 if( !msn_write( ic, buf, strlen( buf ) ) ) 376 return FALSE; 377 } 378 379 msn_sb_destroy( sb ); 380 return FALSE; 380 381 } 381 382 … … 477 478 478 479 sb->ready = 1; 480 481 msn_sb_start_keepalives( sb, FALSE ); 479 482 } 480 483 else if( strcmp( cmd[0], "CAL" ) == 0 ) … … 526 529 } 527 530 531 msn_sb_start_keepalives( sb, FALSE ); 532 528 533 return( st ); 529 534 } … … 587 592 if( sb->who ) 588 593 { 594 msn_sb_stop_keepalives( sb ); 595 589 596 /* This is a single-person chat, and the other person is leaving. */ 590 597 g_free( sb->who ); … … 749 756 return( 1 ); 750 757 } 758 759 static gboolean msn_sb_keepalive( gpointer data, gint source, b_input_condition cond ) 760 { 761 struct msn_switchboard *sb = data; 762 return sb->ready && msn_sb_sendmessage( sb, SB_KEEPALIVE_MESSAGE ); 763 } 764 765 void msn_sb_start_keepalives( struct msn_switchboard *sb, gboolean initial ) 766 { 767 struct buddy *b; 768 769 if( sb && sb->who && sb->keepalive == 0 && 770 ( b = imcb_find_buddy( sb->ic, sb->who ) ) && !b->present && 771 set_getbool( &sb->ic->acc->set, "switchboard_keepalives" ) ) 772 { 773 if( initial ) 774 msn_sb_keepalive( sb, 0, 0 ); 775 776 sb->keepalive = b_timeout_add( 20000, msn_sb_keepalive, sb ); 777 } 778 } 779 780 void msn_sb_stop_keepalives( struct msn_switchboard *sb ) 781 { 782 if( sb && sb->keepalive > 0 ) 783 { 784 b_event_remove( sb->keepalive ); 785 sb->keepalive = 0; 786 } 787 } -
protocols/nogaim.c
r3ab1d31 rb308cf9 39 39 40 40 static int remove_chat_buddy_silent( struct groupchat *b, const char *handle ); 41 static char *format_timestamp( irc_t *irc, time_t msg_ts ); 41 42 42 43 GSList *connections; … … 116 117 { 117 118 GList *gl; 118 for (gl = protocols; gl; gl = gl->next) 119 120 for( gl = protocols; gl; gl = gl->next ) 119 121 { 120 122 struct prpl *proto = gl->data; 121 if(!g_strcasecmp(proto->name, name)) 123 124 if( g_strcasecmp( proto->name, name ) == 0 ) 122 125 return proto; 123 126 } 127 124 128 return NULL; 125 129 } … … 132 136 extern void byahoo_initmodule(); 133 137 extern void jabber_initmodule(); 138 extern void twitter_initmodule(); 139 extern void purple_initmodule(); 134 140 135 141 #ifdef WITH_MSN … … 147 153 #ifdef WITH_JABBER 148 154 jabber_initmodule(); 155 #endif 156 157 #ifdef WITH_TWITTER 158 twitter_initmodule(); 159 #endif 160 161 #ifdef WITH_PURPLE 162 purple_initmodule(); 149 163 #endif 150 164 … … 651 665 u->away = u->status_msg = NULL; 652 666 653 if( ( flags & OPT_LOGGED_IN ) && !u->online ) 654 { 667 if( set_getbool( &ic->irc->set, "show_offline" ) && !u->online ) 668 { 669 /* always set users as online */ 655 670 irc_spawn( ic->irc, u ); 656 671 u->online = 1; 672 if( !( flags & OPT_LOGGED_IN ) ) 673 { 674 /* set away message if user isn't really online */ 675 u->away = g_strdup( "User is offline" ); 676 } 677 } 678 else if( ( flags & OPT_LOGGED_IN ) && !u->online ) 679 { 680 irc_spawn( ic->irc, u ); 681 u->online = 1; 657 682 } 658 683 else if( !( flags & OPT_LOGGED_IN ) && u->online ) … … 660 685 struct groupchat *c; 661 686 662 irc_kill( ic->irc, u ); 663 u->online = 0; 664 665 /* Remove him/her from the groupchats to prevent PART messages after he/she QUIT already */ 666 for( c = ic->groupchats; c; c = c->next ) 667 remove_chat_buddy_silent( c, handle ); 668 } 669 687 if( set_getbool( &ic->irc->set, "show_offline" ) ) 688 { 689 /* keep offline users in channel and set away message to "offline" */ 690 u->away = g_strdup( "User is offline" ); 691 692 /* Keep showing him/her in the control channel but not in groupchats. */ 693 for( c = ic->groupchats; c; c = c->next ) 694 { 695 if( remove_chat_buddy_silent( c, handle ) && c->joined ) 696 irc_part( c->ic->irc, u, c->channel ); 697 } 698 } 699 else 700 { 701 /* kill offline users */ 702 irc_kill( ic->irc, u ); 703 u->online = 0; 704 705 /* Remove him/her from the groupchats to prevent PART messages after he/she QUIT already */ 706 for( c = ic->groupchats; c; c = c->next ) 707 remove_chat_buddy_silent( c, handle ); 708 } 709 } 710 670 711 if( flags & OPT_AWAY ) 671 712 { … … 692 733 } 693 734 694 /* LISPy... */ 695 if( ( set_getbool( &ic->irc->set, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */ 696 ( u->online ) && /* Don't touch offline people */ 697 ( ( ( u->online != oo ) && !u->away ) || /* Voice joining people */ 698 ( ( u->online == oo ) && ( oa == !u->away ) ) ) ) /* (De)voice people changing state */ 735 /* early if-clause for show_offline even if there is some redundant code here because this isn't LISP but C ;) */ 736 if( set_getbool( &ic->irc->set, "show_offline" ) && set_getbool( &ic->irc->set, "away_devoice" ) ) 699 737 { 700 738 char *from; … … 709 747 ic->irc->myhost ); 710 748 } 711 irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel, 712 u->away?'-':'+', u->nick ); 713 g_free( from ); 749 750 /* if we use show_offline, we op online users, voice away users, and devoice/deop offline users */ 751 if( flags & OPT_LOGGED_IN ) 752 { 753 /* user is "online" (either really online or away) */ 754 irc_write( ic->irc, ":%s MODE %s %cv%co %s %s", from, ic->irc->channel, 755 u->away?'+':'-', u->away?'-':'+', u->nick, u->nick ); 756 } 757 else 758 { 759 /* user is offline */ 760 irc_write( ic->irc, ":%s MODE %s -vo %s %s", from, ic->irc->channel, u->nick, u->nick ); 761 } 762 } 763 else 764 { 765 /* LISPy... */ 766 if( ( set_getbool( &ic->irc->set, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */ 767 ( u->online ) && /* Don't touch offline people */ 768 ( ( ( u->online != oo ) && !u->away ) || /* Voice joining people */ 769 ( ( u->online == oo ) && ( oa == !u->away ) ) ) ) /* (De)voice people changing state */ 770 { 771 char *from; 772 773 if( set_getbool( &ic->irc->set, "simulate_netsplit" ) ) 774 { 775 from = g_strdup( ic->irc->myhost ); 776 } 777 else 778 { 779 from = g_strdup_printf( "%s!%s@%s", ic->irc->mynick, ic->irc->mynick, 780 ic->irc->myhost ); 781 } 782 irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel, 783 u->away?'-':'+', u->nick ); 784 g_free( from ); 785 } 714 786 } 715 787 } … … 718 790 { 719 791 irc_t *irc = ic->irc; 720 char *wrapped ;792 char *wrapped, *ts = NULL; 721 793 user_t *u; 722 794 … … 760 832 ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) ) 761 833 strip_html( msg ); 762 834 835 if( set_getbool( &ic->irc->set, "display_timestamps" ) && 836 ( ts = format_timestamp( irc, sent_at ) ) ) 837 { 838 char *new = g_strconcat( ts, msg, NULL ); 839 g_free( ts ); 840 ts = msg = new; 841 } 842 763 843 wrapped = word_wrap( msg, 425 ); 764 844 irc_msgfrom( irc, u->nick, wrapped ); 765 845 g_free( wrapped ); 846 g_free( ts ); 766 847 } 767 848 … … 805 886 806 887 return c; 888 } 889 890 void imcb_chat_name_hint( struct groupchat *c, const char *name ) 891 { 892 if( !c->joined ) 893 { 894 struct im_connection *ic = c->ic; 895 char stripped[MAX_NICK_LENGTH+1], *full_name; 896 897 strncpy( stripped, name, MAX_NICK_LENGTH ); 898 stripped[MAX_NICK_LENGTH] = '\0'; 899 nick_strip( stripped ); 900 if( set_getbool( &ic->irc->set, "lcnicks" ) ) 901 nick_lc( stripped ); 902 903 full_name = g_strdup_printf( "&%s", stripped ); 904 905 if( stripped[0] && 906 nick_cmp( stripped, ic->irc->channel + 1 ) != 0 && 907 irc_chat_by_channel( ic->irc, full_name ) == NULL ) 908 { 909 g_free( c->channel ); 910 c->channel = full_name; 911 } 912 else 913 { 914 g_free( full_name ); 915 } 916 } 807 917 } 808 918 … … 867 977 if( c && u ) 868 978 { 869 irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, "", wrapped ); 979 char *ts = NULL; 980 if( set_getbool( &ic->irc->set, "display_timestamps" ) ) 981 ts = format_timestamp( ic->irc, sent_at ); 982 irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, ts ? : "", wrapped ); 983 g_free( ts ); 870 984 } 871 985 else … … 1061 1175 } 1062 1176 1063 1064 1177 char *set_eval_timezone( set_t *set, char *value ) 1178 { 1179 char *s; 1180 1181 if( strcmp( value, "local" ) == 0 || 1182 strcmp( value, "gmt" ) == 0 || strcmp( value, "utc" ) == 0 ) 1183 return value; 1184 1185 /* Otherwise: +/- at the beginning optional, then one or more numbers, 1186 possibly followed by a colon and more numbers. Don't bother bound- 1187 checking them since users are free to shoot themselves in the foot. */ 1188 s = value; 1189 if( *s == '+' || *s == '-' ) 1190 s ++; 1191 1192 /* \d+ */ 1193 if( !isdigit( *s ) ) 1194 return SET_INVALID; 1195 while( *s && isdigit( *s ) ) s ++; 1196 1197 /* EOS? */ 1198 if( *s == '\0' ) 1199 return value; 1200 1201 /* Otherwise, colon */ 1202 if( *s != ':' ) 1203 return SET_INVALID; 1204 s ++; 1205 1206 /* \d+ */ 1207 if( !isdigit( *s ) ) 1208 return SET_INVALID; 1209 while( *s && isdigit( *s ) ) s ++; 1210 1211 /* EOS */ 1212 return *s == '\0' ? value : SET_INVALID; 1213 } 1214 1215 static char *format_timestamp( irc_t *irc, time_t msg_ts ) 1216 { 1217 time_t now_ts = time( NULL ); 1218 struct tm now, msg; 1219 char *set; 1220 1221 /* If the timestamp is <= 0 or less than a minute ago, discard it as 1222 it doesn't seem to add to much useful info and/or might be noise. */ 1223 if( msg_ts <= 0 || msg_ts > now_ts - 60 ) 1224 return NULL; 1225 1226 set = set_getstr( &irc->set, "timezone" ); 1227 if( strcmp( set, "local" ) == 0 ) 1228 { 1229 localtime_r( &now_ts, &now ); 1230 localtime_r( &msg_ts, &msg ); 1231 } 1232 else 1233 { 1234 int hr, min = 0, sign = 60; 1235 1236 if( set[0] == '-' ) 1237 { 1238 sign *= -1; 1239 set ++; 1240 } 1241 else if( set[0] == '+' ) 1242 { 1243 set ++; 1244 } 1245 1246 if( sscanf( set, "%d:%d", &hr, &min ) >= 1 ) 1247 { 1248 msg_ts += sign * ( hr * 60 + min ); 1249 now_ts += sign * ( hr * 60 + min ); 1250 } 1251 1252 gmtime_r( &now_ts, &now ); 1253 gmtime_r( &msg_ts, &msg ); 1254 } 1255 1256 if( msg.tm_year == now.tm_year && msg.tm_yday == now.tm_yday ) 1257 return g_strdup_printf( "\x02[\x02\x02\x02%02d:%02d:%02d\x02]\x02 ", 1258 msg.tm_hour, msg.tm_min, msg.tm_sec ); 1259 else 1260 return g_strdup_printf( "\x02[\x02\x02\x02%04d-%02d-%02d " 1261 "%02d:%02d:%02d\x02]\x02 ", 1262 msg.tm_year + 1900, msg.tm_mon + 1, msg.tm_mday, 1263 msg.tm_hour, msg.tm_min, msg.tm_sec ); 1264 } 1065 1265 1066 1266 /* The plan is to not allow straight calls to prpl functions anymore, but do … … 1105 1305 { 1106 1306 char *away, *msg = NULL; 1307 1308 if( ic->acc->prpl->away_states == NULL || 1309 ic->acc->prpl->set_away == NULL ) 1310 return 0; 1107 1311 1108 1312 away = set_getstr( &ic->acc->set, "away" ) ? -
protocols/nogaim.h
r3ab1d31 rb308cf9 134 134 * - The user sees this name ie. when imcb_log() is used. */ 135 135 const char *name; 136 void *data; 136 137 137 138 /* Added this one to be able to add per-account settings, don't think … … 307 308 * user, too. */ 308 309 G_MODULE_EXPORT struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle ); 310 G_MODULE_EXPORT void imcb_chat_name_hint( struct groupchat *c, const char *name ); 309 311 G_MODULE_EXPORT void imcb_chat_add_buddy( struct groupchat *b, const char *handle ); 310 312 /* To remove a handle from a group chat. Reason can be NULL. */ … … 329 331 330 332 /* Misc. stuff */ 333 char *set_eval_timezone( set_t *set, char *value ); 331 334 char *set_eval_away_devoice( set_t *set, char *value ); 332 335 gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond ); -
protocols/oscar/Makefile
r3ab1d31 rb308cf9 8 8 9 9 -include ../../Makefile.settings 10 ifdef SRCDIR 11 SRCDIR := $(SRCDIR)protocols/oscar/ 12 CFLAGS += -I$(SRCDIR) 13 endif 10 14 11 15 # [SH] Program variables … … 33 37 $(objects): ../../Makefile.settings Makefile 34 38 35 $(objects): %.o: %.c39 $(objects): %.o: $(SRCDIR)%.c 36 40 @echo '*' Compiling $< 37 41 @$(CC) -c $(CFLAGS) $< -o $@ -
protocols/oscar/oscar.c
r3ab1d31 rb308cf9 205 205 static int gaim_icbm_param_info (aim_session_t *, aim_frame_t *, ...); 206 206 static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...); 207 static int gaim_memrequest (aim_session_t *, aim_frame_t *, ...);208 207 static int gaim_selfinfo (aim_session_t *, aim_frame_t *, ...); 209 208 static int gaim_offlinemsg (aim_session_t *, aim_frame_t *, ...); … … 291 290 odata = (struct oscar_data *)ic->proto_data; 292 291 293 if (condition & GAIM_INPUT_READ) {292 if (condition & B_EV_IO_READ) { 294 293 if (aim_get_command(odata->sess, conn) >= 0) { 295 294 aim_rxdispatch(odata->sess); … … 363 362 364 363 aim_conn_completeconnect(sess, conn); 365 ic->inpa = b_input_add(conn->fd, GAIM_INPUT_READ,364 ic->inpa = b_input_add(conn->fd, B_EV_IO_READ, 366 365 oscar_callback, conn); 367 366 … … 493 492 494 493 aim_conn_completeconnect(sess, bosconn); 495 ic->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,494 ic->inpa = b_input_add(bosconn->fd, B_EV_IO_READ, 496 495 oscar_callback, bosconn); 497 496 imcb_log(ic, _("Connection established, cookie sent")); … … 570 569 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ERROR, gaim_parse_genericerr, 0); 571 570 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BOS, AIM_CB_BOS_ERROR, gaim_parse_genericerr, 0); 572 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, 0x1f, gaim_memrequest, 0);573 571 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_SELFINFO, gaim_selfinfo, 0); 574 572 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG, gaim_offlinemsg, 0); … … 604 602 } 605 603 606 struct pieceofcrap {607 struct im_connection *ic;608 unsigned long offset;609 unsigned long len;610 char *modname;611 int fd;612 aim_conn_t *conn;613 unsigned int inpa;614 };615 616 static gboolean damn_you(gpointer data, gint source, b_input_condition c)617 {618 struct pieceofcrap *pos = data;619 struct oscar_data *od = pos->ic->proto_data;620 char in = '\0';621 int x = 0;622 unsigned char m[17];623 624 while (read(pos->fd, &in, 1) == 1) {625 if (in == '\n')626 x++;627 else if (in != '\r')628 x = 0;629 if (x == 2)630 break;631 in = '\0';632 }633 if (in != '\n') {634 imcb_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."635 " You may be disconnected shortly.");636 b_event_remove(pos->inpa);637 closesocket(pos->fd);638 g_free(pos);639 return FALSE;640 }641 /* [WvG] Wheeeee! Who needs error checking anyway? ;-) */642 read(pos->fd, m, 16);643 m[16] = '\0';644 b_event_remove(pos->inpa);645 closesocket(pos->fd);646 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH);647 g_free(pos);648 649 return FALSE;650 }651 652 static gboolean straight_to_hell(gpointer data, gint source, b_input_condition cond) {653 struct pieceofcrap *pos = data;654 char buf[BUF_LONG];655 656 if (source < 0) {657 imcb_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."658 " You may be disconnected shortly.");659 if (pos->modname)660 g_free(pos->modname);661 g_free(pos);662 return FALSE;663 }664 665 g_snprintf(buf, sizeof(buf), "GET " AIMHASHDATA666 "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n",667 pos->offset, pos->len, pos->modname ? pos->modname : "");668 write(pos->fd, buf, strlen(buf));669 if (pos->modname)670 g_free(pos->modname);671 pos->inpa = b_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);672 return FALSE;673 }674 675 604 /* size of icbmui.ocm, the largest module in AIM 3.5 */ 676 605 #define AIM_MAX_FILE_SIZE 98304 677 678 int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) {679 va_list ap;680 struct pieceofcrap *pos;681 guint32 offset, len;682 char *modname;683 int fd;684 685 va_start(ap, fr);686 offset = (guint32)va_arg(ap, unsigned long);687 len = (guint32)va_arg(ap, unsigned long);688 modname = va_arg(ap, char *);689 va_end(ap);690 691 if (len == 0) {692 aim_sendmemblock(sess, fr->conn, offset, len, NULL,693 AIM_SENDMEMBLOCK_FLAG_ISREQUEST);694 return 1;695 }696 /* uncomment this when you're convinced it's right. remember, it's been wrong before.697 if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) {698 char *buf;699 int i = 8;700 if (modname)701 i += strlen(modname);702 buf = g_malloc(i);703 i = 0;704 if (modname) {705 memcpy(buf, modname, strlen(modname));706 i += strlen(modname);707 }708 buf[i++] = offset & 0xff;709 buf[i++] = (offset >> 8) & 0xff;710 buf[i++] = (offset >> 16) & 0xff;711 buf[i++] = (offset >> 24) & 0xff;712 buf[i++] = len & 0xff;713 buf[i++] = (len >> 8) & 0xff;714 buf[i++] = (len >> 16) & 0xff;715 buf[i++] = (len >> 24) & 0xff;716 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST);717 g_free(buf);718 return 1;719 }720 */721 722 pos = g_new0(struct pieceofcrap, 1);723 pos->ic = sess->aux_data;724 pos->conn = fr->conn;725 726 pos->offset = offset;727 pos->len = len;728 pos->modname = modname ? g_strdup(modname) : NULL;729 730 fd = proxy_connect("gaim.sourceforge.net", 80, straight_to_hell, pos);731 if (fd < 0) {732 if (pos->modname)733 g_free(pos->modname);734 g_free(pos);735 imcb_error(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM."736 " You may be disconnected shortly.");737 }738 pos->fd = fd;739 740 return 1;741 }742 606 743 607 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { … … 838 702 839 703 aim_conn_completeconnect(sess, tstconn); 840 odata->cnpa = b_input_add(tstconn->fd, GAIM_INPUT_READ,704 odata->cnpa = b_input_add(tstconn->fd, B_EV_IO_READ, 841 705 oscar_callback, tstconn); 842 706 … … 866 730 867 731 aim_conn_completeconnect(sess, tstconn); 868 odata->paspa = b_input_add(tstconn->fd, GAIM_INPUT_READ,732 odata->paspa = b_input_add(tstconn->fd, B_EV_IO_READ, 869 733 oscar_callback, tstconn); 870 734 … … 902 766 aim_conn_completeconnect(sess, ccon->conn); 903 767 ccon->inpa = b_input_add(tstconn->fd, 904 GAIM_INPUT_READ,768 B_EV_IO_READ, 905 769 oscar_callback, tstconn); 906 770 odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon); … … 2651 2515 char * chatname; 2652 2516 2653 chatname = g_strdup_printf("%s%d", ic->acc->user, chat_id++); 2517 chatname = g_strdup_printf("%s%s_%d", isdigit(*ic->acc->user) ? "icq_" : "", 2518 ic->acc->user, chat_id++); 2654 2519 2655 2520 ret = oscar_chat_join(ic, chatname, NULL, NULL); -
protocols/yahoo/Makefile
r3ab1d31 rb308cf9 8 8 9 9 -include ../../Makefile.settings 10 ifdef SRCDIR 11 SRCDIR := $(SRCDIR)protocols/yahoo/ 12 endif 10 13 11 14 # [SH] Program variables … … 33 36 $(objects): ../../Makefile.settings Makefile 34 37 35 $(objects): %.o: %.c38 $(objects): %.o: $(SRCDIR)%.c 36 39 @echo '*' Compiling $< 37 40 @$(CC) -c $(CFLAGS) $< -o $@ -
protocols/yahoo/yahoo.c
r3ab1d31 rb308cf9 138 138 struct im_connection *ic = imcb_new( acc ); 139 139 struct byahoo_data *yd = ic->proto_data = g_new0( struct byahoo_data, 1 ); 140 char *s; 140 141 141 142 yd->logged_in = FALSE; 142 143 yd->current_status = YAHOO_STATUS_AVAILABLE; 144 145 if( ( s = strchr( acc->user, '@' ) ) && g_strcasecmp( s, "@yahoo.com" ) == 0 ) 146 imcb_error( ic, "Your Yahoo! username should just be a username. " 147 "Do not include any @domain part." ); 143 148 144 149 imcb_log( ic, "Connecting" ); … … 681 686 682 687 inp->d = d; 683 d->tag = inp->h = b_input_add( fd, GAIM_INPUT_READ, (b_event_handler) byahoo_read_ready_callback, (gpointer) d );688 d->tag = inp->h = b_input_add( fd, B_EV_IO_READ, (b_event_handler) byahoo_read_ready_callback, (gpointer) d ); 684 689 } 685 690 else if( cond == YAHOO_INPUT_WRITE ) … … 692 697 693 698 inp->d = d; 694 d->tag = inp->h = b_input_add( fd, GAIM_INPUT_WRITE, (b_event_handler) byahoo_write_ready_callback, (gpointer) d );699 d->tag = inp->h = b_input_add( fd, B_EV_IO_WRITE, (b_event_handler) byahoo_write_ready_callback, (gpointer) d ); 695 700 } 696 701 else … … 828 833 YList *m; 829 834 835 if( g_strcasecmp( who, ic->acc->user ) == 0 ) 836 /* WTF, Yahoo! seems to echo these now? */ 837 return; 838 830 839 inv = g_malloc( sizeof( struct byahoo_conf_invitation ) ); 831 840 memset( inv, 0, sizeof( struct byahoo_conf_invitation ) ); -
set.c
r3ab1d31 rb308cf9 29 29 char *SET_INVALID = "nee"; 30 30 31 set_t *set_add( set_t **head, c har *key,char *def, set_eval eval, void *data )31 set_t *set_add( set_t **head, const char *key, const char *def, set_eval eval, void *data ) 32 32 { 33 33 set_t *s = set_find( head, key ); … … 63 63 } 64 64 65 set_t *set_find( set_t **head, c har *key )65 set_t *set_find( set_t **head, const char *key ) 66 66 { 67 67 set_t *s = *head; … … 77 77 } 78 78 79 char *set_getstr( set_t **head, c har *key )79 char *set_getstr( set_t **head, const char *key ) 80 80 { 81 81 set_t *s = set_find( head, key ); … … 87 87 } 88 88 89 int set_getint( set_t **head, c har *key )89 int set_getint( set_t **head, const char *key ) 90 90 { 91 91 char *s = set_getstr( head, key ); … … 101 101 } 102 102 103 int set_getbool( set_t **head, c har *key )103 int set_getbool( set_t **head, const char *key ) 104 104 { 105 105 char *s = set_getstr( head, key ); … … 111 111 } 112 112 113 int set_setstr( set_t **head, c har *key, char *value )113 int set_setstr( set_t **head, const char *key, char *value ) 114 114 { 115 115 set_t *s = set_find( head, key ); … … 150 150 } 151 151 152 int set_setint( set_t **head, c har *key, int value )152 int set_setint( set_t **head, const char *key, int value ) 153 153 { 154 154 char s[24]; /* Not quite 128-bit clean eh? ;-) */ … … 158 158 } 159 159 160 void set_del( set_t **head, c har *key )160 void set_del( set_t **head, const char *key ) 161 161 { 162 162 set_t *s = *head, *t = NULL; … … 182 182 } 183 183 184 int set_reset( set_t **head, c har *key )184 int set_reset( set_t **head, const char *key ) 185 185 { 186 186 set_t *s; … … 211 211 { 212 212 return is_bool( value ) ? value : SET_INVALID; 213 } 214 215 char *set_eval_list( set_t *set, char *value ) 216 { 217 GSList *options = set->eval_data, *opt; 218 219 for( opt = options; opt; opt = opt->next ) 220 if( strcmp( value, opt->data ) == 0 ) 221 return value; 222 223 /* TODO: It'd be nice to show the user a list of allowed values, 224 but we don't have enough context here to do that. May 225 want to fix that. */ 226 227 return NULL; 213 228 } 214 229 -
set.h
r3ab1d31 rb308cf9 69 69 set_setstr() should be able to free() the returned string! */ 70 70 set_eval eval; 71 void *eval_data; 71 72 struct set *next; 72 73 } set_t; 73 74 74 75 /* Should be pretty clear. */ 75 set_t *set_add( set_t **head, c har *key,char *def, set_eval eval, void *data );76 set_t *set_add( set_t **head, const char *key, const char *def, set_eval eval, void *data ); 76 77 77 78 /* Returns the raw set_t. Might be useful sometimes. */ 78 set_t *set_find( set_t **head, c har *key );79 set_t *set_find( set_t **head, const char *key ); 79 80 80 81 /* Returns a pointer to the string value of this setting. Don't modify the 81 82 returned string, and don't free() it! */ 82 G_MODULE_EXPORT char *set_getstr( set_t **head, c har *key );83 G_MODULE_EXPORT char *set_getstr( set_t **head, const char *key ); 83 84 84 85 /* Get an integer. In previous versions set_getint() was also used to read 85 86 boolean values, but this SHOULD be done with set_getbool() now! */ 86 G_MODULE_EXPORT int set_getint( set_t **head, c har *key );87 G_MODULE_EXPORT int set_getbool( set_t **head, c har *key );87 G_MODULE_EXPORT int set_getint( set_t **head, const char *key ); 88 G_MODULE_EXPORT int set_getbool( set_t **head, const char *key ); 88 89 89 90 /* set_setstr() strdup()s the given value, so after using this function 90 91 you can free() it, if you want. */ 91 int set_setstr( set_t **head, c har *key, char *value );92 int set_setint( set_t **head, c har *key, int value );93 void set_del( set_t **head, c har *key );94 int set_reset( set_t **head, c har *key );92 int set_setstr( set_t **head, const char *key, char *value ); 93 int set_setint( set_t **head, const char *key, int value ); 94 void set_del( set_t **head, const char *key ); 95 int set_reset( set_t **head, const char *key ); 95 96 96 97 /* Two very useful generic evaluators. */ 97 98 char *set_eval_int( set_t *set, char *value ); 98 99 char *set_eval_bool( set_t *set, char *value ); 100 101 /* Another more complicated one. */ 102 char *set_eval_list( set_t *set, char *value ); 99 103 100 104 /* Some not very generic evaluators that really shouldn't be here... */ -
storage_xml.c
r3ab1d31 rb308cf9 496 496 goto write_error; 497 497 498 fsync( fd ); 498 499 close( fd ); 499 500 -
tests/Makefile
r3ab1d31 rb308cf9 1 1 -include ../Makefile.settings 2 ifdef SRCDIR 3 SRCDIR := $(SRCDIR)tests/ 4 endif 2 5 3 6 LFLAGS +=-lcheck … … 19 22 @$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS) $(EFLAGS) 20 23 21 %.o: %.c24 %.o: $(SRCDIR)%.c 22 25 @echo '*' Compiling $< 23 26 @$(CC) -c $(CFLAGS) $< -o $@ -
unix.c
r3ab1d31 rb308cf9 56 56 57 57 log_init(); 58 58 59 global.conf_file = g_strdup( CONF_FILE_DEF ); 59 60 global.conf = conf_load( argc, argv ); … … 62 63 63 64 b_main_init(); 64 nogaim_init();65 65 66 66 srand( time( NULL ) ^ getpid() ); 67 67 68 global.helpfile = g_strdup( HELP_FILE ); 69 if( help_init( &global.help, global.helpfile ) == NULL ) 70 log_message( LOGLVL_WARNING, "Error opening helpfile %s.", HELP_FILE ); 71 72 global.storage = storage_init( global.conf->primary_storage, global.conf->migrate_storage ); 73 if( global.storage == NULL ) 74 { 75 log_message( LOGLVL_ERROR, "Unable to load storage backend '%s'", global.conf->primary_storage ); 76 return( 1 ); 77 } 68 78 69 79 if( global.conf->runmode == RUNMODE_INETD ) … … 73 83 74 84 i = bitlbee_inetd_init(); 75 log_message( LOGLVL_INFO, "Bitl bee %s starting in inetd mode.", BITLBEE_VERSION );85 log_message( LOGLVL_INFO, "BitlBee %s starting in inetd mode.", BITLBEE_VERSION ); 76 86 77 87 } 78 88 else if( global.conf->runmode == RUNMODE_DAEMON ) 79 89 { 80 log_link( LOGLVL_ERROR, LOGOUTPUT_ SYSLOG);81 log_link( LOGLVL_WARNING, LOGOUTPUT_ SYSLOG);90 log_link( LOGLVL_ERROR, LOGOUTPUT_CONSOLE ); 91 log_link( LOGLVL_WARNING, LOGOUTPUT_CONSOLE ); 82 92 83 93 i = bitlbee_daemon_init(); 84 log_message( LOGLVL_INFO, "Bitl bee %s starting in daemon mode.", BITLBEE_VERSION );94 log_message( LOGLVL_INFO, "BitlBee %s starting in daemon mode.", BITLBEE_VERSION ); 85 95 } 86 96 else if( global.conf->runmode == RUNMODE_FORKDAEMON ) 87 97 { 98 log_link( LOGLVL_ERROR, LOGOUTPUT_CONSOLE ); 99 log_link( LOGLVL_WARNING, LOGOUTPUT_CONSOLE ); 100 88 101 /* In case the operator requests a restart, we need this. */ 89 102 old_cwd = g_malloc( 256 ); … … 96 109 97 110 i = bitlbee_daemon_init(); 98 log_message( LOGLVL_INFO, "Bitl bee %s starting in forking daemon mode.", BITLBEE_VERSION );111 log_message( LOGLVL_INFO, "BitlBee %s starting in forking daemon mode.", BITLBEE_VERSION ); 99 112 } 100 113 if( i != 0 ) … … 113 126 setuid( pw->pw_uid ); 114 127 } 115 }116 117 global.storage = storage_init( global.conf->primary_storage, global.conf->migrate_storage );118 if( global.storage == NULL )119 {120 log_message( LOGLVL_ERROR, "Unable to load storage backend '%s'", global.conf->primary_storage );121 return( 1 );122 128 } 123 129 … … 139 145 if( !getuid() || !geteuid() ) 140 146 log_message( LOGLVL_WARNING, "BitlBee is running with root privileges. Why?" ); 141 if( help_init( &global.help, global.helpfile ) == NULL )142 log_message( LOGLVL_WARNING, "Error opening helpfile %s.", HELP_FILE );143 147 144 148 b_main_run();
Note: See TracChangeset
for help on using the changeset viewer.