Changeset 764c7d1
- Timestamp:
- 2008-02-03T21:30:03Z (17 years ago)
- Branches:
- master
- Children:
- 3c80a9d
- Parents:
- b5c8a34
- Files:
-
- 2 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile
rb5c8a34 r764c7d1 10 10 11 11 # Program variables 12 objects = account.o bitlbee.o conf.o crypting.o help.o ipc.o irc.o irc_commands.o log.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS) unix.o user.o13 headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.h lib/events.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/nogaim.h12 objects = account.o bitlbee.o conf.o crypting.o help.o ipc.o irc.o irc_commands.o log.o nick.o otr.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS) unix.o user.o 13 headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ipc.h irc.h log.h nick.h otr.h query.h set.h sock.h storage.h user.h lib/events.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/nogaim.h 14 14 subdirs = lib protocols 15 15 -
bitlbee.c
rb5c8a34 r764c7d1 139 139 log_link( LOGLVL_ERROR, LOGOUTPUT_IRC ); 140 140 log_link( LOGLVL_WARNING, LOGOUTPUT_IRC ); 141 /* TODO: Remove debugging log_link's */ 142 log_link( LOGLVL_INFO, LOGOUTPUT_IRC ); 143 log_link( LOGLVL_DEBUG, LOGOUTPUT_IRC ); 141 144 142 145 return( 0 ); -
bitlbee.h
rb5c8a34 r764c7d1 133 133 #include "misc.h" 134 134 #include "proxy.h" 135 #include "otr.h" 135 136 136 137 typedef struct global { … … 143 144 char *helpfile; 144 145 int restart; 146 OtrlMessageAppOps otr_ops; /* collects interface functions required by OTR */ 145 147 } global_t; 146 148 -
configure
rb5c8a34 r764c7d1 30 30 gcov=0 31 31 plugins=1 32 otr=auto 32 33 33 34 events=glib … … 70 71 --gcov=0/1 Disable/enable test coverage reporting $gcov 71 72 --plugins=0/1 Disable/enable plugins support $plugins 73 --otr=0/1/auto Disable/enable OTR encryption support $otr 72 74 73 75 --events=... Event handler (glib, libevent) $events … … 174 176 if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then 175 177 cat<<EOF>>Makefile.settings 176 EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0 `177 CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0 `178 EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0 gthread-2.0` 179 CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0 gthread-2.0` 178 180 EOF 179 181 else … … 385 387 fi 386 388 389 if [ "$otr" = "auto" ]; then 390 for i in /lib /usr/lib /usr/local/lib; do 391 if [ -f $i/libotr.a ]; then 392 otr=1 393 break 394 fi 395 done 396 fi 397 if [ "$otr" = 0 ]; then 398 echo '#undef WITH_OTR' >> config.h 399 else 400 echo '#define WITH_OTR' >> config.h 401 echo "EFLAGS+=-lotr" >> Makefile.settings 402 fi 403 387 404 echo 388 405 if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then … … 504 521 fi 505 522 523 if [ "$otr" = "1" ]; then 524 echo ' Off-the-Record (OTR) Messaging enabled.' 525 else 526 echo ' Off-the-Record (OTR) Messaging disabled.' 527 fi 528 506 529 echo ' Using event handler: '$events 507 530 echo ' Using SSL library: '$ssl -
irc.c
rb5c8a34 r764c7d1 126 126 127 127 conf_loaddefaults( irc ); 128 129 irc->otr_us = otrl_userstate_create(); 130 irc->otr_mutex = g_mutex_new(); 128 131 129 132 return( irc ); … … 276 279 } 277 280 } 281 282 otrl_userstate_free(irc->otr_us); 283 g_mutex_free(irc->otr_mutex); 284 278 285 g_free(irc); 279 286 -
irc.h
rb5c8a34 r764c7d1 26 26 #ifndef _IRC_H 27 27 #define _IRC_H 28 29 #include "otr.h" 28 30 29 31 #define IRC_MAX_LINE 512 … … 95 97 gint w_watch_source_id; 96 98 gint ping_source_id; 99 100 OtrlUserState otr_us; 101 GMutex *otr_mutex; /* for locking otr during keygen */ 97 102 } irc_t; 98 103 -
log.c
rb5c8a34 r764c7d1 30 30 static log_t logoutput; 31 31 32 static void log_null(int level, c har *logmessage);33 static void log_irc(int level, c har *logmessage);34 static void log_syslog(int level, c har *logmessage);35 static void log_console(int level, c har *logmessage);32 static void log_null(int level, const char *logmessage); 33 static void log_irc(int level, const char *logmessage); 34 static void log_syslog(int level, const char *logmessage); 35 static void log_console(int level, const char *logmessage); 36 36 37 37 void log_init(void) { … … 97 97 } 98 98 99 void log_message(int level, c har *message, ... ) {99 void log_message(int level, const char *message, ... ) { 100 100 101 101 va_list ap; … … 122 122 } 123 123 124 void log_error(c har *functionname) {124 void log_error(const char *functionname) { 125 125 log_message(LOGLVL_ERROR, "%s: %s", functionname, strerror(errno)); 126 126 … … 128 128 } 129 129 130 static void log_null(int level, c har *message) {130 static void log_null(int level, const char *message) { 131 131 return; 132 132 } 133 133 134 static void log_irc(int level, c har *message) {134 static void log_irc(int level, const char *message) { 135 135 if(level == LOGLVL_ERROR) 136 136 irc_write_all(1, "ERROR :Error: %s", message); … … 147 147 } 148 148 149 static void log_syslog(int level, c har *message) {149 static void log_syslog(int level, const char *message) { 150 150 if(level == LOGLVL_ERROR) 151 151 syslog(LOG_ERR, "%s", message); … … 161 161 } 162 162 163 static void log_console(int level, c har *message) {163 static void log_console(int level, const char *message) { 164 164 if(level == LOGLVL_ERROR) 165 165 fprintf(stderr, "Error: %s\n", message); -
log.h
rb5c8a34 r764c7d1 44 44 45 45 typedef struct log_t { 46 void (*error)(int level, c har *logmessage);47 void (*warning)(int level, c har *logmessage);48 void (*informational)(int level, c har *logmessage);46 void (*error)(int level, const char *logmessage); 47 void (*warning)(int level, const char *logmessage); 48 void (*informational)(int level, const char *logmessage); 49 49 #ifdef DEBUG 50 void (*debug)(int level, c har *logmessage);50 void (*debug)(int level, const char *logmessage); 51 51 #endif 52 52 } log_t; … … 54 54 void log_init(void); 55 55 void log_link(int level, int output); 56 void log_message(int level, c har *message, ...) G_GNUC_PRINTF( 2, 3 );57 void log_error(c har *functionname);56 void log_message(int level, const char *message, ...) G_GNUC_PRINTF( 2, 3 ); 57 void log_error(const char *functionname); 58 58 59 59 #endif -
protocols/nogaim.c
rb5c8a34 r764c7d1 630 630 char *wrapped; 631 631 user_t *u; 632 632 633 /* pass the message through OTR */ 634 msg = otr_handle_message(ic, handle, msg); 635 if(!msg) { 636 /* this was an internal OTR protocol message */ 637 return; 638 } 639 633 640 u = user_findhandle( ic, handle ); 634 635 641 if( !u ) 636 642 { … … 642 648 imcb_log( ic, "Ignoring message from unknown handle %s", handle ); 643 649 650 g_free(msg); 644 651 return; 645 652 } … … 674 681 irc_msgfrom( irc, u->nick, wrapped ); 675 682 g_free( wrapped ); 683 g_free( msg ); 676 684 } 677 685 … … 991 999 msg = buf; 992 1000 } 993 994 st = ic->acc->prpl->buddy_msg( ic, handle, msg, flags ); 995 g_free( buf ); 996 1001 1002 /* if compiled without otr support, this just calls the prpl buddy_msg */ 1003 st = otr_send_message(ic, handle, msg, flags); 1004 1005 g_free(buf); 997 1006 return st; 998 1007 } -
root_commands.c
rb5c8a34 r764c7d1 29 29 #include "bitlbee.h" 30 30 #include "help.h" 31 #include "otr.h" 31 32 32 33 #include <string.h> … … 85 86 return; 86 87 88 if(!g_mutex_trylock(irc->otr_mutex)) { 89 irc_usermsg(irc, "keygen in progress, bitlbee comatose - please wait"); 90 return; 91 } 92 87 93 for( i = 0; commands[i].command; i++ ) 88 94 if( g_strcasecmp( commands[i].command, cmd[0] ) == 0 ) … … 91 97 { 92 98 irc_usermsg( irc, "Not enough parameters given (need %d)", commands[i].required_parameters ); 99 g_mutex_unlock(irc->otr_mutex); 93 100 return; 94 101 } 95 102 commands[i].execute( irc, cmd ); 103 g_mutex_unlock(irc->otr_mutex); 96 104 return; 97 105 } 98 106 99 107 irc_usermsg( irc, "Unknown command: %s. Please use \x02help commands\x02 to get a list of available commands.", cmd[0] ); 108 g_mutex_unlock(irc->otr_mutex); 100 109 } 101 110 … … 241 250 242 251 irc_usermsg( irc, "Account successfully added" ); 252 253 otr_check_for_key(a); 243 254 } 244 255 else if( g_strcasecmp( cmd[1], "del" ) == 0 ) … … 991 1002 { "qlist", 0, cmd_qlist, 0 }, 992 1003 { "join_chat", 2, cmd_join_chat, 0 }, 1004 { "otr", 1, cmd_otr, 0 }, 993 1005 { NULL } 994 1006 }; -
storage.c
rb5c8a34 r764c7d1 29 29 #include "bitlbee.h" 30 30 #include "crypting.h" 31 #include "otr.h" 31 32 32 33 extern storage_t storage_text; … … 115 116 if (status == STORAGE_OK) { 116 117 irc_setpass(irc, password); 118 otr_load(irc); /* load our OTR userstate */ 117 119 return status; 118 120 } 119 121 120 if (status != STORAGE_NO_SUCH_USER) 122 if (status != STORAGE_NO_SUCH_USER) { 121 123 return status; 124 } 122 125 } 123 126 … … 127 130 storage_status_t storage_save (irc_t *irc, int overwrite) 128 131 { 129 return ((storage_t *)global.storage->data)->save(irc, overwrite); 132 storage_status_t st; 133 134 otr_save(irc); 135 st = ((storage_t *)global.storage->data)->save(irc, overwrite); 136 return st; 130 137 } 131 138 … … 147 154 ret = status; 148 155 } 156 if (ret == STORAGE_OK) { 157 otr_remove(nick); 158 } 149 159 150 160 return ret; … … 157 167 storage_t *primary_storage = gl->data; 158 168 irc_t *irc; 159 169 160 170 /* First, try to rename in the current write backend, assuming onick 161 171 * is stored there */ 162 172 status = primary_storage->rename(onick, nnick, password); 163 if (status != STORAGE_NO_SUCH_USER) 173 if (status != STORAGE_NO_SUCH_USER) { 174 otr_rename(onick, nnick); 164 175 return status; 176 } 165 177 166 178 /* Try to load from a migration backend and save to the current backend. … … 186 198 187 199 storage_remove(onick, password); 200 otr_rename(onick, nnick); 188 201 189 202 return STORAGE_OK; -
unix.c
rb5c8a34 r764c7d1 27 27 #include "commands.h" 28 28 #include "crypting.h" 29 #include "otr.h" 29 30 #include "protocols/nogaim.h" 30 31 #include "help.h" … … 54 55 b_main_init(); 55 56 nogaim_init(); 57 otr_init(); 56 58 57 59 srand( time( NULL ) ^ getpid() ); -
user.c
rb5c8a34 r764c7d1 141 141 } 142 142 143 user_t *user_findhandle( struct im_connection *ic, c har *handle )143 user_t *user_findhandle( struct im_connection *ic, const char *handle ) 144 144 { 145 145 user_t *u; -
user.h
rb5c8a34 r764c7d1 56 56 int user_del( irc_t *irc, char *nick ); 57 57 G_MODULE_EXPORT user_t *user_find( irc_t *irc, char *nick ); 58 G_MODULE_EXPORT user_t *user_findhandle( struct im_connection *ic, c har *handle );58 G_MODULE_EXPORT user_t *user_findhandle( struct im_connection *ic, const char *handle ); 59 59 void user_rename( irc_t *irc, char *oldnick, char *newnick ); 60 60
Note: See TracChangeset
for help on using the changeset viewer.