Changes in / [96ace1b:f665dab]
- Files:
-
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
.bzrignore
r96ace1b rf665dab 10 10 decode 11 11 encode 12 bitlbee.pc -
Makefile
r96ace1b rf665dab 11 11 # Program variables 12 12 objects = account.o bitlbee.o conf.o crypting.o help.o ini.o ipc.o irc.o irc_commands.o log.o nick.o query.o root_commands.o set.o storage.o storage_text.o unix.o url.o user.o util.o 13 headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ini.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h url.h user.h protocols/http_client.h protocols/md5.h protocols/nogaim.h protocols/proxy.h protocols/sha.h protocols/ssl_client.h14 13 subdirs = protocols 15 14 … … 23 22 $(MAKE) -C doc 24 23 25 uninstall: uninstall-bin uninstall-doc 24 uninstall: uninstall-bin uninstall-doc 26 25 @echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n' 27 26 … … 59 58 uninstall-bin: 60 59 rm -f $(DESTDIR)$(BINDIR)/$(OUTFILE) 61 62 install-dev:63 mkdir -p $(DESTDIR)$(INCLUDEDIR)64 install -m 0644 $(headers) $(DESTDIR)$(INCLUDEDIR)65 mkdir -p $(DESTDIR)$(PCDIR)66 install -m 0644 bitlbee.pc $(DESTDIR)$(PCDIR)67 68 uninstall-dev:69 rm -f $(foreach hdr,$(headers),$(DESTDIR)$(INCLUDEDIR)/$(hdr))70 -rmdir $(DESTDIR)$(INCLUDEDIR)71 rm -f $(DESTDIR)$(PCDIR)/bitlbee.pc72 60 73 61 install-etc: -
bitlbee.c
r96ace1b rf665dab 118 118 if( global.conf->runmode == RUNMODE_FORKDAEMON ) 119 119 ipc_master_load_state(); 120 121 if( global.conf->runmode == RUNMODE_DAEMON ||122 global.conf->runmode == RUNMODE_FORKDAEMON )123 ipc_master_listen_socket();124 120 125 121 if( ( fp = fopen( global.conf->pidfile, "w" ) ) ) -
bitlbee.h
r96ace1b rf665dab 102 102 #include "storage.h" 103 103 #include "set.h" 104 #include " nogaim.h"104 #include "protocols/nogaim.h" 105 105 #include "commands.h" 106 106 #include "account.h" -
conf.c
r96ace1b rf665dab 139 139 " -D Daemon mode. (Still EXPERIMENTAL!)\n" 140 140 " -F Forking daemon. (one process per client)\n" 141 " -P Specify PID-file (not for inetd mode)\n"142 141 " -i Specify the interface (by IP address) to listen on.\n" 143 142 " (Default: 0.0.0.0 (any interface))\n" -
configure
r96ace1b rf665dab 15 15 config='/var/lib/bitlbee/' 16 16 pidfile='/var/run/bitlbee.pid' 17 ipcsocket='/var/run/bitlbee'18 17 plugindir='$prefix/lib/bitlbee' 19 pcdir='$prefix/lib/pkgconfig'20 includedir='$prefix/include/bitlbee'21 18 22 19 msn=1 … … 53 50 --pidfile=... $pidfile 54 51 --config=... $config 55 --ipcsocket=... $ipcsocket56 52 57 53 --msn=0/1 Disable/enable MSN part $msn … … 83 79 config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'` 84 80 plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'` 85 pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'` 86 ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'` 87 includedir=`eval echo "$includedir" | sed 's/\/\{1,\}/\//g'` 88 pcdir=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'` 81 pidfile=`eval echo "$pidfile/" | sed 's/\/\{1,\}/\//g'` 89 82 90 83 cat<<EOF>Makefile.settings … … 96 89 DATADIR=$datadir 97 90 PLUGINDIR=$plugindir 91 PIDFILE=$pidfile 98 92 CONFIG=$config 99 IPCSOCKET=$ipcsocket100 INCLUDEDIR=$includedir101 PCDIR=$pcdir102 93 103 94 ARCH=$arch … … 121 112 #define PLUGINDIR "$plugindir" 122 113 #define PIDFILE "$pidfile" 123 #define IPCSOCKET "$ipcsocket"124 114 #define ARCH "$arch" 125 115 #define CPU "$cpu" … … 346 336 fi 347 337 348 cat <<EOF>bitlbee.pc349 prefix=$prefix350 includedir=$includedir351 352 Name: bitlbee353 Description: IRC to IM gateway354 Requires: glib-2.0355 Version: $BITLBEE_VERSION356 Libs:357 Cflags: -I\${includedir}358 359 EOF360 361 338 protocols='' 362 339 protoobjs='' -
doc/example_plugin.c
r96ace1b rf665dab 3 3 * a shared library and place it in the plugin directory: 4 4 * 5 * gcc -o example.so -shared example.c `pkg-config --cflags bitlbee`5 * gcc -o example.so -shared example.c 6 6 * cp example.so /usr/local/lib/bitlbee 7 7 */ 8 8 #include <stdio.h> 9 #include <bitlbee.h>10 9 11 10 void init_plugin(void) -
ipc.c
r96ace1b rf665dab 28 28 #include "ipc.h" 29 29 #include "commands.h" 30 #ifndef _WIN3231 #include <sys/un.h>32 #endif33 30 34 31 GSList *child_list = NULL; … … 37 34 static void ipc_master_cmd_client( irc_t *data, char **cmd ) 38 35 { 39 /* Normally data points at an irc_t block, but for the IPC master40 this is different. We think this scary cast is better than41 creating a new command_t structure, just to make the compiler42 happy. */43 36 struct bitlbee_child *child = (void*) data; 44 37 … … 464 457 } 465 458 466 467 static gboolean new_ipc_client (GIOChannel *gio, GIOCondition cond, gpointer data)468 {469 struct bitlbee_child *child = g_new0( struct bitlbee_child, 1 );470 int serversock;471 472 serversock = g_io_channel_unix_get_fd(gio);473 474 child->ipc_fd = accept(serversock, NULL, 0);475 476 if (child->ipc_fd == -1) {477 log_message( LOGLVL_WARNING, "Unable to accept connection on UNIX domain socket: %s", strerror(errno) );478 return TRUE;479 }480 481 child->ipc_inpa = gaim_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );482 483 child_list = g_slist_append( child_list, child );484 485 return TRUE;486 }487 488 #ifndef _WIN32489 int ipc_master_listen_socket()490 {491 struct sockaddr_un un_addr;492 int serversock;493 GIOChannel *gio;494 495 /* Clean up old socket files that were hanging around.. */496 if (unlink(IPCSOCKET) == -1 && errno != ENOENT) {497 log_message( LOGLVL_ERROR, "Could not remove old IPC socket at %s: %s", IPCSOCKET, strerror(errno) );498 return 0;499 }500 501 un_addr.sun_family = AF_UNIX;502 strcpy(un_addr.sun_path, IPCSOCKET);503 504 serversock = socket(AF_UNIX, SOCK_STREAM, PF_UNIX);505 506 if (serversock == -1) {507 log_message( LOGLVL_WARNING, "Unable to create UNIX socket: %s", strerror(errno) );508 return 0;509 }510 511 if (bind(serversock, &un_addr, sizeof(un_addr)) == -1) {512 log_message( LOGLVL_WARNING, "Unable to bind UNIX socket to %s: %s", IPCSOCKET, strerror(errno) );513 return 0;514 }515 516 if (listen(serversock, 5) == -1) {517 log_message( LOGLVL_WARNING, "Unable to listen on UNIX socket: %s", strerror(errno) );518 return 0;519 }520 521 gio = g_io_channel_unix_new(serversock);522 523 if (gio == NULL) {524 log_message( LOGLVL_WARNING, "Unable to create IO channel for unix socket" );525 return 0;526 }527 528 g_io_add_watch(gio, G_IO_IN, new_ipc_client, NULL);529 return 1;530 }531 #else532 /* FIXME: Open named pipe \\.\BITLBEE */533 #endif534 535 459 int ipc_master_load_state() 536 460 { -
ipc.h
r96ace1b rf665dab 57 57 void ipc_master_set_statefile( char *fn ); 58 58 int ipc_master_load_state(); 59 int ipc_master_listen_socket(); 59 60 60 61 61 extern GSList *child_list;
Note: See TracChangeset
for help on using the changeset viewer.