Changeset bd69a21
- Timestamp:
- 2005-12-15T12:24:25Z (19 years ago)
- Branches:
- master
- Children:
- 4146a07
- Parents:
- 2983f5e (diff), bf02a67 (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:
-
- 3 added
- 1 deleted
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
.bzrignore
r2983f5e rbd69a21 17 17 build-arch-stamp 18 18 tags 19 decode 20 encode -
Makefile
r2983f5e rbd69a21 10 10 11 11 # Program variables 12 objects = account.o bitlbee.o commands.o crypting.o help.o ini.o irc.o nick.o query.o set.o url.o user.o log.o12 objects = account.o bitlbee.o commands.o crypting.o help.o ini.o irc.o log.o nick.o query.o set.o url.o user.o storage_text.o storage.o 13 13 subdirs = protocols 14 14 -
account.c
r2983f5e rbd69a21 124 124 } 125 125 126 if (a->prpl == NULL )127 {128 irc_usermsg( irc, "Support for protocol %s is not included in this BitlBee", a->prpl->name );129 return;130 }131 132 126 cancel_auto_reconnect( a ); 133 127 -
bitlbee.c
r2983f5e rbd69a21 27 27 #include "bitlbee.h" 28 28 #include "commands.h" 29 #include "crypting.h"30 29 #include "protocols/nogaim.h" 31 30 #include "help.h" … … 159 158 return FALSE; 160 159 } 161 160 161 /* Very naughty, go read the RFCs! >:) */ 162 if( irc->readbuffer && ( strlen( irc->readbuffer ) > 1024 ) ) 163 { 164 log_message( LOGLVL_ERROR, "Maximum line length exceeded." ); 165 irc_free( irc ); 166 return FALSE; 167 } 168 162 169 return TRUE; 163 170 } … … 230 237 } 231 238 232 /* DO NOT USE THIS FUNCTION IN NEW CODE. This233 * function is here merely because the save/load code still uses234 * ids rather then names */235 struct prpl *find_protocol_by_id(int id)236 {237 switch (id) {238 case 1: return find_protocol("oscar");239 case 4: return find_protocol("msn");240 case 2: return find_protocol("yahoo");241 case 8: return find_protocol("jabber");242 default: break;243 }244 return NULL;245 }246 247 int bitlbee_load( irc_t *irc, char* password )248 {249 char s[512];250 char *line;251 char proto[20];252 char nick[MAX_NICK_LENGTH+1];253 FILE *fp;254 user_t *ru = user_find( irc, ROOT_NICK );255 256 if( irc->status == USTATUS_IDENTIFIED )257 return( 1 );258 259 g_snprintf( s, 511, "%s%s%s", global.conf->configdir, irc->nick, ".accounts" );260 fp = fopen( s, "r" );261 if( !fp ) return( 0 );262 263 fscanf( fp, "%32[^\n]s", s );264 if( setpass( irc, password, s ) < 0 )265 {266 fclose( fp );267 return( -1 );268 }269 270 /* Do this now. If the user runs with AuthMode = Registered, the271 account command will not work otherwise. */272 irc->status = USTATUS_IDENTIFIED;273 274 while( fscanf( fp, "%511[^\n]s", s ) > 0 )275 {276 fgetc( fp );277 line = deobfucrypt( irc, s );278 root_command_string( irc, ru, line, 0 );279 g_free( line );280 }281 fclose( fp );282 283 g_snprintf( s, 511, "%s%s%s", global.conf->configdir, irc->nick, ".nicks" );284 fp = fopen( s, "r" );285 if( !fp ) return( 0 );286 while( fscanf( fp, "%s %s %s", s, proto, nick ) > 0 )287 {288 struct prpl *prpl;289 290 prpl = find_protocol(proto);291 292 /* Older files saved the protocol number rather then the protocol name */293 if (!prpl && atoi(proto)) {294 prpl = find_protocol_by_id(atoi(proto));295 }296 297 if (!prpl)298 continue;299 300 http_decode( s );301 nick_set( irc, s, prpl, nick );302 }303 fclose( fp );304 305 if( set_getint( irc, "auto_connect" ) )306 {307 strcpy( s, "account on" ); /* Can't do this directly because r_c_s alters the string */308 root_command_string( irc, ru, s, 0 );309 }310 311 return( 1 );312 }313 314 int bitlbee_save( irc_t *irc )315 {316 char s[512];317 char path[512], new_path[512];318 char *line;319 nick_t *n;320 set_t *set;321 mode_t ou = umask( 0077 );322 account_t *a;323 FILE *fp;324 char *hash;325 326 /*\327 * [SH] Nothing should be saved if no password is set, because the328 * password is not set if it was wrong, or if one is not identified329 * yet. This means that a malicious user could easily overwrite330 * files owned by someone else:331 * a Bad Thing, methinks332 \*/333 334 /* [WVG] No? Really? */335 336 /*\337 * [SH] Okay, okay, it wasn't really Wilmer who said that, it was338 * me. I just thought it was funny.339 \*/340 341 hash = hashpass( irc );342 if( hash == NULL )343 {344 irc_usermsg( irc, "Please register yourself if you want to save your settings." );345 return( 0 );346 }347 348 g_snprintf( path, 511, "%s%s%s", global.conf->configdir, irc->nick, ".nicks~" );349 fp = fopen( path, "w" );350 if( !fp ) return( 0 );351 for( n = irc->nicks; n; n = n->next )352 {353 strcpy( s, n->handle );354 s[169] = 0; /* Prevent any overflow (169 ~ 512 / 3) */355 http_encode( s );356 g_snprintf( s + strlen( s ), 510 - strlen( s ), " %s %s", n->proto->name, n->nick );357 if( fprintf( fp, "%s\n", s ) != strlen( s ) + 1 )358 {359 irc_usermsg( irc, "fprintf() wrote too little. Disk full?" );360 fclose( fp );361 return( 0 );362 }363 }364 if( fclose( fp ) != 0 )365 {366 irc_usermsg( irc, "fclose() reported an error. Disk full?" );367 return( 0 );368 }369 370 g_snprintf( new_path, 512, "%s%s%s", global.conf->configdir, irc->nick, ".nicks" );371 if( unlink( new_path ) != 0 )372 {373 if( errno != ENOENT )374 {375 irc_usermsg( irc, "Error while removing old .nicks file" );376 return( 0 );377 }378 }379 if( rename( path, new_path ) != 0 )380 {381 irc_usermsg( irc, "Error while renaming new .nicks file" );382 return( 0 );383 }384 385 g_snprintf( path, 511, "%s%s%s", global.conf->configdir, irc->nick, ".accounts~" );386 fp = fopen( path, "w" );387 if( !fp ) return( 0 );388 if( fprintf( fp, "%s", hash ) != strlen( hash ) )389 {390 irc_usermsg( irc, "fprintf() wrote too little. Disk full?" );391 fclose( fp );392 return( 0 );393 }394 g_free( hash );395 396 for( a = irc->accounts; a; a = a->next )397 {398 if( !strcmp( a->prpl->name, "oscar" ) )399 g_snprintf( s, sizeof( s ), "account add oscar \"%s\" \"%s\" %s", a->user, a->pass, a->server );400 else401 g_snprintf( s, sizeof( s ), "account add %s \"%s\" \"%s\" \"%s\"",402 a->prpl->name, a->user, a->pass, a->server ? a->server : "" );403 404 line = obfucrypt( irc, s );405 if( *line )406 {407 if( fprintf( fp, "%s\n", line ) != strlen( line ) + 1 )408 {409 irc_usermsg( irc, "fprintf() wrote too little. Disk full?" );410 fclose( fp );411 return( 0 );412 }413 }414 g_free( line );415 }416 417 for( set = irc->set; set; set = set->next )418 {419 if( set->value && set->def )420 {421 g_snprintf( s, sizeof( s ), "set %s \"%s\"", set->key, set->value );422 line = obfucrypt( irc, s );423 if( *line )424 {425 if( fprintf( fp, "%s\n", line ) != strlen( line ) + 1 )426 {427 irc_usermsg( irc, "fprintf() wrote too little. Disk full?" );428 fclose( fp );429 return( 0 );430 }431 }432 g_free( line );433 }434 }435 436 if( strcmp( irc->mynick, ROOT_NICK ) != 0 )437 {438 g_snprintf( s, sizeof( s ), "rename %s %s", ROOT_NICK, irc->mynick );439 line = obfucrypt( irc, s );440 if( *line )441 {442 if( fprintf( fp, "%s\n", line ) != strlen( line ) + 1 )443 {444 irc_usermsg( irc, "fprintf() wrote too little. Disk full?" );445 fclose( fp );446 return( 0 );447 }448 }449 g_free( line );450 }451 if( fclose( fp ) != 0 )452 {453 irc_usermsg( irc, "fclose() reported an error. Disk full?" );454 return( 0 );455 }456 457 g_snprintf( new_path, 512, "%s%s%s", global.conf->configdir, irc->nick, ".accounts" );458 if( unlink( new_path ) != 0 )459 {460 if( errno != ENOENT )461 {462 irc_usermsg( irc, "Error while removing old .accounts file" );463 return( 0 );464 }465 }466 if( rename( path, new_path ) != 0 )467 {468 irc_usermsg( irc, "Error while renaming new .accounts file" );469 return( 0 );470 }471 472 umask( ou );473 474 return( 1 );475 }476 477 239 void bitlbee_shutdown( gpointer data ) 478 240 { -
bitlbee.h
r2983f5e rbd69a21 30 30 31 31 #define PACKAGE "BitlBee" 32 #define BITLBEE_VERSION " 1.0pre"32 #define BITLBEE_VERSION "BZR" 33 33 #define VERSION BITLBEE_VERSION 34 34 … … 100 100 101 101 #include "irc.h" 102 #include "storage.h" 102 103 #include "set.h" 103 104 #include "protocols/nogaim.h" … … 115 116 help_t *help; 116 117 conf_t *conf; 118 GList *storage; /* The first backend in the list will be used for saving */ 117 119 char *helpfile; 118 120 GMainLoop *loop; … … 127 129 int root_command_string( irc_t *irc, user_t *u, char *command, int flags ); 128 130 int root_command( irc_t *irc, char *command[] ); 129 int bitlbee_load( irc_t *irc, char *password );130 int bitlbee_save( irc_t *irc );131 131 void bitlbee_shutdown( gpointer data ); 132 132 double gettime( void ); -
commands.c
r2983f5e rbd69a21 86 86 int cmd_identify( irc_t *irc, char **cmd ) 87 87 { 88 int checkie = bitlbee_load( irc, cmd[1]);89 90 if( checkie == -1 )91 {88 storage_status_t status = storage_load( irc->nick, cmd[1], irc ); 89 90 switch (status) { 91 case STORAGE_INVALID_PASSWORD: 92 92 irc_usermsg( irc, "Incorrect password" ); 93 } 94 else if( checkie == 0 ) 95 { 93 break; 94 case STORAGE_NO_SUCH_USER: 96 95 irc_usermsg( irc, "The nick is (probably) not registered" ); 97 } 98 else if( checkie == 1 ) 99 { 96 break; 97 case STORAGE_OK: 100 98 irc_usermsg( irc, "Password accepted" ); 101 } 102 else 103 { 99 break; 100 default: 104 101 irc_usermsg( irc, "Something very weird happened" ); 105 } 106 102 break; 103 } 104 107 105 return( 0 ); 108 106 } … … 110 108 int cmd_register( irc_t *irc, char **cmd ) 111 109 { 112 int checkie;113 char path[512];114 115 110 if( global.conf->authmode == AUTHMODE_REGISTERED ) 116 111 { … … 118 113 return( 0 ); 119 114 } 120 121 g_snprintf( path, 511, "%s%s%s", global.conf->configdir, irc->nick, ".accounts" ); 122 checkie = access( path, F_OK ); 123 124 g_snprintf( path, 511, "%s%s%s", global.conf->configdir, irc->nick, ".nicks" ); 125 checkie += access( path, F_OK ); 126 127 if( checkie == -2 ) 128 { 129 setpassnc( irc, cmd[1] ); 130 root_command_string( irc, user_find( irc, irc->mynick ), "save", 0 ); 131 irc->status = USTATUS_IDENTIFIED; 132 } 133 else 134 { 135 irc_usermsg( irc, "Nick is already registered" ); 115 116 irc_setpass( irc, cmd[1] ); 117 switch( storage_save( irc, FALSE )) { 118 case STORAGE_ALREADY_EXISTS: 119 irc_usermsg( irc, "Nick is already registered" ); 120 break; 121 122 case STORAGE_OK: 123 irc->status = USTATUS_IDENTIFIED; 124 break; 125 126 default: 127 irc_usermsg( irc, "Error registering" ); 128 break; 136 129 } 137 130 … … 141 134 int cmd_drop( irc_t *irc, char **cmd ) 142 135 { 143 char s[512]; 144 FILE *fp; 145 146 g_snprintf( s, 511, "%s%s%s", global.conf->configdir, irc->nick, ".accounts" ); 147 fp = fopen( s, "r" ); 148 if( !fp ) 149 { 136 storage_status_t status; 137 138 status = storage_remove (irc->nick, cmd[1]); 139 switch (status) { 140 case STORAGE_NO_SUCH_USER: 150 141 irc_usermsg( irc, "That account does not exist" ); 151 142 return( 0 ); 152 } 153 154 fscanf( fp, "%32[^\n]s", s ); 155 fclose( fp ); 156 if( setpass( irc, cmd[1], s ) < 0 ) 157 { 158 irc_usermsg( irc, "Incorrect password" ); 159 return( 0 ); 160 } 161 162 g_snprintf( s, 511, "%s%s%s", global.conf->configdir, irc->nick, ".accounts" ); 163 unlink( s ); 164 165 g_snprintf( s, 511, "%s%s%s", global.conf->configdir, irc->nick, ".nicks" ); 166 unlink( s ); 167 168 setpassnc( irc, NULL ); 169 irc_usermsg( irc, "Files belonging to account `%s' removed", irc->nick ); 170 171 return( 0 ); 143 case STORAGE_INVALID_PASSWORD: 144 irc_usermsg( irc, "Password invalid" ); 145 return( 0 ); 146 case STORAGE_OK: 147 irc_setpass( irc, NULL ); 148 irc_usermsg( irc, "Account `%s' removed", irc->nick ); 149 return( 0 ); 150 default: 151 irc_usermsg( irc, "Error: '%d'", status ); 152 return( 0 ); 153 } 172 154 } 173 155 … … 623 605 int cmd_save( irc_t *irc, char **cmd ) 624 606 { 625 if( bitlbee_save( irc ))607 if( storage_save( irc, TRUE ) == STORAGE_OK ) 626 608 irc_usermsg( irc, "Configuration saved" ); 627 609 else -
conf.c
r2983f5e rbd69a21 50 50 conf->nofork = 0; 51 51 conf->verbose = 0; 52 conf->primary_storage = "text"; 52 53 conf->runmode = RUNMODE_INETD; 53 54 conf->authmode = AUTHMODE_OPEN; … … 198 199 conf->motdfile = g_strdup( ini->value ); 199 200 } 201 else if( g_strcasecmp( ini->key, "account_storage" ) == 0 ) 202 { 203 g_free( conf->primary_storage ); 204 conf->primary_storage = g_strdup( ini->value ); 205 } 206 else if( g_strcasecmp( ini->key, "account_storage_migrate" ) == 0 ) 207 { 208 g_strfreev( conf->migrate_storage ); 209 conf->migrate_storage = g_strsplit( ini->value, " \t,;", -1 ); 210 } 200 211 else if( g_strcasecmp( ini->key, "pinginterval" ) == 0 ) 201 212 { -
conf.h
r2983f5e rbd69a21 42 42 char *configdir; 43 43 char *motdfile; 44 char *primary_storage; 45 char **migrate_storage; 44 46 int ping_interval; 45 47 int ping_timeout; -
configure
r2983f5e rbd69a21 57 57 --strip=0/1 Disable/enable binary stripping $strip 58 58 59 --flood=0/1 Flood protection $flood60 59 --ipv6=0/1 IPv6 socket support $ipv6 61 60 … … 287 286 288 287 if [ "$flood" = 1 ]; then 289 echo '#define FLOOD_SEND' >> config.h 288 # echo '#define FLOOD_SEND' >> config.h 289 echo 'Flood protection is disabled in this release because of too many bugs.' 2> /dev/stderr 290 rm config.h 291 rm Makefile.settings 292 exit 1 290 293 fi 291 294 … … 345 348 case "$arch" in 346 349 Linux ) 347 echo 'Linux.'348 350 ;; 349 351 GNU/* ) 350 echo 'Debian with non-Linux kernel?'351 352 ;; 352 353 *BSD ) 353 echo '*BSD.'354 354 echo 'EFLAGS+=-liconv' >> Makefile.settings; 355 355 ;; 356 356 SunOS ) 357 echo 'Solaris.'358 357 echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings 359 358 echo 'STRIP=\# skip strip' >> Makefile.settings … … 361 360 ;; 362 361 Darwin ) 363 echo 'Darwin/Mac OS X.'364 362 echo 'EFLAGS+=-liconv' >> Makefile.settings; 365 363 ;; 366 364 IRIX ) 367 echo 'IRIX.'368 365 ;; 369 366 CYGWIN* ) … … 371 368 ;; 372 369 * ) 373 echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV. Please report any problems to <wilmer@gaast.net>.' 370 echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.' 371 echo 'Please report any problems at http://bugs.bitlbee.org/.' 374 372 ;; 375 373 esac … … 394 392 fi 395 393 396 if [ "$flood" = "0" ]; then397 echo ' Flood protection disabled.';398 else399 echo ' Flood protection enabled.';400 fi394 #if [ "$flood" = "0" ]; then 395 # echo ' Flood protection disabled.'; 396 #else 397 # echo ' Flood protection enabled.'; 398 #fi 401 399 402 400 if [ -n "$protocols" ]; then -
crypting.c
r2983f5e rbd69a21 29 29 the programs will be built. */ 30 30 31 #ifndef CRYPTING_MAIN32 #define BITLBEE_CORE33 #include "bitlbee.h"34 #include "irc.h"35 31 #include "md5.h" 36 32 #include "crypting.h" … … 38 34 #include <stdio.h> 39 35 #include <stdlib.h> 40 41 #else42 43 typedef struct irc44 {45 char *password;46 } irc_t;47 48 #define set_add( a, b, c, d )49 #define set_find( a, b ) NULL50 51 #include "md5.h"52 #include "crypting.h"53 #include <string.h>54 #include <stdio.h>55 #include <stdlib.h>56 57 #define irc_usermsg58 59 #endif60 36 61 37 /*\ … … 65 41 \*/ 66 42 67 /* USE WITH CAUTION! 68 Sets pass without checking */ 69 void setpassnc (irc_t *irc, char *pass) { 70 if (!set_find (irc, "password")) 71 set_add (irc, "password", NULL, passchange); 72 73 if (irc->password) g_free (irc->password); 74 75 if (pass) { 76 irc->password = g_strdup (pass); 77 irc_usermsg (irc, "Password successfully changed"); 78 } else { 79 irc->password = NULL; 80 } 81 } 82 83 char *passchange (irc_t *irc, void *set, char *value) { 84 setpassnc (irc, value); 85 return (NULL); 86 } 87 88 int setpass (irc_t *irc, char *pass, char* md5sum) { 43 int checkpass (const char *pass, const char *md5sum) 44 { 89 45 md5_state_t md5state; 90 46 md5_byte_t digest[16]; … … 103 59 if (digits[1] != md5sum[j + 1]) return (-1); 104 60 } 105 106 /* If pass is correct, we end up here and we set the pass */ 107 setpassnc (irc, pass); 108 109 return (0); 61 62 return( 0 ); 110 63 } 111 64 112 char *hashpass (irc_t *irc) { 65 66 char *hashpass (const char *password) 67 { 113 68 md5_state_t md5state; 114 69 md5_byte_t digest[16]; … … 117 72 char *rv; 118 73 119 if ( irc->password == NULL) return (NULL);74 if (password == NULL) return (NULL); 120 75 121 rv = (char *)g_malloc (33); 122 memset (rv, 0, 33); 76 rv = g_new0 (char, 33); 123 77 124 78 md5_init (&md5state); 125 md5_append (&md5state, ( unsigned char *)irc->password, strlen (irc->password));79 md5_append (&md5state, (const unsigned char *)password, strlen (password)); 126 80 md5_finish (&md5state, digest); 127 81 … … 135 89 } 136 90 137 char *obfucrypt (irc_t *irc, char *line) { 91 char *obfucrypt (char *line, const char *password) 92 { 138 93 int i, j; 139 94 char *rv; 140 95 141 if ( irc->password == NULL) return (NULL);96 if (password == NULL) return (NULL); 142 97 143 rv = (char *)g_malloc (strlen (line) + 1); 144 memset (rv, '\0', strlen (line) + 1); 98 rv = g_new0 (char, strlen (line) + 1); 145 99 146 100 i = j = 0; … … 148 102 /* Encrypt/obfuscate the line, using the password */ 149 103 if (*(signed char*)line < 0) *line = - (*line); 150 if (((signed char*)irc->password)[i] < 0) irc->password[i] = - irc->password[i];151 104 152 rv[j] = *line + irc->password[i]; /* Overflow intended */105 rv[j] = *line + password[i]; /* Overflow intended */ 153 106 154 107 line++; 155 if (! irc->password[++i]) i = 0;108 if (!password[++i]) i = 0; 156 109 j++; 157 110 } … … 160 113 } 161 114 162 char *deobfucrypt (irc_t *irc, char *line) { 115 char *deobfucrypt (char *line, const char *password) 116 { 163 117 int i, j; 164 118 char *rv; 165 119 166 if ( irc->password == NULL) return (NULL);120 if (password == NULL) return (NULL); 167 121 168 rv = (char *)g_malloc (strlen (line) + 1); 169 memset (rv, '\0', strlen (line) + 1); 122 rv = g_new0 (char, strlen (line) + 1); 170 123 171 124 i = j = 0; 172 125 while (*line) { 173 126 /* Decrypt/deobfuscate the line, using the pass */ 174 rv[j] = *line - irc->password[i]; /* Overflow intended */127 rv[j] = *line - password[i]; /* Overflow intended */ 175 128 176 129 line++; 177 if (! irc->password[++i]) i = 0;130 if (!password[++i]) i = 0; 178 131 j++; 179 132 } … … 189 142 int main( int argc, char *argv[] ) 190 143 { 191 irc_t *irc = g_malloc( sizeof( irc_t ) );192 144 char *hash, *action, line[256]; 193 char* (*func)( irc_t *,char * );145 char* (*func)( char *, const char * ); 194 146 195 147 if( argc < 2 ) … … 201 153 } 202 154 203 memset( irc, 0, sizeof( irc_t ) ); 204 irc->password = g_strdup( argv[1] ); 205 206 hash = hashpass( irc ); 155 hash = hashpass( argv[1] ); 207 156 action = argv[0] + strlen( argv[0] ) - strlen( "encode" ); 208 157 … … 236 185 fgetc( stdin ); 237 186 238 out = func( irc, line);187 out = func( line, argv[1] ); 239 188 printf( "%s\n", out ); 240 189 g_free( out ); -
crypting.h
r2983f5e rbd69a21 24 24 */ 25 25 26 void setpassnc (irc_t *irc, char *pass); /* USE WITH CAUTION! */ 27 char *passchange (irc_t *irc, void *set, char *value); 28 int setpass (irc_t *irc, char *pass, char* md5sum); 29 char *hashpass (irc_t *irc); 30 char *obfucrypt (irc_t *irc, char *line); 31 char *deobfucrypt (irc_t *irc, char *line); 26 int checkpass (const char *password, const char *md5sum); 27 char *hashpass (const char *password); 28 char *obfucrypt (char *line, const char *password); 29 char *deobfucrypt (char *line, const char *password); -
doc/AUTHORS
r2983f5e rbd69a21 4 4 Main developer 5 5 6 Jelmer 'ctrlsoft' Vernooij <jelmer@ nl.linux.org>6 Jelmer 'ctrlsoft' Vernooij <jelmer@samba.org> 7 7 Documentation, general hacking, Win32 port 8 8 -
doc/CHANGES
r2983f5e rbd69a21 11 11 handlers for headline messages (which allows you to use RSS-to-Jabber 12 12 gateways). 13 14 Finished ... 13 - Lowered the line splitting limit a bit to fix data loss issues. 14 - The $proto($handle) format used for messages specific to one IM-connection 15 now only include the ($handle) part when there's more than one $proto- 16 connection. 17 - Fix for a crash-bug on broken Jabber/SSL connections. 18 - Incoming typing notifications now also come in as CTCP TYPING messages, for 19 better consistency. Don't forget to update your scripts! 20 - AIM typing notifications are supported now. 21 - Jabber module only accepts ports 5220-5229 now, to prevent people from 22 abusing it as a port scanner. We aren't aware of any Jabber server that 23 runs on other ports than those. If you are, please warn us. 24 - Send flood protection can't be enabled anymore. It was disabled by default 25 for a good reason for some time already, but some package maintainers 26 turned it back on while it's way too unreliable and trigger-happy to be 27 used. 28 - Removed TODO file, the current to-do list is always in the on-line bug 29 tracking system. 30 - Fixed a potential DoS bug in input handling. 31 32 Finished 4 Dec 2005 15 33 16 34 Version 0.99: -
doc/FAQ
r2983f5e rbd69a21 39 39 40 40 Q: When is $random_feature going to be implemented? 41 A: Please do consult doc/TODO (preferably in a development snapshot, which 42 is more up-to-date than a TODO in a release version) before asking. 43 Please also check the documentation. You'd not be the first one to request 44 a feature which already exists! 45 46 If your fabulous feature seems not to be requested before, just join 47 #bitlbee on irc.oftc.net and tell us the news. 48 49 If your feature request is already in the TODO list, of course you can 50 still request it again/make us know that you'd like to see the feature as 51 well. But when the feature is in the "post-1.0" list, it's probably not 52 going to help. Most of the features in this list are low-priority because 53 we (the developers) don't need (or even want) them. (File transfers are a 54 good example here.) 55 Hence, they'll only be implemented when we really got too much spare 56 time. Obviously, if you're willing to help (i.e. submit a patch), you're 57 always welcome. 41 A: It depends on the feature. We keep a list of all wishlist "bugs" in our 42 Bug Tracking system at http://bugs.bitlbee.org/ 58 43 59 44 Q: The messages I send and/or receive look weird. I see weird characters and … … 61 46 non-ASCII characters! 62 47 A: You probably have to change some settings. To get rid of HTML in messages, 63 see "help set html". If you seem to have problems with your charset, see 64 "help set charset". 48 see "help set strip_html". If you seem to have problems with your charset, 49 see "help set charset". 50 51 Although actually most of these problems should be gone by now. So if you 52 can't get things to work well, you might have found a bug. 65 53 66 54 Q: Is BitlBee forked from Gaim? -
doc/README
r2983f5e rbd69a21 108 108 See utils/bitlbeed.c for more information about the program. 109 109 110 Just a little note: We run our public server im.bitlbee.org for a couple of 111 months now, and so far we haven't experienced this problem yet. The only 112 BitlBee processes killed because of CPU-time overuse were running for a long 113 time already, they were usually killed during the MSN login process (which 114 is quite CPU-time consuming). 110 Just a little note: Now that we reach version 1.0, this shouldn't be that 111 much of an issue anymore. However, on a public server, especially if you 112 also use it for other things, it can't hurt to protect yourself against 113 possible problems. 115 114 116 115 … … 145 144 You can find new releases of BitlBee at: 146 145 http://www.bitlbee.org/ 146 147 The bug tracking system: 148 http://bugs.bitlbee.org/ 149 150 Our version control system is Bazaar-NG. Our repository is at: 151 http://code.bitlbee.org/ 147 152 148 153 … … 187 192 BitlBee - An IRC to other chat networks gateway 188 193 <http://www.bitlbee.org/> 189 Copyright (C) 2002-200 4Wilmer van der Gaast <wilmer@gaast.net>194 Copyright (C) 2002-2005 Wilmer van der Gaast <wilmer@gaast.net> 190 195 and others -
doc/user-guide/user-guide.xml
r2983f5e rbd69a21 21 21 22 22 <legalnotice id="legalnotice"> 23 <para>24 Permission is granted to copy, distribute and/or modify this25 document under the terms of the <ulink type="help"26 url="gnome-help:fdl"><citetitle>GNU Free Documentation27 License</citetitle></ulink>, Version 1.1 or any later version28 published by the Free Software Foundation with no Invariant29 Sections, no Front-Cover Texts, and no Back-Cover Texts. You30 may obtain a copy of the <citetitle>GNU Free Documentation31 License</citetitle> from the Free Software Foundation by32 visiting <ulink type="http" url="http://www.fsf.org">their33 Web site</ulink> or by writing to: Free Software Foundation,34 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,35 USA.36 </para>37 23 </legalnotice> 38 24 39 25 <releaseinfo> 40 This is the initial release of the BitlBee User Guide. 26 This is the BitlBee User Guide. For now, the on-line help is 27 the most up-to-date documentation. Although this document shares 28 some parts with the on-line help system, other parts might be 29 very outdated. 41 30 </releaseinfo> 42 31 -
irc.c
r2983f5e rbd69a21 31 31 32 32 GSList *irc_connection_list = NULL; 33 34 static char *passchange (irc_t *irc, void *set, char *value) 35 { 36 irc_setpass (irc, value); 37 return (NULL); 38 } 33 39 34 40 irc_t *irc_new( int fd ) … … 129 135 set_add( irc, "to_char", ": ", set_eval_to_char ); 130 136 set_add( irc, "typing_notice", "false", set_eval_bool ); 137 set_add( irc, "password", NULL, passchange); 131 138 132 139 conf_loaddefaults( irc ); … … 154 161 155 162 if( irc->status >= USTATUS_IDENTIFIED && set_getint( irc, "save_on_quit" ) ) 156 if( !bitlbee_save( irc ))163 if( storage_save( irc, TRUE ) != STORAGE_OK ) 157 164 irc_usermsg( irc, "Error while saving settings!" ); 158 165 … … 259 266 if( global.conf->runmode == RUNMODE_INETD ) 260 267 g_main_quit( global.loop ); 268 } 269 270 /* USE WITH CAUTION! 271 Sets pass without checking */ 272 void irc_setpass (irc_t *irc, const char *pass) 273 { 274 if (irc->password) g_free (irc->password); 275 276 if (pass) { 277 irc->password = g_strdup (pass); 278 irc_usermsg (irc, "Password successfully changed"); 279 } else { 280 irc->password = NULL; 281 } 261 282 } 262 283 … … 1510 1531 { 1511 1532 irc_write( irc, ":%s!%s@%s %s %s :%s%s", u->nick, u->user, u->host, 1512 type, to, prefix , line );1533 type, to, prefix ? prefix : "", line ); 1513 1534 } 1514 1535 line = s + 1; -
irc.h
r2983f5e rbd69a21 137 137 void irc_whois( irc_t *irc, char *nick ); 138 138 int irc_away( irc_t *irc, char *away ); 139 void irc_setpass( irc_t *irc, const char *pass ); /* USE WITH CAUTION! */ 139 140 140 141 int irc_send( irc_t *irc, char *nick, char *s, int flags ); -
nick.c
r2983f5e rbd69a21 27 27 #include "bitlbee.h" 28 28 29 void nick_set( irc_t *irc, c har *handle, struct prpl *proto,char *nick )29 void nick_set( irc_t *irc, const char *handle, struct prpl *proto, const char *nick ) 30 30 { 31 31 nick_t *m = NULL, *n = irc->nicks; … … 56 56 } 57 57 58 char *nick_get( irc_t *irc, c har *handle, struct prpl *proto, const char *realname )58 char *nick_get( irc_t *irc, const char *handle, struct prpl *proto, const char *realname ) 59 59 { 60 60 static char nick[MAX_NICK_LENGTH+1]; … … 129 129 } 130 130 131 void nick_del( irc_t *irc, c har *nick )131 void nick_del( irc_t *irc, const char *nick ) 132 132 { 133 133 nick_t *l = NULL, *n = irc->nicks; … … 176 176 } 177 177 178 int nick_ok( c har *nick )179 { 180 c har *s;178 int nick_ok( const char *nick ) 179 { 180 const char *s; 181 181 182 182 /* Empty/long nicks are not allowed */ … … 237 237 } 238 238 239 int nick_cmp( c har *a,char *b )239 int nick_cmp( const char *a, const char *b ) 240 240 { 241 241 char aa[1024] = "", bb[1024] = ""; … … 253 253 } 254 254 255 char *nick_dup( char *nick ) 256 { 257 char *cp; 258 259 cp = g_new0 ( char, MAX_NICK_LENGTH + 1 ); 260 strncpy( cp, nick, MAX_NICK_LENGTH ); 261 262 return( cp ); 263 } 255 char *nick_dup( const char *nick ) 256 { 257 return g_strndup( nick, MAX_NICK_LENGTH ); 258 } -
nick.h
r2983f5e rbd69a21 32 32 } nick_t; 33 33 34 void nick_set( irc_t *irc, c har *handle, struct prpl *proto,char *nick );35 char *nick_get( irc_t *irc, c har *handle, struct prpl *proto, const char *realname );36 void nick_del( irc_t *irc, c har *nick );34 void nick_set( irc_t *irc, const char *handle, struct prpl *proto, const char *nick ); 35 char *nick_get( irc_t *irc, const char *handle, struct prpl *proto, const char *realname ); 36 void nick_del( irc_t *irc, const char *nick ); 37 37 void nick_strip( char *nick ); 38 38 39 int nick_ok( c har *nick );39 int nick_ok( const char *nick ); 40 40 int nick_lc( char *nick ); 41 41 int nick_uc( char *nick ); 42 int nick_cmp( c har *a,char *b );43 char *nick_dup( c har *nick );42 int nick_cmp( const char *a, const char *b ); 43 char *nick_dup( const char *nick ); -
protocols/jabber/jabber.c
r2983f5e rbd69a21 22 22 */ 23 23 24 #ifdef HAVE_CONFIG_H25 #include "config.h"26 #endif27 28 24 #ifndef _WIN32 29 25 #include <sys/utsname.h> … … 59 55 #define DEFAULT_PORT 5222 60 56 #define DEFAULT_PORT_SSL 5223 57 #define JABBER_PORT_MIN 5220 58 #define JABBER_PORT_MAX 5229 61 59 62 60 #define JABBER_GROUP "Friends" … … 541 539 gjconn gjc; 542 540 543 if (!g_slist_find(get_connections(), gc)) {544 ssl_disconnect(source);545 return;546 }547 548 541 jd = gc->proto_data; 549 542 gjc = jd->gjc; … … 551 544 if (source == NULL) { 552 545 STATE_EVT(JCONN_STATE_OFF) 546 return; 547 } 548 549 if (!g_slist_find(get_connections(), gc)) { 550 ssl_disconnect(source); 553 551 return; 554 552 } … … 589 587 else if (port == -1 && ssl) 590 588 port = DEFAULT_PORT_SSL; 589 else if (port < JABBER_PORT_MIN || port > JABBER_PORT_MAX) { 590 serv_got_crap(GJ_GC(gjc), "For security reasons, the Jabber port number must be in the %d-%d range.", JABBER_PORT_MIN, JABBER_PORT_MAX); 591 STATE_EVT(JCONN_STATE_OFF) 592 return; 593 } 591 594 592 595 if (server == NULL) -
protocols/msn/sb.c
r2983f5e rbd69a21 644 644 if( who ) 645 645 { 646 serv_got_typing( gc, who, 5 );646 serv_got_typing( gc, who, 5, 1 ); 647 647 g_free( who ); 648 648 } -
protocols/nogaim.c
r2983f5e rbd69a21 55 55 GSList *connections; 56 56 57 #ifdef WITH_PLUGINS 57 58 gboolean load_plugin(char *path) 58 59 { … … 75 76 return TRUE; 76 77 } 78 79 void load_plugins(void) 80 { 81 GDir *dir; 82 GError *error = NULL; 83 84 dir = g_dir_open(PLUGINDIR, 0, &error); 85 86 if (dir) { 87 const gchar *entry; 88 char *path; 89 90 while ((entry = g_dir_read_name(dir))) { 91 path = g_build_filename(PLUGINDIR, entry, NULL); 92 if(!path) { 93 log_message(LOGLVL_WARNING, "Can't build path for %s\n", entry); 94 continue; 95 } 96 97 load_plugin(path); 98 99 g_free(path); 100 } 101 102 g_dir_close(dir); 103 } 104 } 105 #endif 77 106 78 107 /* nogaim.c */ … … 101 130 void nogaim_init() 102 131 { 103 GDir *dir; 104 GError *error = NULL; 132 extern void msn_init(); 133 extern void oscar_init(); 134 extern void byahoo_init(); 135 extern void jabber_init(); 105 136 106 137 #ifdef WITH_MSN 107 extern void msn_init();108 138 msn_init(); 109 139 #endif 110 140 111 141 #ifdef WITH_OSCAR 112 extern void oscar_init();113 142 oscar_init(); 114 143 #endif 115 144 116 145 #ifdef WITH_YAHOO 117 extern void byahoo_init();118 146 byahoo_init(); 119 147 #endif 120 148 121 149 #ifdef WITH_JABBER 122 extern void jabber_init();123 150 jabber_init(); 124 151 #endif 125 152 126 dir = g_dir_open(PLUGINDIR, 0, &error); 127 128 if (dir) { 129 const gchar *entry; 130 char *path; 131 132 while ((entry = g_dir_read_name(dir))) { 133 path = g_build_filename(PLUGINDIR, entry, NULL); 134 if(!path) { 135 log_message(LOGLVL_WARNING, "Can't build path for %s\n", entry); 136 continue; 137 } 138 139 load_plugin(path); 140 141 g_free(path); 142 } 143 144 g_dir_close(dir); 145 } 153 #ifdef WITH_PLUGINS 154 load_plugins(); 155 #endif 146 156 } 147 157 … … 442 452 void do_error_dialog( struct gaim_connection *gc, char *msg, char *title ) 443 453 { 444 serv_got_crap( gc, "Error: %s", msg ); 454 if( msg && title ) 455 serv_got_crap( gc, "Error: %s: %s", title, msg ); 456 else if( msg ) 457 serv_got_crap( gc, "Error: %s", msg ); 458 else if( title ) 459 serv_got_crap( gc, "Error: %s", title ); 460 else 461 serv_got_crap( gc, "Error" ); 445 462 } 446 463 … … 727 744 /* If there's a newline/space in this string, split up there, 728 745 looks a bit prettier. */ 729 if( ( nl = strrchr( msg, '\n' ) ) || ( nl = str chr( msg, ' ' ) ) )746 if( ( nl = strrchr( msg, '\n' ) ) || ( nl = strrchr( msg, ' ' ) ) ) 730 747 { 731 748 msg[425] = tmp; … … 751 768 } 752 769 753 void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout )770 void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int type ) 754 771 { 755 772 user_t *u; … … 758 775 return; 759 776 760 if( ( u = user_findhandle( gc, handle ) ) ) 761 irc_msgfrom( gc->irc, u->nick, "\1TYPING 1\1" ); 777 if( ( u = user_findhandle( gc, handle ) ) ) { 778 /* If type is: 779 * 0: user has stopped typing 780 * 1: user is actively typing 781 * 2: user has entered text, but is not actively typing 782 */ 783 if (type == 0 || type == 1 || type == 2) { 784 char buf[256]; 785 g_snprintf(buf, 256, "\1TYPING %d\1", type); 786 irc_privmsg( gc->irc, u, "PRIVMSG", gc->irc->nick, NULL, buf ); 787 } 788 } 762 789 } 763 790 -
protocols/nogaim.h
r2983f5e rbd69a21 307 307 G_MODULE_EXPORT void serv_got_update( struct gaim_connection *gc, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps ); 308 308 G_MODULE_EXPORT void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 flags, time_t mtime, gint len ); 309 G_MODULE_EXPORT void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout );309 G_MODULE_EXPORT void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int type ); 310 310 G_MODULE_EXPORT void serv_got_chat_invite( struct gaim_connection *gc, char *handle, char *who, char *msg, GList *data ); 311 311 G_MODULE_EXPORT struct conversation *serv_got_joined_chat( struct gaim_connection *gc, int id, char *handle ); … … 326 326 G_MODULE_EXPORT void info_string_append(GString *str, char *newline, char *name, char *value); 327 327 328 /* file transfers */329 G_MODULE_EXPORT void ft_progress( struct ft *, int);330 G_MODULE_EXPORT void ft_incoming( struct ft_request * );331 G_MODULE_EXPORT void ft_accepted( struct ft_request *, struct ft *);332 G_MODULE_EXPORT void ft_denied( struct ft_request *, const char *reason);333 334 328 /* prefs.c */ 335 329 G_MODULE_EXPORT void build_block_list(); -
protocols/oscar/aim.h
r2983f5e rbd69a21 466 466 int aim_addtlvtochain_caps(aim_tlvlist_t **list, const guint16 t, const guint32 caps); 467 467 int aim_addtlvtochain_noval(aim_tlvlist_t **list, const guint16 type); 468 int aim_addtlvtochain_chatroom(aim_tlvlist_t **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance); 468 469 int aim_addtlvtochain_userinfo(aim_tlvlist_t **list, guint16 type, aim_userinfo_t *ui); 469 470 int aim_addtlvtochain_frozentlvlist(aim_tlvlist_t **list, guint16 type, aim_tlvlist_t **tl); … … 572 573 }; 573 574 575 struct aim_chat_invitation { 576 struct gaim_connection * gc; 577 char * name; 578 guint8 exchange; 579 }; 574 580 575 581 #define AIM_VISIBILITYCHANGE_PERMITADD 0x05 -
protocols/oscar/chat.c
r2983f5e rbd69a21 180 180 181 181 aim_tx_enqueue(sess, fr); 182 183 return 0;184 }185 186 static int aim_addtlvtochain_chatroom(aim_tlvlist_t **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance)187 {188 guint8 *buf;189 int buflen;190 aim_bstream_t bs;191 192 buflen = 2 + 1 + strlen(roomname) + 2;193 194 if (!(buf = g_malloc(buflen)))195 return 0;196 197 aim_bstream_init(&bs, buf, buflen);198 199 aimbs_put16(&bs, exchange);200 aimbs_put8(&bs, strlen(roomname));201 aimbs_putraw(&bs, (guint8 *)roomname, strlen(roomname));202 aimbs_put16(&bs, instance);203 204 aim_addtlvtochain_raw(list, type, aim_bstream_curpos(&bs), buf);205 206 g_free(buf);207 182 208 183 return 0; -
protocols/oscar/im.c
r2983f5e rbd69a21 1369 1369 } 1370 1370 1371 1372 static void incomingim_ch2_chat_free(aim_session_t *sess, struct aim_incomingim_ch2_args *args) 1373 { 1374 1375 /* XXX aim_chat_roominfo_free() */ 1376 g_free(args->info.chat.roominfo.name); 1377 1378 return; 1379 } 1380 1381 static void incomingim_ch2_chat(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args, aim_bstream_t *servdata) 1382 { 1383 1384 /* 1385 * Chat room info. 1386 */ 1387 if (servdata) 1388 aim_chat_readroominfo(servdata, &args->info.chat.roominfo); 1389 1390 args->destructor = (void *)incomingim_ch2_chat_free; 1391 1392 return; 1393 } 1394 1371 1395 static void incomingim_ch2_icqserverrelay_free(aim_session_t *sess, struct aim_incomingim_ch2_args *args) 1372 1396 { … … 1617 1641 if (args.reqclass & AIM_CAPS_ICQSERVERRELAY) 1618 1642 incomingim_ch2_icqserverrelay(sess, mod, rx, snac, userinfo, &args, sdbsptr); 1643 else if (args.reqclass & AIM_CAPS_CHAT) 1644 incomingim_ch2_chat(sess, mod, rx, snac, userinfo, &args, sdbsptr); 1619 1645 1620 1646 -
protocols/oscar/oscar.c
r2983f5e rbd69a21 62 62 static int gaim_caps = AIM_CAPS_UTF8; */ 63 63 64 static int gaim_caps = AIM_CAPS_INTEROP | AIM_CAPS_ICHAT | AIM_CAPS_ICQSERVERRELAY ;64 static int gaim_caps = AIM_CAPS_INTEROP | AIM_CAPS_ICHAT | AIM_CAPS_ICQSERVERRELAY | AIM_CAPS_CHAT; 65 65 static guint8 gaim_features[] = {0x01, 0x01, 0x01, 0x02}; 66 66 … … 156 156 } 157 157 158 #if 0159 158 static struct chat_connection *find_oscar_chat(struct gaim_connection *gc, int id) { 160 159 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; … … 171 170 return c; 172 171 } 173 #endif 172 174 173 175 174 static struct chat_connection *find_oscar_chat_by_conn(struct gaim_connection *gc, … … 1074 1073 } 1075 1074 1075 void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv); 1076 void oscar_reject_chat(gpointer w, struct aim_chat_invitation * inv); 1077 1076 1078 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { 1077 #if 01078 1079 struct gaim_connection *gc = sess->aux_data; 1079 #endif1080 1080 1081 1081 if (args->status != AIM_RENDEZVOUS_PROPOSE) 1082 1082 return 1; 1083 #if 0 1083 1084 1084 if (args->reqclass & AIM_CAPS_CHAT) { 1085 1085 char *name = extract_name(args->info.chat.roominfo.name); 1086 1086 int *exch = g_new0(int, 1); 1087 1087 GList *m = NULL; 1088 char txt[1024]; 1089 struct aim_chat_invitation * inv = g_new0(struct aim_chat_invitation, 1); 1090 1088 1091 m = g_list_append(m, g_strdup(name ? name : args->info.chat.roominfo.name)); 1089 1092 *exch = args->info.chat.roominfo.exchange; 1090 1093 m = g_list_append(m, exch); 1091 serv_got_chat_invite(gc, 1092 name ? name : args->info.chat.roominfo.name, 1093 userinfo->sn, 1094 (char *)args->msg, 1095 m); 1094 1095 g_snprintf( txt, 1024, "Got an invitation to chatroom %s from %s: %s", name, userinfo->sn, args->msg ); 1096 1097 inv->gc = gc; 1098 inv->exchange = *exch; 1099 inv->name = g_strdup(name); 1100 1101 do_ask_dialog( gc, txt, inv, oscar_accept_chat, oscar_reject_chat); 1102 1096 1103 if (name) 1097 1104 g_free(name); 1098 1105 } 1099 #endif 1106 1100 1107 return 1; 1101 1108 } … … 2441 2448 type2 = va_arg(ap, int); 2442 2449 va_end(ap); 2443 2444 if(type2 == 0x0001 || type2 == 0x0002) 2445 serv_got_typing(gc, sn, 0); 2446 2450 2451 if(type2 == 0x0002) { 2452 /* User is typing */ 2453 serv_got_typing(gc, sn, 0, 1); 2454 } 2455 else if (type2 == 0x0001) { 2456 /* User has typed something, but is not actively typing (stale) */ 2457 serv_got_typing(gc, sn, 0, 2); 2458 } 2459 else { 2460 /* User has stopped typing */ 2461 serv_got_typing(gc, sn, 0, 0); 2462 } 2463 2447 2464 return 1; 2448 2465 } … … 2482 2499 } 2483 2500 2501 int oscar_chat_send(struct gaim_connection * gc, int id, char *message) 2502 { 2503 struct oscar_data * od = (struct oscar_data*)gc->proto_data; 2504 struct chat_connection * ccon; 2505 int ret; 2506 guint8 len = strlen(message); 2507 char *s; 2508 2509 if(!(ccon = find_oscar_chat(gc, id))) 2510 return -1; 2511 2512 for (s = message; *s; s++) 2513 if (*s & 128) 2514 break; 2515 2516 /* Message contains high ASCII chars, time for some translation! */ 2517 if (*s) { 2518 s = g_malloc(BUF_LONG); 2519 /* Try if we can put it in an ISO8859-1 string first. 2520 If we can't, fall back to UTF16. */ 2521 if ((ret = do_iconv("UTF-8", "ISO8859-1", message, s, len, BUF_LONG)) >= 0) { 2522 len = ret; 2523 } else if ((ret = do_iconv("UTF-8", "UNICODEBIG", message, s, len, BUF_LONG)) >= 0) { 2524 len = ret; 2525 } else { 2526 /* OOF, translation failed... Oh well.. */ 2527 g_free( s ); 2528 s = message; 2529 } 2530 } else { 2531 s = message; 2532 } 2533 2534 ret = aim_chat_send_im(od->sess, ccon->conn, AIM_CHATFLAGS_NOREFLECT, s, len); 2535 2536 if (s != message) { 2537 g_free(s); 2538 } 2539 2540 return (ret >= 0); 2541 } 2542 2543 void oscar_chat_invite(struct gaim_connection * gc, int id, char *message, char *who) 2544 { 2545 struct oscar_data * od = (struct oscar_data *)gc->proto_data; 2546 struct chat_connection *ccon = find_oscar_chat(gc, id); 2547 2548 if (ccon == NULL) 2549 return; 2550 2551 aim_chat_invite(od->sess, od->conn, who, message ? message : "", 2552 ccon->exchange, ccon->name, 0x0); 2553 } 2554 2555 void oscar_chat_kill(struct gaim_connection *gc, struct chat_connection *cc) 2556 { 2557 struct oscar_data *od = (struct oscar_data *)gc->proto_data; 2558 2559 /* Notify the conversation window that we've left the chat */ 2560 serv_got_chat_left(gc, cc->id); 2561 2562 /* Destroy the chat_connection */ 2563 od->oscar_chats = g_slist_remove(od->oscar_chats, cc); 2564 if (cc->inpa > 0) 2565 gaim_input_remove(cc->inpa); 2566 aim_conn_kill(od->sess, &cc->conn); 2567 g_free(cc->name); 2568 g_free(cc->show); 2569 g_free(cc); 2570 } 2571 2572 void oscar_chat_leave(struct gaim_connection * gc, int id) 2573 { 2574 struct chat_connection * ccon = find_oscar_chat(gc, id); 2575 2576 if(ccon == NULL) 2577 return; 2578 2579 oscar_chat_kill(gc, ccon); 2580 } 2581 2582 int oscar_chat_join(struct gaim_connection * gc, char * name) 2583 { 2584 struct oscar_data * od = (struct oscar_data *)gc->proto_data; 2585 2586 aim_conn_t * cur; 2587 2588 if((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) { 2589 2590 return (aim_chatnav_createroom(od->sess, cur, name, 4) == 0); 2591 2592 } else { 2593 struct create_room * cr = g_new0(struct create_room, 1); 2594 cr->exchange = 4; 2595 cr->name = g_strdup(name); 2596 od->create_rooms = g_slist_append(od->create_rooms, cr); 2597 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV); 2598 return 1; 2599 } 2600 } 2601 2602 int oscar_chat_open(struct gaim_connection * gc, char *who) 2603 { 2604 struct oscar_data * od = (struct oscar_data *)gc->proto_data; 2605 int ret; 2606 static int chat_id = 0; 2607 char * chatname = g_new0(char, strlen(gc->username)+4); 2608 2609 g_snprintf(chatname, strlen(gc->username) + 4, "%s%d", gc->username, chat_id++); 2610 2611 ret = oscar_chat_join(gc, chatname); 2612 2613 aim_chat_invite(od->sess, od->conn, who, "", 4, chatname, 0x0); 2614 2615 g_free(chatname); 2616 2617 return ret; 2618 } 2619 2620 void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv) 2621 { 2622 oscar_chat_join(inv->gc, inv->name); 2623 g_free(inv->name); 2624 g_free(inv); 2625 } 2626 2627 void oscar_reject_chat(gpointer w, struct aim_chat_invitation * inv) 2628 { 2629 g_free(inv->name); 2630 g_free(inv); 2631 } 2632 2484 2633 void oscar_init() 2485 2634 { … … 2495 2644 ret->add_buddy = oscar_add_buddy; 2496 2645 ret->remove_buddy = oscar_remove_buddy; 2646 ret->chat_send = oscar_chat_send; 2647 ret->chat_invite = oscar_chat_invite; 2648 ret->chat_leave = oscar_chat_leave; 2649 ret->chat_open = oscar_chat_open; 2497 2650 ret->add_permit = oscar_add_permit; 2498 2651 ret->add_deny = oscar_add_deny; -
protocols/oscar/tlv.c
r2983f5e rbd69a21 340 340 } 341 341 342 int aim_addtlvtochain_chatroom(aim_tlvlist_t **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance) 343 { 344 guint8 *buf; 345 int buflen; 346 aim_bstream_t bs; 347 348 buflen = 2 + 1 + strlen(roomname) + 2; 349 350 if (!(buf = g_malloc(buflen))) 351 return 0; 352 353 aim_bstream_init(&bs, buf, buflen); 354 355 aimbs_put16(&bs, exchange); 356 aimbs_put8(&bs, strlen(roomname)); 357 aimbs_putraw(&bs, (guint8 *)roomname, strlen(roomname)); 358 aimbs_put16(&bs, instance); 359 360 aim_addtlvtochain_raw(list, type, aim_bstream_curpos(&bs), buf); 361 362 g_free(buf); 363 364 return 0; 365 } 366 342 367 /** 343 368 * aim_writetlvchain - Write a TLV chain into a data buffer. -
protocols/proxy.c
r2983f5e rbd69a21 73 73 74 74 75 static struct sockaddr_in *gaim_gethostbyname(c har *host, int port)75 static struct sockaddr_in *gaim_gethostbyname(const char *host, int port) 76 76 { 77 77 static struct sockaddr_in sin; … … 114 114 } 115 115 116 static void no_one_calls(gpointer data, gint source, GaimInputCondition cond)116 static void gaim_io_connected(gpointer data, gint source, GaimInputCondition cond) 117 117 { 118 118 struct PHB *phb = data; … … 144 144 } 145 145 146 static int proxy_connect_none(c har *host, unsigned short port, struct PHB *phb)146 static int proxy_connect_none(const char *host, unsigned short port, struct PHB *phb) 147 147 { 148 148 struct sockaddr_in *sin; … … 163 163 if (connect(fd, (struct sockaddr *)sin, sizeof(*sin)) < 0) { 164 164 if (sockerr_again()) { 165 phb->inpa = gaim_input_add(fd, GAIM_INPUT_WRITE, no_one_calls, phb);165 phb->inpa = gaim_input_add(fd, GAIM_INPUT_WRITE, gaim_io_connected, phb); 166 166 phb->fd = fd; 167 167 } else { … … 271 271 } 272 272 273 static int proxy_connect_http(c har *host, unsigned short port, struct PHB *phb)273 static int proxy_connect_http(const char *host, unsigned short port, struct PHB *phb) 274 274 { 275 275 phb->host = g_strdup(host); … … 355 355 } 356 356 357 static int proxy_connect_socks4(c har *host, unsigned short port, struct PHB *phb)357 static int proxy_connect_socks4(const char *host, unsigned short port, struct PHB *phb) 358 358 { 359 359 phb->host = g_strdup(host); … … 537 537 } 538 538 539 static int proxy_connect_socks5(c har *host, unsigned short port, struct PHB *phb)539 static int proxy_connect_socks5(const char *host, unsigned short port, struct PHB *phb) 540 540 { 541 541 phb->host = g_strdup(host); … … 578 578 } 579 579 580 int proxy_connect(c har *host, int port, GaimInputFunction func, gpointer data)580 int proxy_connect(const char *host, int port, GaimInputFunction func, gpointer data) 581 581 { 582 582 struct PHB *phb; -
protocols/proxy.h
r2983f5e rbd69a21 56 56 G_MODULE_EXPORT void gaim_input_remove(gint); 57 57 58 G_MODULE_EXPORT int proxy_connect(c har *host, int port, GaimInputFunction func, gpointer data);58 G_MODULE_EXPORT int proxy_connect(const char *host, int port, GaimInputFunction func, gpointer data); 59 59 60 60 #endif /* _PROXY_H_ */ -
protocols/yahoo/crypt.c
r2983f5e rbd69a21 22 22 * already had. isn't that lovely. people should just use linux or 23 23 * freebsd, crypt works properly on those systems. i hate solaris */ 24 25 #if HAVE_CONFIG_H26 # include <config.h>27 #endif28 24 29 25 #if HAVE_STRING_H -
protocols/yahoo/libyahoo2.c
r2983f5e rbd69a21 43 43 * 44 44 */ 45 46 #if HAVE_CONFIG_H47 # include <config.h>48 #endif49 45 50 46 #ifndef _WIN32 -
protocols/yahoo/yahoo.c
r2983f5e rbd69a21 635 635 { 636 636 struct gaim_connection *gc = byahoo_get_gc_by_id( id ); 637 638 serv_got_typing( gc, who, 1 ); 637 if (stat == 1) { 638 /* User is typing */ 639 serv_got_typing( gc, who, 1, 1 ); 640 } 641 else { 642 /* User stopped typing */ 643 serv_got_typing( gc, who, 1, 0 ); 644 } 639 645 } 640 646 -
protocols/yahoo/yahoo_httplib.c
r2983f5e rbd69a21 19 19 * 20 20 */ 21 22 #if HAVE_CONFIG_H23 # include <config.h>24 #endif25 21 26 22 #include <stdio.h> -
protocols/yahoo/yahoo_util.c
r2983f5e rbd69a21 19 19 * 20 20 */ 21 22 #if HAVE_CONFIG_H23 # include <config.h>24 #endif25 21 26 22 #if STDC_HEADERS -
unix.c
r2983f5e rbd69a21 53 53 54 54 global.helpfile = g_strdup( HELP_FILE ); 55 55 56 56 global.conf = conf_load( argc, argv ); 57 57 if( global.conf == NULL ) 58 58 return( 1 ); 59 59 60 60 61 if( global.conf->runmode == RUNMODE_INETD ) 61 62 { … … 77 78 if( i != 0 ) 78 79 return( i ); 80 81 global.storage = storage_init( global.conf->primary_storage, 82 global.conf->migrate_storage ); 83 if ( global.storage == NULL) { 84 log_message( LOGLVL_ERROR, "Unable to load storage backend '%s'", global.conf->primary_storage ); 85 return( 1 ); 86 } 87 79 88 80 89 /* Catch some signals to tell the user what's happening before quitting */ … … 94 103 if( !getuid() || !geteuid() ) 95 104 log_message( LOGLVL_WARNING, "BitlBee is running with root privileges. Why?" ); 96 if( access( global.conf->configdir, F_OK ) != 0 )97 log_message( LOGLVL_WARNING, "The configuration directory %s does not exist. Configuration won't be saved.", CONFIG );98 else if( access( global.conf->configdir, R_OK ) != 0 || access( global.conf->configdir, W_OK ) != 0 )99 log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to %s.", global.conf->configdir );100 105 if( help_init( &(global.help) ) == NULL ) 101 106 log_message( LOGLVL_WARNING, "Error opening helpfile %s.", HELP_FILE );
Note: See TracChangeset
for help on using the changeset viewer.