Changeset 9fae35c
- Timestamp:
- 2006-01-23T23:28:13Z (19 years ago)
- Branches:
- master
- Children:
- ec3e411
- Parents:
- 7308b63 (diff), 68c7c14 (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
- 34 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
Makefile
r7308b63 r9fae35c 10 10 11 11 # Program variables 12 objects = account.o bitlbee.o co mmands.o conf.o crypting.o help.o ini.o irc.o log.o nick.o query.o set.o storage.o storage_text.o unix.o url.o user.o12 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 13 subdirs = protocols 14 14 -
bitlbee.c
r7308b63 r9fae35c 29 29 #include "protocols/nogaim.h" 30 30 #include "help.h" 31 #include "ipc.h" 31 32 #include <signal.h> 32 33 #include <stdio.h> 33 34 #include <errno.h> 34 35 35 gboolean bitlbee_io_new_client( GIOChannel *source, GIOCondition condition, gpointer data ) 36 { 37 size_t size = sizeof( struct sockaddr_in ); 38 struct sockaddr_in conn_info; 39 int new_socket = accept( global.listen_socket, (struct sockaddr *) &conn_info, 40 &size ); 41 42 log_message( LOGLVL_INFO, "Creating new connection with fd %d.", new_socket ); 43 irc_new( new_socket ); 44 45 return TRUE; 46 } 47 48 36 gboolean bitlbee_io_new_client( GIOChannel *source, GIOCondition condition, gpointer data ); 49 37 50 38 int bitlbee_daemon_init() 51 39 { 40 #ifdef IPV6 41 struct sockaddr_in6 listen_addr; 42 #else 52 43 struct sockaddr_in listen_addr; 44 #endif 53 45 int i; 54 46 GIOChannel *ch; … … 57 49 log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG ); 58 50 59 global.listen_socket = socket( AF_INET , SOCK_STREAM, 0 );51 global.listen_socket = socket( AF_INETx, SOCK_STREAM, 0 ); 60 52 if( global.listen_socket == -1 ) 61 53 { … … 63 55 return( -1 ); 64 56 } 65 listen_addr.sin_family = AF_INET; 57 58 /* TIME_WAIT (?) sucks.. */ 59 i = 1; 60 setsockopt( global.listen_socket, SOL_SOCKET, SO_REUSEADDR, &i, sizeof( i ) ); 61 62 #ifdef IPV6 63 listen_addr.sin6_family = AF_INETx; 64 listen_addr.sin6_port = htons( global.conf->port ); 65 i = inet_pton( AF_INETx, ipv6_wrap( global.conf->iface ), &listen_addr.sin6_addr ); 66 #else 67 listen_addr.sin_family = AF_INETx; 66 68 listen_addr.sin_port = htons( global.conf->port ); 67 listen_addr.sin_addr.s_addr = inet_addr( global.conf->iface ); 68 69 i = bind( global.listen_socket, (struct sockaddr *) &listen_addr, sizeof( struct sockaddr ) ); 69 i = inet_pton( AF_INETx, global.conf->iface, &listen_addr.sin_addr ); 70 #endif 71 72 if( i != 1 ) 73 { 74 log_message( LOGLVL_ERROR, "Couldn't parse address `%s'", global.conf->iface ); 75 return( -1 ); 76 } 77 78 i = bind( global.listen_socket, (struct sockaddr *) &listen_addr, sizeof( listen_addr ) ); 70 79 if( i == -1 ) 71 80 { … … 73 82 return( -1 ); 74 83 } 75 84 76 85 i = listen( global.listen_socket, 10 ); 77 86 if( i == -1 ) … … 80 89 return( -1 ); 81 90 } 82 91 83 92 ch = g_io_channel_unix_new( global.listen_socket ); 84 g _io_add_watch( ch, G_IO_IN, bitlbee_io_new_client, NULL );85 93 global.listen_watch_source_id = g_io_add_watch( ch, G_IO_IN, bitlbee_io_new_client, NULL ); 94 86 95 #ifndef _WIN32 87 96 if( !global.conf->nofork ) … … 124 133 if( condition & G_IO_ERR || condition & G_IO_HUP ) 125 134 { 126 irc_ free( irc);135 irc_abort( irc, 1, "Read error" ); 127 136 return FALSE; 128 137 } … … 131 140 if( st == 0 ) 132 141 { 133 irc_ free( irc);142 irc_abort( irc, 1, "Connection reset by peer" ); 134 143 return FALSE; 135 144 } … … 142 151 else 143 152 { 144 irc_ free( irc);153 irc_abort( irc, 1, "Read error: %s", strerror( errno ) ); 145 154 return FALSE; 146 155 } … … 158 167 } 159 168 160 if( !irc_process( irc ) ) 161 { 162 log_message( LOGLVL_INFO, "Destroying connection with fd %d.", irc->fd ); 163 irc_free( irc ); 169 irc_process( irc ); 170 171 /* Normally, irc_process() shouldn't call irc_free() but irc_abort(). Just in case: */ 172 if( !g_slist_find( irc_connection_list, irc ) ) 173 { 174 log_message( LOGLVL_WARNING, "Abnormal termination of connection with fd %d.", irc->fd ); 164 175 return FALSE; 165 176 } … … 168 179 if( irc->readbuffer && ( strlen( irc->readbuffer ) > 1024 ) ) 169 180 { 170 log_message( LOGLVL_ERROR, "Maximum line length exceeded." ); 171 irc_free( irc ); 181 irc_abort( irc, 0, "Maximum line length exceeded" ); 172 182 return FALSE; 173 183 } … … 181 191 int st, size; 182 192 char *temp; 183 #ifdef FLOOD_SEND 184 time_t newtime; 185 #endif 186 187 #ifdef FLOOD_SEND 188 newtime = time( NULL ); 189 if( ( newtime - irc->oldtime ) > FLOOD_SEND_INTERVAL ) 190 { 191 irc->sentbytes = 0; 192 irc->oldtime = newtime; 193 } 194 #endif 195 193 196 194 if( irc->sendbuffer == NULL ) 197 195 return( FALSE ); 198 196 199 197 size = strlen( irc->sendbuffer ); 200 201 #ifdef FLOOD_SEND202 if( ( FLOOD_SEND_BYTES - irc->sentbytes ) > size )203 st = write( irc->fd, irc->sendbuffer, size );204 else205 st = write( irc->fd, irc->sendbuffer, ( FLOOD_SEND_BYTES - irc->sentbytes ) );206 #else207 198 st = write( irc->fd, irc->sendbuffer, size ); 208 #endif 209 210 if( st <= 0 ) 211 { 212 if( sockerr_again() ) 213 { 214 return TRUE; 215 } 216 else 217 { 218 irc_free( irc ); 219 return FALSE; 220 } 221 } 222 223 #ifdef FLOOD_SEND 224 irc->sentbytes += st; 225 #endif 199 200 if( st == 0 || ( st < 0 && !sockerr_again() ) ) 201 { 202 irc_abort( irc, 1, "Write error: %s", strerror( errno ) ); 203 return FALSE; 204 } 205 else if( st < 0 ) /* && sockerr_again() */ 206 { 207 return TRUE; 208 } 226 209 227 210 if( st == size ) … … 229 212 g_free( irc->sendbuffer ); 230 213 irc->sendbuffer = NULL; 231 232 214 irc->w_watch_source_id = 0; 215 216 if( irc->status == USTATUS_SHUTDOWN ) 217 irc_free( irc ); 218 233 219 return( FALSE ); 234 220 } … … 243 229 } 244 230 231 gboolean bitlbee_io_new_client( GIOChannel *source, GIOCondition condition, gpointer data ) 232 { 233 size_t size = sizeof( struct sockaddr_in ); 234 struct sockaddr_in conn_info; 235 int new_socket = accept( global.listen_socket, (struct sockaddr *) &conn_info, &size ); 236 pid_t client_pid = 0; 237 238 if( global.conf->runmode == RUNMODE_FORKDAEMON ) 239 { 240 int fds[2]; 241 242 if( socketpair( AF_UNIX, SOCK_STREAM, 0, fds ) == -1 ) 243 { 244 log_message( LOGLVL_WARNING, "Could not create IPC socket for client: %s", strerror( errno ) ); 245 fds[0] = fds[1] = -1; 246 } 247 248 sock_make_nonblocking( fds[0] ); 249 sock_make_nonblocking( fds[1] ); 250 251 client_pid = fork(); 252 253 if( client_pid > 0 && fds[0] != -1 ) 254 { 255 struct bitlbee_child *child; 256 257 child = g_new0( struct bitlbee_child, 1 ); 258 child->pid = client_pid; 259 child->ipc_fd = fds[0]; 260 child->ipc_inpa = gaim_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child ); 261 child_list = g_slist_append( child_list, child ); 262 263 log_message( LOGLVL_INFO, "Creating new subprocess with pid %d.", client_pid ); 264 265 /* Close some things we don't need in the parent process. */ 266 close( new_socket ); 267 close( fds[1] ); 268 } 269 else if( client_pid == 0 ) 270 { 271 irc_t *irc; 272 273 /* Close the listening socket, we're a client. */ 274 close( global.listen_socket ); 275 g_source_remove( global.listen_watch_source_id ); 276 277 /* Make the connection. */ 278 irc = irc_new( new_socket ); 279 280 /* We can store the IPC fd there now. */ 281 global.listen_socket = fds[1]; 282 global.listen_watch_source_id = gaim_input_add( fds[1], GAIM_INPUT_READ, ipc_child_read, irc ); 283 284 close( fds[0] ); 285 286 ipc_master_free_all(); 287 } 288 } 289 else 290 { 291 log_message( LOGLVL_INFO, "Creating new connection with fd %d.", new_socket ); 292 irc_new( new_socket ); 293 } 294 295 return TRUE; 296 } 297 245 298 void bitlbee_shutdown( gpointer data ) 246 299 { … … 252 305 g_main_quit( global.loop ); 253 306 } 254 255 int root_command_string( irc_t *irc, user_t *u, char *command, int flags )256 {257 char *cmd[IRC_MAX_ARGS];258 char *s;259 int k;260 char q = 0;261 262 memset( cmd, 0, sizeof( cmd ) );263 cmd[0] = command;264 k = 1;265 for( s = command; *s && k < ( IRC_MAX_ARGS - 1 ); s ++ )266 if( *s == ' ' && !q )267 {268 *s = 0;269 while( *++s == ' ' );270 if( *s == '"' || *s == '\'' )271 {272 q = *s;273 s ++;274 }275 if( *s )276 {277 cmd[k++] = s;278 s --;279 }280 }281 else if( *s == q )282 {283 q = *s = 0;284 }285 cmd[k] = NULL;286 287 return( root_command( irc, cmd ) );288 }289 290 int root_command( irc_t *irc, char *cmd[] )291 {292 int i;293 294 if( !cmd[0] )295 return( 0 );296 297 for( i = 0; commands[i].command; i++ )298 if( g_strcasecmp( commands[i].command, cmd[0] ) == 0 )299 {300 if( !cmd[commands[i].required_parameters] )301 {302 irc_usermsg( irc, "Not enough parameters given (need %d)", commands[i].required_parameters );303 return( 0 );304 }305 commands[i].execute( irc, cmd );306 return( 1 );307 }308 309 irc_usermsg( irc, "Unknown command: %s. Please use \x02help commands\x02 to get a list of available commands.", cmd[0] );310 311 return( 1 );312 }313 314 /* Decode%20a%20file%20name */315 void http_decode( char *s )316 {317 char *t;318 int i, j, k;319 320 t = g_new( char, strlen( s ) + 1 );321 322 for( i = j = 0; s[i]; i ++, j ++ )323 {324 if( s[i] == '%' )325 {326 if( sscanf( s + i + 1, "%2x", &k ) )327 {328 t[j] = k;329 i += 2;330 }331 else332 {333 *t = 0;334 break;335 }336 }337 else338 {339 t[j] = s[i];340 }341 }342 t[j] = 0;343 344 strcpy( s, t );345 g_free( t );346 }347 348 /* Warning: This one explodes the string. Worst-cases can make the string 3x its original size! */349 /* This fuction is safe, but make sure you call it safely as well! */350 void http_encode( char *s )351 {352 char *t;353 int i, j;354 355 t = g_strdup( s );356 357 for( i = j = 0; t[i]; i ++, j ++ )358 {359 if( t[i] <= ' ' || ((unsigned char *)t)[i] >= 128 || t[i] == '%' )360 {361 sprintf( s + j, "%%%02X", ((unsigned char*)t)[i] );362 j += 2;363 }364 else365 {366 s[j] = t[i];367 }368 }369 s[j] = 0;370 371 g_free( t );372 }373 374 /* Strip newlines from a string. Modifies the string passed to it. */375 char *strip_newlines( char *source )376 {377 int i;378 379 for( i = 0; source[i] != '\0'; i ++ )380 if( source[i] == '\n' || source[i] == '\r' )381 source[i] = 32;382 383 return source;384 } -
bitlbee.conf
r7308b63 r9fae35c 14 14 ## and other reasons, the use of daemon-mode is *STRONGLY* discouraged, 15 15 ## don't even *think* of reporting bugs when you use this. 16 ## ForkDaemon -- Run as a stand-alone daemon, but keep all clients in separate 17 ## child processes. This should be pretty safe and reliable to use instead 18 ## of inetd mode. 16 19 ## 17 20 # RunMode = Inetd … … 19 22 ## DaemonPort/DaemonInterface: 20 23 ## 21 ## For RunMode=Daemon, here you can specify on what interface and port the22 ## daemonshould be listening for connections.24 ## For daemon mode, you can specify on what interface and port the daemon 25 ## should be listening for connections. 23 26 ## 24 27 # DaemonInterface = 0.0.0.0 … … 42 45 # AuthPassword = ItllBeBitlBee ## Heh.. Our slogan. ;-) 43 46 47 ## OperPassword 48 ## 49 ## Password that unlocks access to special operator commands. 50 ## 51 # OperPassword = ChangeMe! 52 44 53 ## HostName 45 54 ## 46 55 ## Normally, BitlBee gets a hostname using getsockname(). If you have a nicer 47 56 ## alias for your BitlBee daemon, you can set it here and BitlBee will identify 48 ## itself with that name instead. Leave it commented out if you want BitlBee to 49 ## use getsockname() to get a hostname. 57 ## itself with that name instead. 50 58 ## 51 59 # HostName = localhost -
bitlbee.h
r7308b63 r9fae35c 112 112 #include "sock.h" 113 113 114 typedef struct global_t { 114 typedef struct global { 115 /* In forked mode, child processes store the fd of the IPC socket here. */ 115 116 int listen_socket; 117 gint listen_watch_source_id; 116 118 help_t *help; 117 119 conf_t *conf; … … 127 129 gboolean bitlbee_io_current_client_write( GIOChannel *source, GIOCondition condition, gpointer data ); 128 130 129 introot_command_string( irc_t *irc, user_t *u, char *command, int flags );130 introot_command( irc_t *irc, char *command[] );131 void root_command_string( irc_t *irc, user_t *u, char *command, int flags ); 132 void root_command( irc_t *irc, char *command[] ); 131 133 void bitlbee_shutdown( gpointer data ); 132 134 double gettime( void ); -
commands.h
r7308b63 r9fae35c 29 29 #include "bitlbee.h" 30 30 31 /* Hmm... Linked list? Plleeeeaaase?? ;-) */ 32 33 typedef struct command_t 31 typedef struct command 34 32 { 35 33 char *command; 36 34 int required_parameters; 37 int (*execute)(irc_t *, char **args); 35 void (*execute)(irc_t *, char **args); 36 int flags; 38 37 } command_t; 39 38 40 int cmd_account( irc_t *irc, char **cmd ); 41 int cmd_help( irc_t *irc, char **args); 42 int cmd_info( irc_t *irc, char **args); 43 int cmd_add( irc_t *irc, char **args) ; 44 int cmd_rename( irc_t *irc, char **args ); 45 int cmd_remove( irc_t *irc, char **args ); 46 int cmd_block( irc_t *irc, char **args ); 47 int cmd_allow( irc_t *irc, char **args ); 48 int cmd_save( irc_t *irc, char **args ); 49 int cmd_set( irc_t *irc, char **args ); 50 int cmd_yesno( irc_t *irc, char **args ); 51 int cmd_identify( irc_t *irc, char **args ); 52 int cmd_register( irc_t *irc, char **args ); 53 int cmd_drop( irc_t *irc, char **args ); 54 int cmd_blist( irc_t *irc, char **cmd ); 55 int cmd_nick( irc_t *irc, char **cmd ); 56 int cmd_qlist( irc_t *irc, char **cmd ); 57 int cmd_import_buddies( irc_t *irc, char **cmd ); 58 int cmd_dump( irc_t *irc, char **cmd ); 39 extern const command_t commands[]; 59 40 41 #define IRC_CMD_PRE_LOGIN 1 42 #define IRC_CMD_LOGGED_IN 2 43 #define IRC_CMD_OPER_ONLY 4 44 #define IRC_CMD_TO_MASTER 8 60 45 61 62 extern command_t commands[]; 46 #define IPC_CMD_TO_CHILDREN 1 63 47 64 48 #endif -
conf.c
r7308b63 r9fae35c 46 46 conf = g_new0( conf_t, 1 ); 47 47 48 #ifdef IPV6 49 conf->iface = "::"; 50 #else 48 51 conf->iface = "0.0.0.0"; 52 #endif 49 53 conf->port = 6667; 50 54 conf->nofork = 0; … … 53 57 conf->runmode = RUNMODE_INETD; 54 58 conf->authmode = AUTHMODE_OPEN; 55 conf->password = NULL; 59 conf->auth_pass = NULL; 60 conf->oper_pass = NULL; 56 61 conf->configdir = g_strdup( CONFIG ); 57 62 conf->plugindir = g_strdup( PLUGINDIR ); … … 59 64 conf->ping_interval = 180; 60 65 conf->ping_timeout = 300; 66 proxytype = 0; 61 67 62 68 i = conf_loadini( conf, CONF_FILE ); … … 71 77 } 72 78 73 while( ( opt = getopt( argc, argv, "i:p:nvIDc:d:h" ) ) >= 0 ) 79 while( argc > 0 && ( opt = getopt( argc, argv, "i:p:nvIDFc:d:h" ) ) >= 0 ) 80 /* ^^^^ Just to make sure we skip this step from the REHASH handler. */ 74 81 { 75 82 if( opt == 'i' ) … … 87 94 } 88 95 else if( opt == 'n' ) 89 conf->nofork =1;96 conf->nofork = 1; 90 97 else if( opt == 'v' ) 91 conf->verbose =1;98 conf->verbose = 1; 92 99 else if( opt == 'I' ) 93 conf->runmode =RUNMODE_INETD;100 conf->runmode = RUNMODE_INETD; 94 101 else if( opt == 'D' ) 95 conf->runmode=RUNMODE_DAEMON; 102 conf->runmode = RUNMODE_DAEMON; 103 else if( opt == 'F' ) 104 conf->runmode = RUNMODE_FORKDAEMON; 96 105 else if( opt == 'c' ) 97 106 { … … 101 110 CONF_FILE = g_strdup( optarg ); 102 111 g_free( conf ); 112 /* Re-evaluate arguments. Don't use this option twice, 113 you'll end up in an infinite loop! Hope this trick 114 works with all libcs BTW.. */ 115 optind = 1; 103 116 return( conf_load( argc, argv ) ); 104 117 } … … 118 131 " -I Classic/InetD mode. (Default)\n" 119 132 " -D Daemon mode. (Still EXPERIMENTAL!)\n" 133 " -F Forking daemon. (one process per client)\n" 120 134 " -i Specify the interface (by IP address) to listen on.\n" 121 135 " (Default: 0.0.0.0 (any interface))\n" … … 157 171 if( g_strcasecmp( ini->value, "daemon" ) == 0 ) 158 172 conf->runmode = RUNMODE_DAEMON; 173 else if( g_strcasecmp( ini->value, "forkdaemon" ) == 0 ) 174 conf->runmode = RUNMODE_FORKDAEMON; 159 175 else 160 176 conf->runmode = RUNMODE_INETD; … … 184 200 else if( g_strcasecmp( ini->key, "authpassword" ) == 0 ) 185 201 { 186 conf->password = g_strdup( ini->value ); 202 conf->auth_pass = g_strdup( ini->value ); 203 } 204 else if( g_strcasecmp( ini->key, "operpassword" ) == 0 ) 205 { 206 conf->oper_pass = g_strdup( ini->value ); 187 207 } 188 208 else if( g_strcasecmp( ini->key, "hostname" ) == 0 ) -
conf.h
r7308b63 r9fae35c 27 27 #define __CONF_H 28 28 29 typedef enum runmode { RUNMODE_DAEMON, RUNMODE_ INETD } runmode_t;29 typedef enum runmode { RUNMODE_DAEMON, RUNMODE_FORKDAEMON, RUNMODE_INETD } runmode_t; 30 30 typedef enum authmode { AUTHMODE_OPEN, AUTHMODE_CLOSED, AUTHMODE_REGISTERED } authmode_t; 31 31 … … 38 38 runmode_t runmode; 39 39 authmode_t authmode; 40 char *password; 40 char *auth_pass; 41 char *oper_pass; 41 42 char *hostname; 42 43 char *configdir; -
configure
r7308b63 r9fae35c 23 23 debug=0 24 24 strip=1 25 flood=026 25 ipv6=1 27 26 ssl=auto … … 289 288 fi 290 289 291 if [ "$flood" = 1 ]; then 292 # echo '#define FLOOD_SEND' >> config.h 293 echo 'Flood protection is disabled in this release because of too many bugs.' 2> /dev/stderr 294 rm config.h 295 rm Makefile.settings 296 exit 1 290 echo 291 if [ -z "$BITLBEE_VERSION" -a -d .bzr -a -x "`which bzr`" ]; then 292 rev=`bzr revno` 293 echo 'Using bzr revision #'$rev' as version number' 294 BITLBEE_VERSION=\"bzr-$rev\" 297 295 fi 298 296 299 297 if [ -n "$BITLBEE_VERSION" ]; then 300 echo301 298 echo 'Spoofing version number: '$BITLBEE_VERSION 302 299 echo '#undef BITLBEE_VERSION' >> config.h 303 echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h; 300 echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h 301 echo 304 302 fi 305 303 … … 340 338 341 339 if [ "$protocols" = "PROTOCOLS = " ]; then 342 echo343 340 echo "WARNING: You haven't selected any communication protocol to compile!" 344 341 echo " Bitlbee will run, but you will be unable to connect to IM servers!" … … 348 345 echo "PROTOOBJS = $protoobjs" >> Makefile.settings 349 346 350 echo351 347 echo Architecture: $arch 352 348 case "$arch" in -
irc.c
r7308b63 r9fae35c 27 27 #include "bitlbee.h" 28 28 #include "crypting.h" 29 #include "ipc.h" 29 30 30 31 static gboolean irc_userping( gpointer _irc ); … … 40 41 irc_t *irc_new( int fd ) 41 42 { 42 irc_t *irc = g_new0( irc_t, 1 ); 43 43 irc_t *irc; 44 struct hostent *peer; 45 unsigned int i; 46 char buf[128]; 47 #ifdef IPV6 48 struct sockaddr_in6 sock[1]; 49 #else 44 50 struct sockaddr_in sock[1]; 45 #ifdef IPV646 struct sockaddr_in6 sock6[1];47 51 #endif 48 struct hostent *peer;49 unsigned int i, j;52 53 irc = g_new0( irc_t, 1 ); 50 54 51 55 irc->fd = fd; … … 71 75 72 76 i = sizeof( *sock ); 73 #ifdef IPV6 74 j = sizeof( *sock6 ); 75 #endif 77 76 78 if( global.conf->hostname ) 77 79 irc->myhost = g_strdup( global.conf->hostname ); 78 else if( getsockname( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin_family == AF_INET ) 79 { 80 if( ( peer = gethostbyaddr( (char*) &sock->sin_addr, sizeof( sock->sin_addr ), AF_INET ) ) ) 80 #ifdef IPV6 81 else if( getsockname( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin6_family == AF_INETx ) 82 { 83 if( ( peer = gethostbyaddr( (char*) &sock->sin6_addr, sizeof( sock->sin6_addr ), AF_INETx ) ) ) 81 84 irc->myhost = g_strdup( peer->h_name ); 82 } 83 #ifdef IPV6 84 else if( getsockname( irc->fd, (struct sockaddr*) sock6, &j ) == 0 && sock6->sin6_family == AF_INET6 ) 85 { 86 if( ( peer = gethostbyaddr( (char*) &sock6->sin6_addr, sizeof( sock6->sin6_addr ), AF_INET6 ) ) ) 85 else if( inet_ntop( AF_INETx, &sock->sin6_addr, buf, sizeof( buf ) - 1 ) != NULL ) 86 irc->myhost = g_strdup( ipv6_unwrap( buf ) ); 87 } 88 #else 89 else if( getsockname( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin_family == AF_INETx ) 90 { 91 if( ( peer = gethostbyaddr( (char*) &sock->sin_addr, sizeof( sock->sin_addr ), AF_INETx ) ) ) 87 92 irc->myhost = g_strdup( peer->h_name ); 93 else if( inet_ntop( AF_INETx, &sock->sin_addr, buf, sizeof( buf ) - 1 ) != NULL ) 94 irc->myhost = g_strdup( buf ); 88 95 } 89 96 #endif … … 91 98 i = sizeof( *sock ); 92 99 #ifdef IPV6 93 j = sizeof( *sock6 ); 100 if( getpeername( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin6_family == AF_INETx ) 101 { 102 if( ( peer = gethostbyaddr( (char*) &sock->sin6_addr, sizeof( sock->sin6_addr ), AF_INETx ) ) ) 103 irc->host = g_strdup( peer->h_name ); 104 else if( inet_ntop( AF_INETx, &sock->sin6_addr, buf, sizeof( buf ) - 1 ) != NULL ) 105 irc->host = g_strdup( ipv6_unwrap( buf ) ); 106 } 107 #else 108 if( getpeername( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin_family == AF_INETx ) 109 { 110 if( ( peer = gethostbyaddr( (char*) &sock->sin_addr, sizeof( sock->sin_addr ), AF_INETx ) ) ) 111 irc->host = g_strdup( peer->h_name ); 112 else if( inet_ntop( AF_INETx, &sock->sin_addr, buf, sizeof( buf ) - 1 ) != NULL ) 113 irc->host = g_strdup( buf ); 114 } 94 115 #endif 95 if( getpeername( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin_family == AF_INET ) 96 { 97 if( ( peer = gethostbyaddr( (char*) &sock->sin_addr, sizeof( sock->sin_addr ), AF_INET ) ) ) 98 irc->host = g_strdup( peer->h_name ); 99 } 100 #ifdef IPV6 101 else if( getpeername( irc->fd, (struct sockaddr*) sock6, &j ) == 0 && sock6->sin6_family == AF_INET6 ) 102 { 103 if( ( peer = gethostbyaddr( (char*) &sock6->sin6_addr, sizeof( sock6->sin6_addr ), AF_INET6 ) ) ) 104 irc->host = g_strdup( peer->h_name ); 105 } 106 #endif 107 116 117 /* Rare, but possible. */ 108 118 if( !irc->host ) irc->host = g_strdup( "localhost." ); 109 119 if( !irc->myhost ) irc->myhost = g_strdup( "localhost." ); … … 142 152 } 143 153 154 /* immed=1 makes this function pretty much equal to irc_free(), except that 155 this one will "log". In case the connection is already broken and we 156 shouldn't try to write to it. */ 157 void irc_abort( irc_t *irc, int immed, char *format, ... ) 158 { 159 if( format != NULL ) 160 { 161 va_list params; 162 char *reason; 163 164 va_start( params, format ); 165 reason = g_strdup_vprintf( format, params ); 166 va_end( params ); 167 168 if( !immed ) 169 irc_write( irc, "ERROR :Closing link: %s", reason ); 170 171 ipc_to_master_str( "OPERMSG :Client exiting: %s@%s [%s]\r\n", 172 irc->nick ? irc->nick : "(NONE)", irc->host, reason ); 173 174 g_free( reason ); 175 } 176 else 177 { 178 if( !immed ) 179 irc_write( irc, "ERROR :Closing link" ); 180 181 ipc_to_master_str( "OPERMSG :Client exiting: %s@%s [%s]\r\n", 182 irc->nick ? irc->nick : "(NONE)", irc->host, "No reason given" ); 183 } 184 185 irc->status = USTATUS_SHUTDOWN; 186 if( irc->sendbuffer && !immed ) 187 { 188 /* We won't read from this socket anymore. Instead, we'll connect a timer 189 to it that should shut down the connection in a second, just in case 190 bitlbee_.._write doesn't do it first. */ 191 192 g_source_remove( irc->r_watch_source_id ); 193 irc->r_watch_source_id = g_timeout_add_full( G_PRIORITY_HIGH, 1000, (GSourceFunc) irc_free, irc, NULL ); 194 } 195 else 196 { 197 irc_free( irc ); 198 } 199 } 200 144 201 static gboolean irc_free_userhash( gpointer key, gpointer value, gpointer data ) 145 202 { … … 163 220 if( storage_save( irc, TRUE ) != STORAGE_OK ) 164 221 irc_usermsg( irc, "Error while saving settings!" ); 222 223 closesocket( irc->fd ); 165 224 166 225 if( irc->ping_source_id > 0 ) … … 264 323 g_free(irc); 265 324 266 if( global.conf->runmode == RUNMODE_INETD )325 if( global.conf->runmode == RUNMODE_INETD || global.conf->runmode == RUNMODE_FORKDAEMON ) 267 326 g_main_quit( global.loop ); 268 327 } … … 282 341 } 283 342 284 intirc_process( irc_t *irc )285 { 286 char **lines, *temp ;343 void irc_process( irc_t *irc ) 344 { 345 char **lines, *temp, **cmd; 287 346 int i; 288 347 289 if( irc->readbuffer != NULL ) { 290 lines = irc_tokenize(irc->readbuffer ); 291 for( i = 0; *lines[i] != '\0'; i++ ) { 292 if( lines[i+1] == NULL ) { 348 if( irc->readbuffer != NULL ) 349 { 350 lines = irc_tokenize( irc->readbuffer ); 351 352 for( i = 0; *lines[i] != '\0'; i ++ ) 353 { 354 if( lines[i+1] == NULL ) 355 { 293 356 temp = g_strdup( lines[i] ); 294 357 g_free( irc->readbuffer ); 295 358 irc->readbuffer = temp; 296 i ++;359 i ++; 297 360 break; 298 361 } 299 if (!irc_process_line(irc, lines[i])) { 362 363 if( ( cmd = irc_parse_line( lines[i] ) ) == NULL ) 364 continue; 365 irc_exec( irc, cmd ); 366 367 g_free( cmd ); 368 369 /* Shouldn't really happen, but just in case... */ 370 if( !g_slist_find( irc_connection_list, irc ) ) 371 { 300 372 g_free( lines ); 301 return 0;373 return; 302 374 } 303 375 } 304 if(lines[i]!=NULL) { 305 g_free(irc->readbuffer); 306 irc->readbuffer=NULL; 307 } 376 377 if( lines[i] != NULL ) 378 { 379 g_free( irc->readbuffer ); 380 irc->readbuffer = NULL; 381 } 382 308 383 g_free( lines ); 309 384 } 310 return 1;311 385 } 312 386 … … 317 391 318 392 /* Count the number of elements we're gonna need. */ 319 for(i=0, j=1; buffer[i]!='\0'; i++ ) { 320 if(buffer[i]=='\n' ) 321 if(buffer[i+1]!='\r' && buffer[i+1]!='\n') 322 j++; 393 for( i = 0, j = 1; buffer[i] != '\0'; i ++ ) 394 { 395 if( buffer[i] == '\n' ) 396 if( buffer[i+1] != '\r' && buffer[i+1] != '\n' ) 397 j ++; 323 398 } 324 399 325 400 /* Allocate j+1 elements. */ 326 lines =g_new (char *, j+1);401 lines = g_new( char *, j + 1 ); 327 402 328 403 /* NULL terminate our list. */ 329 lines[j] =NULL;330 331 lines[0] =buffer;404 lines[j] = NULL; 405 406 lines[0] = buffer; 332 407 333 408 /* Split the buffer in several strings, using \r\n as our seperator, where \r is optional. 334 409 * Although this is not in the RFC, some braindead ircds (newnet's) use this, so some clients might too. 335 410 */ 336 for( i=0, j=0; buffer[i]!='\0'; i++) { 337 if(buffer[i]=='\n') { 338 buffer[i]='\0'; 339 340 /* We dont want to read 1 byte before our buffer 341 * and (in rare cases) generate a SIGSEGV. 342 */ 343 if(i!=0) 344 if(buffer[i-1]=='\r') 345 buffer[i-1]='\0'; 346 if(buffer[i+1]!='\r'&&buffer[i+1]!='\n') 347 lines[++j]=buffer+i+1; 348 } 349 } 350 351 return(lines); 352 } 353 354 int irc_process_line( irc_t *irc, char *line ) 411 for( i = 0, j = 0; buffer[i] != '\0'; i ++) 412 { 413 if( buffer[i] == '\n' ) 414 { 415 buffer[i] = '\0'; 416 417 if( i > 0 && buffer[i-1] == '\r' ) 418 buffer[i-1] = '\0'; 419 if( buffer[i+1] != '\r' && buffer[i+1] != '\n' ) 420 lines[++j] = buffer + i + 1; 421 } 422 } 423 424 return( lines ); 425 } 426 427 char **irc_parse_line( char *line ) 355 428 { 356 429 int i, j; … … 358 431 359 432 /* Move the line pointer to the start of the command, skipping spaces and the optional prefix. */ 360 if(line[0]==':') { 361 for(i=0; line[i]!=32; i++); 362 line=line+i; 363 } 364 for(i=0; line[i]==32; i++); 365 line=line+i; 366 433 if( line[0] == ':' ) 434 { 435 for( i = 0; line[i] != ' '; i ++ ); 436 line = line + i; 437 } 438 for( i = 0; line[i] == ' '; i ++ ); 439 line = line + i; 440 367 441 /* If we're already at the end of the line, return. If not, we're going to need at least one element. */ 368 if(line[0]=='\0') 369 return 1; 370 else 371 j=1; 372 373 /* Count the number of char **cmd elements we're going to need. */ 374 for(i=0; line[i]!='\0'; i++) { 375 if((line[i]==32) && (line[i+1]!=32) && (line[i+1]!='\0') && (line[i+1]!=':')) 376 j++; 377 else if((line[i]==':') && (line[i+1]!='\0') && (line[i-1]==32)) { 378 j++; 379 break; 380 } 442 if( line[0] == '\0') 443 return NULL; 444 445 /* Count the number of char **cmd elements we're going to need. */ 446 j = 1; 447 for( i = 0; line[i] != '\0'; i ++ ) 448 { 449 if( line[i] == ' ' ) 450 { 451 j ++; 381 452 453 if( line[i+1] == ':' ) 454 break; 455 } 382 456 } 383 457 384 458 /* Allocate the space we need. */ 385 cmd =g_new(char *, j+1);386 cmd[j] =NULL;459 cmd = g_new( char *, j + 1 ); 460 cmd[j] = NULL; 387 461 388 462 /* Do the actual line splitting, format is: … … 391 465 */ 392 466 393 cmd[0]=line; 394 for(i=0, j=0; line[i]!='\0'; i++) { 395 if((line[i]==32)) { 396 line[i]='\0'; 397 if((line[i+1]!=32) && (line[i+1]!='\0') && (line[i+1]!=':')) 398 cmd[++j]=line+i+1; 399 } 400 else if((line[i]==':') && (line[i+1]!='\0') && (line[i-1]=='\0')) { 401 cmd[++j]=line+i+1; 402 break; 403 } 404 } 405 406 i=irc_exec(irc, cmd); 407 g_free(cmd); 408 409 return(i); 410 } 411 412 int irc_exec( irc_t *irc, char **cmd ) 413 { 414 int i; 415 416 if( (global.conf)->authmode == AUTHMODE_CLOSED && irc->status < USTATUS_AUTHORIZED ) 417 { 418 if( g_strcasecmp( cmd[0], "PASS" ) == 0 ) 419 { 420 if( !cmd[1] ) 467 cmd[0] = line; 468 for( i = 0, j = 0; line[i] != '\0'; i ++ ) 469 { 470 if( line[i] == ' ' ) 471 { 472 line[i] = '\0'; 473 cmd[++j] = line + i + 1; 474 475 if( line[i+1] == ':' ) 421 476 { 422 irc_reply( irc, 461, "%s :Need more parameters", cmd[0] ); 477 cmd[j] ++; 478 break; 423 479 } 424 else if( strcmp( cmd[1], (global.conf)->password ) == 0 ) 425 { 426 irc->status = USTATUS_AUTHORIZED; 427 } 428 else 429 { 430 irc_reply( irc, 464, ":Nope, maybe you should try it again..." ); 431 } 432 } 433 else 434 { 435 irc_reply( irc, 464, ":Uhh, fine, but I want the password first." ); 436 } 437 438 return( 1 ); 439 } 440 441 if( g_strcasecmp( cmd[0], "USER" ) == 0 ) 442 { 443 if( !( cmd[1] && cmd[2] && cmd[3] && cmd[4] ) ) 444 { 445 irc_reply( irc, 461, "%s :Need more parameters", cmd[0] ); 446 } 447 else if( irc->user ) 448 { 449 irc_reply( irc, 462, ":You can't change your nick/userinfo" ); 450 } 451 else 452 { 453 irc->user = g_strdup( cmd[1] ); 454 irc->realname = g_strdup( cmd[4] ); 455 if( irc->nick ) irc_login( irc ); 456 } 457 return( 1 ); 458 } 459 else if( g_strcasecmp( cmd[0], "NICK" ) == 0 ) 460 { 461 if( !cmd[1] ) 462 { 463 irc_reply( irc, 461, "%s :Need more parameters", cmd[0] ); 464 } 465 else if( irc->nick ) 466 { 467 irc_reply( irc, 438, ":The hand of the deity is upon thee, thy nick may not change" ); 468 } 469 /* This is not clean, but for now it'll have to be like this... */ 470 else if( ( nick_cmp( cmd[1], irc->mynick ) == 0 ) || ( nick_cmp( cmd[1], NS_NICK ) == 0 ) ) 471 { 472 irc_reply( irc, 433, ":This nick is already in use" ); 473 } 474 else if( !nick_ok( cmd[1] ) ) 475 { 476 /* [SH] Invalid characters. */ 477 irc_reply( irc, 432, ":This nick contains invalid characters" ); 478 } 479 else 480 { 481 irc->nick = g_strdup( cmd[1] ); 482 if( irc->user ) irc_login( irc ); 483 } 484 return( 1 ); 485 } 486 else if( g_strcasecmp( cmd[0], "QUIT" ) == 0 ) 487 { 488 irc_write( irc, "ERROR :%s%s", cmd[1]?"Quit: ":"", cmd[1]?cmd[1]:"Client Quit" ); 489 g_io_channel_close( irc->io_channel ); 490 return( 0 ); 491 } 492 493 if( !irc->user || !irc->nick ) 494 { 495 irc_reply( irc, 451, ":Register first" ); 496 return( 1 ); 497 } 498 499 if( g_strcasecmp( cmd[0], "PING" ) == 0 ) 500 { 501 irc_write( irc, ":%s PONG %s :%s", irc->myhost, irc->myhost, cmd[1]?cmd[1]:irc->myhost ); 502 } 503 else if( g_strcasecmp( cmd[0], "MODE" ) == 0 ) 504 { 505 if( !cmd[1] ) 506 { 507 irc_reply( irc, 461, "%s :Need more parameters", cmd[0] ); 508 } 509 else if( *cmd[1] == '#' || *cmd[1] == '&' ) 510 { 511 if( cmd[2] ) 512 { 513 if( *cmd[2] == '+' || *cmd[2] == '-' ) 514 irc_reply( irc, 477, "%s :Can't change channel modes", cmd[1] ); 515 else if( *cmd[2] == 'b' ) 516 irc_reply( irc, 368, "%s :No bans possible", cmd[1] ); 517 } 518 else 519 irc_reply( irc, 324, "%s +%s", cmd[1], CMODE ); 520 } 521 else 522 { 523 if( nick_cmp( cmd[1], irc->nick ) == 0 ) 524 { 525 if( cmd[2] ) 526 irc_umode_set( irc, irc->nick, cmd[2] ); 527 } 528 else 529 irc_reply( irc, 502, ":Don't touch their modes" ); 530 } 531 } 532 else if( g_strcasecmp( cmd[0], "NAMES" ) == 0 ) 533 { 534 irc_names( irc, cmd[1]?cmd[1]:irc->channel ); 535 } 536 else if( g_strcasecmp( cmd[0], "PART" ) == 0 ) 537 { 538 struct conversation *c; 539 540 if( !cmd[1] ) 541 { 542 irc_reply( irc, 461, "%s :Need more parameters", cmd[0] ); 543 } 544 else if( g_strcasecmp( cmd[1], irc->channel ) == 0 ) 545 { 546 user_t *u = user_find( irc, irc->nick ); 547 548 /* Not allowed to leave control channel */ 549 irc_part( irc, u, irc->channel ); 550 irc_join( irc, u, irc->channel ); 551 } 552 else if( ( c = conv_findchannel( cmd[1] ) ) ) 553 { 554 user_t *u = user_find( irc, irc->nick ); 555 556 irc_part( irc, u, c->channel ); 557 558 if( c->gc && c->gc->prpl ) 559 { 560 c->joined = 0; 561 c->gc->prpl->chat_leave( c->gc, c->id ); 562 } 563 } 564 else 565 { 566 irc_reply( irc, 403, "%s :No such channel", cmd[1] ); 567 } 568 } 569 else if( g_strcasecmp( cmd[0], "JOIN" ) == 0 ) 570 { 571 if( !cmd[1] ) 572 { 573 irc_reply( irc, 461, "%s :Need more parameters", cmd[0] ); 574 } 575 else if( g_strcasecmp( cmd[1], irc->channel ) == 0 ) 576 ; /* Dude, you're already there... 577 RFC doesn't have any reply for that though? */ 578 else if( cmd[1] ) 579 { 580 if( ( cmd[1][0] == '#' || cmd[1][0] == '&' ) && cmd[1][1] ) 581 { 582 user_t *u = user_find( irc, cmd[1] + 1 ); 583 584 if( u && u->gc && u->gc->prpl && u->gc->prpl->chat_open ) 585 { 586 irc_reply( irc, 403, "%s :Initializing groupchat in a different channel", cmd[1] ); 587 588 if( !u->gc->prpl->chat_open( u->gc, u->handle ) ) 589 { 590 irc_usermsg( irc, "Could not open a groupchat with %s, maybe you don't have a connection to him/her yet?", u->nick ); 591 } 592 } 593 else 594 { 595 irc_reply( irc, 403, "%s :Groupchats are not possible with %s", cmd[1], cmd[1]+1 ); 596 } 597 } 598 else 599 { 600 irc_reply( irc, 403, "%s :No such channel", cmd[1] ); 601 } 602 } 603 } 604 else if( g_strcasecmp( cmd[0], "INVITE" ) == 0 ) 605 { 606 if( cmd[1] && cmd[2] ) 607 irc_invite( irc, cmd[1], cmd[2] ); 608 else 609 irc_reply( irc, 461, "%s :Need more parameters", cmd[0] ); 610 } 611 else if( g_strcasecmp( cmd[0], "PRIVMSG" ) == 0 || g_strcasecmp( cmd[0], "NOTICE" ) == 0 ) 612 { 613 if( !cmd[1] ) 614 { 615 irc_reply( irc, 461, "%s :Need more parameters", cmd[0] ); 616 } 617 else if ( !cmd[2] ) 618 { 619 irc_reply( irc, 412, ":No text to send" ); 620 } 621 else if ( irc->nick && g_strcasecmp( cmd[1], irc->nick ) == 0 ) 622 { 623 irc_write( irc, ":%s!%s@%s %s %s :%s", irc->nick, irc->user, irc->host, cmd[0], cmd[1], cmd[2] ); 624 } 625 else 626 { 627 if( g_strcasecmp( cmd[1], irc->channel ) == 0 ) 628 { 629 unsigned int i; 630 char *t = set_getstr( irc, "default_target" ); 631 632 if( g_strcasecmp( t, "last" ) == 0 && irc->last_target ) 633 cmd[1] = irc->last_target; 634 else if( g_strcasecmp( t, "root" ) == 0 ) 635 cmd[1] = irc->mynick; 636 637 for( i = 0; i < strlen( cmd[2] ); i ++ ) 638 { 639 if( cmd[2][i] == ' ' ) break; 640 if( cmd[2][i] == ':' || cmd[2][i] == ',' ) 641 { 642 cmd[1] = cmd[2]; 643 cmd[2] += i; 644 *cmd[2] = 0; 645 while( *(++cmd[2]) == ' ' ); 646 break; 647 } 648 } 649 650 irc->is_private = 0; 651 652 if( cmd[1] != irc->last_target ) 653 { 654 if( irc->last_target ) 655 g_free( irc->last_target ); 656 irc->last_target = g_strdup( cmd[1] ); 657 } 658 } 659 else 660 { 661 irc->is_private = 1; 662 } 663 irc_send( irc, cmd[1], cmd[2], ( g_strcasecmp( cmd[0], "NOTICE" ) == 0 ) ? IM_FLAG_AWAY : 0 ); 664 } 665 } 666 else if( g_strcasecmp( cmd[0], "WHO" ) == 0 ) 667 { 668 irc_who( irc, cmd[1] ); 669 } 670 else if( g_strcasecmp( cmd[0], "USERHOST" ) == 0 ) 671 { 672 user_t *u; 673 674 if( !cmd[1] ) 675 { 676 irc_reply( irc, 461, "%s :Need more parameters", cmd[0] ); 677 } 678 /* [TV] Usable USERHOST-implementation according to 679 RFC1459. Without this, mIRC shows an error 680 while connecting, and the used way of rejecting 681 breaks standards. 682 */ 683 684 for( i = 1; cmd[i]; i ++ ) 685 if( ( u = user_find( irc, cmd[i] ) ) ) 686 { 687 if( u->online && u->away ) 688 irc_reply( irc, 302, ":%s=-%s@%s", u->nick, u->user, u->host ); 689 else 690 irc_reply( irc, 302, ":%s=+%s@%s", u->nick, u->user, u->host ); 691 } 692 } 693 else if( g_strcasecmp( cmd[0], "ISON" ) == 0 ) 694 { 695 user_t *u; 696 char buff[IRC_MAX_LINE]; 697 int lenleft; 698 699 buff[0] = '\0'; 700 701 /* [SH] Leave room for : and \0 */ 702 lenleft = IRC_MAX_LINE - 2; 703 704 for( i = 1; cmd[i]; i ++ ) 705 { 706 if( ( u = user_find( irc, cmd[i] ) ) && u->online ) 707 { 708 /* [SH] Make sure we don't use too much buffer space. */ 709 lenleft -= strlen( u->nick ) + 1; 710 711 if( lenleft < 0 ) 712 { 713 break; 714 } 715 716 /* [SH] Add the nick to the buffer. Note 717 * that an extra space is always added. Even 718 * if it's the last nick in the list. Who 719 * cares? 720 */ 721 722 strcat( buff, u->nick ); 723 strcat( buff, " " ); 724 } 725 } 726 727 /* [WvG] Well, maybe someone cares, so why not remove it? */ 728 if( strlen( buff ) > 0 ) 729 buff[strlen(buff)-1] = '\0'; 730 731 /* [SH] By the way, that really *was* WvG talking. */ 732 /* [WvG] Really? */ 733 /* [SH] Yeah... But *this* is WvG talking too. ;-P */ 734 /* [WvG] *sigh* */ 735 736 irc_reply( irc, 303, ":%s", buff ); 737 } 738 else if( g_strcasecmp( cmd[0], "WATCH" ) == 0 ) 739 { 740 /* Obviously we could also mark a user structure as being 741 watched, but what if the WATCH command is sent right 742 after connecting? The user won't exist yet then... */ 743 for( i = 1; cmd[i]; i ++ ) 744 { 745 char *nick; 746 user_t *u; 747 748 if( !cmd[i][0] || !cmd[i][1] ) 749 break; 750 751 nick = g_strdup( cmd[i] + 1 ); 752 nick_lc( nick ); 753 754 u = user_find( irc, nick ); 755 756 if( cmd[i][0] == '+' ) 757 { 758 if( !g_hash_table_lookup( irc->watches, nick ) ) 759 g_hash_table_insert( irc->watches, nick, nick ); 760 761 if( u && u->online ) 762 irc_reply( irc, 604, "%s %s %s %d :%s", u->nick, u->user, u->host, time( NULL ), "is online" ); 763 else 764 irc_reply( irc, 605, "%s %s %s %d :%s", nick, "*", "*", time( NULL ), "is offline" ); 765 } 766 else if( cmd[i][0] == '-' ) 767 { 768 gpointer okey, ovalue; 769 770 if( g_hash_table_lookup_extended( irc->watches, nick, &okey, &ovalue ) ) 771 { 772 g_free( okey ); 773 g_hash_table_remove( irc->watches, okey ); 774 775 irc_reply( irc, 602, "%s %s %s %d :%s", nick, "*", "*", 0, "Stopped watching" ); 776 } 777 } 778 } 779 } 780 else if( g_strcasecmp( cmd[0], "TOPIC" ) == 0 ) 781 { 782 if( cmd[1] && cmd[2] ) 783 irc_reply( irc, 482, "%s :Cannot change topic", cmd[1] ); 784 else if( cmd[1] ) 785 irc_topic( irc, cmd[1] ); 786 else 787 irc_reply( irc, 461, "%s :Need more parameters", cmd[0] ); 788 } 789 else if( g_strcasecmp( cmd[0], "AWAY" ) == 0 ) 790 { 791 irc_away( irc, cmd[1] ); 792 } 793 else if( g_strcasecmp( cmd[0], "WHOIS" ) == 0 ) 794 { 795 if( cmd[1] ) 796 { 797 irc_whois( irc, cmd[1] ); 798 } 799 else 800 { 801 irc_reply( irc, 461, "%s :Need more parameters", cmd[0] ); 802 } 803 } 804 else if( g_strcasecmp( cmd[0], "WHOWAS" ) == 0 ) 805 { 806 /* For some reason irssi tries a whowas when whois fails. We can 807 ignore this, but then the user never gets a "user not found" 808 message from irssi which is a bit annoying. So just respond 809 with not-found and irssi users will get better error messages */ 810 811 if( cmd[1] ) 812 { 813 irc_reply( irc, 406, "%s :Nick does not exist", cmd[1] ); 814 irc_reply( irc, 369, "%s :End of WHOWAS", cmd[1] ); 815 } 816 else 817 { 818 irc_reply( irc, 461, "%s :Need more parameters", cmd[0] ); 819 } 820 } 821 else if( ( g_strcasecmp( cmd[0], "NICKSERV" ) == 0 ) || ( g_strcasecmp( cmd[0], "NS" ) == 0 ) ) 822 { 823 /* [SH] This aliases the NickServ command to PRIVMSG root */ 824 /* [TV] This aliases the NS command to PRIVMSG root as well */ 825 root_command( irc, cmd + 1 ); 826 } 827 else if( g_strcasecmp( cmd[0], "MOTD" ) == 0 ) 828 { 829 irc_motd( irc ); 830 } 831 else if( g_strcasecmp( cmd[0], "PONG" ) == 0 ) 832 { 833 /* We could check the value we get back from the user, but in 834 fact we don't care, we're just happy he's still alive. */ 835 irc->last_pong = gettime(); 836 irc->pinging = 0; 837 } 838 else if( g_strcasecmp( cmd[0], "COMPLETIONS" ) == 0 ) 839 { 840 user_t *u = user_find( irc, irc->mynick ); 841 help_t *h; 842 set_t *s; 843 int i; 844 845 irc_privmsg( irc, u, "NOTICE", irc->nick, "COMPLETIONS ", "OK" ); 846 847 for( i = 0; commands[i].command; i ++ ) 848 irc_privmsg( irc, u, "NOTICE", irc->nick, "COMPLETIONS ", commands[i].command ); 849 850 for( h = global.help; h; h = h->next ) 851 irc_privmsg( irc, u, "NOTICE", irc->nick, "COMPLETIONS help ", h->string ); 852 853 for( s = irc->set; s; s = s->next ) 854 irc_privmsg( irc, u, "NOTICE", irc->nick, "COMPLETIONS set ", s->key ); 855 856 irc_privmsg( irc, u, "NOTICE", irc->nick, "COMPLETIONS ", "END" ); 857 } 858 else if( set_getint( irc, "debug" ) ) 859 { 860 irc_usermsg( irc, "\002--- Unknown command:" ); 861 for( i = 0; cmd[i]; i ++ ) irc_usermsg( irc, "%s", cmd[i] ); 862 irc_usermsg( irc, "\002--------------------" ); 863 } 864 865 return( 1 ); 480 } 481 } 482 483 return cmd; 484 } 485 486 char *irc_build_line( char **cmd ) 487 { 488 int i, len; 489 char *s; 490 491 if( cmd[0] == NULL ) 492 return NULL; 493 494 len = 1; 495 for( i = 0; cmd[i]; i ++ ) 496 len += strlen( cmd[i] ) + 1; 497 498 if( strchr( cmd[i-1], ' ' ) != NULL ) 499 len ++; 500 501 s = g_new0( char, len + 1 ); 502 for( i = 0; cmd[i]; i ++ ) 503 { 504 if( cmd[i+1] == NULL && strchr( cmd[i], ' ' ) != NULL ) 505 strcat( s, ":" ); 506 507 strcat( s, cmd[i] ); 508 509 if( cmd[i+1] ) 510 strcat( s, " " ); 511 } 512 strcat( s, "\r\n" ); 513 514 return s; 866 515 } 867 516 … … 923 572 if( irc->sendbuffer != NULL ) { 924 573 size = strlen( irc->sendbuffer ) + strlen( line ); 925 #ifdef FLOOD_SEND926 if( size > FLOOD_SEND_MAXBUFFER ) {927 /* Die flooder, die! >:) */928 929 g_free(irc->sendbuffer);930 931 /* We need the \r\n at the start because else we might append our string to a half932 * sent line. A bit hackish, but it works.933 */934 irc->sendbuffer = g_strdup( "\r\nERROR :Sendq Exceeded\r\n" );935 irc->quit = 1;936 937 return;938 }939 #endif940 574 irc->sendbuffer = g_renew ( char, irc->sendbuffer, size + 1 ); 941 575 strcpy( ( irc->sendbuffer + strlen( irc->sendbuffer ) ), line ); … … 1037 671 } 1038 672 1039 void irc_who( irc_t *irc, char *channel ) 1040 { 1041 user_t *u = irc->users; 1042 struct conversation *c; 1043 GList *l; 1044 1045 if( !channel || *channel == '0' || *channel == '*' || !*channel ) 1046 while( u ) 1047 { 1048 irc_reply( irc, 352, "%s %s %s %s %s %c :0 %s", u->online ? irc->channel : "*", u->user, u->host, irc->myhost, u->nick, u->online ? ( u->away ? 'G' : 'H' ) : 'G', u->realname ); 1049 u = u->next; 1050 } 1051 else if( g_strcasecmp( channel, irc->channel ) == 0 ) 1052 while( u ) 1053 { 1054 if( u->online ) 1055 irc_reply( irc, 352, "%s %s %s %s %s %c :0 %s", channel, u->user, u->host, irc->myhost, u->nick, u->away ? 'G' : 'H', u->realname ); 1056 u = u->next; 1057 } 1058 else if( ( c = conv_findchannel( channel ) ) ) 1059 for( l = c->in_room; l; l = l->next ) 1060 { 1061 if( ( u = user_findhandle( c->gc, l->data ) ) ) 1062 irc_reply( irc, 352, "%s %s %s %s %s %c :0 %s", channel, u->user, u->host, irc->myhost, u->nick, u->away ? 'G' : 'H', u->realname ); 1063 } 1064 else if( ( u = user_find( irc, channel ) ) ) 1065 irc_reply( irc, 352, "%s %s %s %s %s %c :0 %s", channel, u->user, u->host, irc->myhost, u->nick, u->online ? ( u->away ? 'G' : 'H' ) : 'G', u->realname ); 1066 1067 irc_reply( irc, 315, "%s :End of /WHO list.", channel?channel:"**" ); 673 int irc_check_login( irc_t *irc ) 674 { 675 if( irc->user && irc->nick ) 676 { 677 if( global.conf->authmode == AUTHMODE_CLOSED && irc->status < USTATUS_AUTHORIZED ) 678 { 679 irc_reply( irc, 464, ":This server is password-protected." ); 680 return 0; 681 } 682 else 683 { 684 irc_login( irc ); 685 return 1; 686 } 687 } 688 else 689 { 690 /* More information needed. */ 691 return 0; 692 } 1068 693 } 1069 694 … … 1075 700 irc_reply( irc, 2, ":Host %s is running BitlBee " BITLBEE_VERSION " " ARCH "/" CPU ".", irc->myhost ); 1076 701 irc_reply( irc, 3, ":%s", IRCD_INFO ); 1077 irc_reply( irc, 4, "%s %s %s %s", irc->myhost, BITLBEE_VERSION, UMODES , CMODES );702 irc_reply( irc, 4, "%s %s %s %s", irc->myhost, BITLBEE_VERSION, UMODES UMODES_PRIV, CMODES ); 1078 703 irc_reply( irc, 5, "PREFIX=(ov)@+ CHANTYPES=#& CHANMODES=,,,%s NICKLEN=%d NETWORK=BitlBee CASEMAPPING=rfc1459 MAXTARGETS=1 WATCH=128 :are supported by this server", CMODES, MAX_NICK_LENGTH - 1 ); 1079 704 irc_motd( irc ); 1080 irc_umode_set( irc, irc->myhost, "+" UMODE);705 irc_umode_set( irc, "+" UMODE, 1 ); 1081 706 1082 707 u = user_add( irc, irc->mynick ); … … 1100 725 u->realname = g_strdup( irc->realname ); 1101 726 u->online = 1; 1102 // u->send_handler = msg_echo;1103 727 irc_spawn( irc, u ); 1104 728 1105 729 irc_usermsg( irc, "Welcome to the BitlBee gateway!\n\nIf you've never used BitlBee before, please do read the help information using the \x02help\x02 command. Lots of FAQ's are answered there." ); 730 731 if( global.conf->runmode == RUNMODE_FORKDAEMON || global.conf->runmode == RUNMODE_DAEMON ) 732 ipc_to_master_str( "CLIENT %s %s :%s\r\n", irc->host, irc->nick, irc->realname ); 1106 733 1107 734 irc->status = USTATUS_LOGGED_IN; … … 1156 783 } 1157 784 irc_reply( irc, 376, ":End of MOTD" ); 1158 close socket( fd );785 close( fd ); 1159 786 } 1160 787 } … … 1177 804 } 1178 805 1179 void irc_whois( irc_t *irc, char *nick ) 1180 { 1181 user_t *u = user_find( irc, nick ); 1182 1183 if( u ) 1184 { 1185 irc_reply( irc, 311, "%s %s %s * :%s", u->nick, u->user, u->host, u->realname ); 1186 1187 if( u->gc ) 1188 irc_reply( irc, 312, "%s %s.%s :%s network", u->nick, u->gc->user->username, 1189 *u->gc->user->proto_opt[0] ? u->gc->user->proto_opt[0] : "", u->gc->prpl->name ); 1190 else 1191 irc_reply( irc, 312, "%s %s :%s", u->nick, irc->myhost, IRCD_INFO ); 1192 1193 if( !u->online ) 1194 irc_reply( irc, 301, "%s :%s", u->nick, "User is offline" ); 1195 else if( u->away ) 1196 irc_reply( irc, 301, "%s :%s", u->nick, u->away ); 1197 1198 irc_reply( irc, 318, "%s :End of /WHOIS list", nick ); 1199 } 1200 else 1201 { 1202 irc_reply( irc, 401, "%s :Nick does not exist", nick ); 1203 } 1204 } 1205 1206 1207 void irc_umode_set( irc_t *irc, char *who, char *s ) 1208 { 806 void irc_umode_set( irc_t *irc, char *s, int allow_priv ) 807 { 808 /* allow_priv: Set to 0 if s contains user input, 1 if you want 809 to set a "privileged" mode (+o, +R, etc). */ 1209 810 char m[256], st = 1, *t; 1210 811 int i; … … 1219 820 if( *t == '+' || *t == '-' ) 1220 821 st = *t == '+'; 1221 else 822 else if( st == 0 || ( strchr( UMODES, *t ) || ( allow_priv && strchr( UMODES_PRIV, *t ) ) ) ) 1222 823 m[(int)*t] = st; 1223 824 } … … 1226 827 1227 828 for( i = 0; i < 256 && strlen( irc->umode ) < ( sizeof( irc->umode ) - 1 ); i ++ ) 1228 if( m[i] && strchr( UMODES, i ))829 if( m[i] ) 1229 830 irc->umode[strlen(irc->umode)] = i; 1230 831 1231 832 irc_reply( irc, 221, "+%s", irc->umode ); 1232 }1233 1234 int irc_away( irc_t *irc, char *away )1235 {1236 user_t *u = user_find( irc, irc->nick );1237 GSList *c = get_connections();1238 1239 if( !u ) return( 0 );1240 1241 if( away && *away )1242 {1243 int i, j;1244 1245 /* Copy away string, but skip control chars. Mainly because1246 Jabber really doesn't like them. */1247 u->away = g_malloc( strlen( away ) + 1 );1248 for( i = j = 0; away[i]; i ++ )1249 if( ( u->away[j] = away[i] ) >= ' ' )1250 j ++;1251 u->away[j] = 0;1252 1253 irc_reply( irc, 306, ":You're now away: %s", u->away );1254 /* irc_umode_set( irc, irc->myhost, "+a" ); */1255 }1256 else1257 {1258 if( u->away ) g_free( u->away );1259 u->away = NULL;1260 /* irc_umode_set( irc, irc->myhost, "-a" ); */1261 irc_reply( irc, 305, ":Welcome back" );1262 }1263 1264 while( c )1265 {1266 if( ((struct gaim_connection *)c->data)->flags & OPT_LOGGED_IN )1267 proto_away( c->data, u->away );1268 1269 c = c->next;1270 }1271 1272 return( 1 );1273 833 } 1274 834 … … 1324 884 } 1325 885 g_free( nick ); 1326 }1327 1328 void irc_invite( irc_t *irc, char *nick, char *channel )1329 {1330 struct conversation *c = conv_findchannel( channel );1331 user_t *u = user_find( irc, nick );1332 1333 if( u && c && ( u->gc == c->gc ) )1334 if( c->gc && c->gc->prpl && c->gc->prpl->chat_invite )1335 {1336 c->gc->prpl->chat_invite( c->gc, c->id, "", u->handle );1337 irc_reply( irc, 341, "%s %s", nick, channel );1338 return;1339 }1340 1341 irc_reply( irc, 482, "%s :Invite impossible; User/Channel non-existent or incompatible", channel );1342 886 } 1343 887 … … 1430 974 1431 975 if( u->send_handler ) 1432 return( u->send_handler( irc, u, s, flags ) ); 976 { 977 u->send_handler( irc, u, s, flags ); 978 return 1; 979 } 1433 980 } 1434 981 else if( c && c->gc && c->gc->prpl ) … … 1456 1003 } 1457 1004 1458 intbuddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags )1459 { 1460 if( !u || !u->gc ) return ( 0 );1005 void buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags ) 1006 { 1007 if( !u || !u->gc ) return; 1461 1008 1462 1009 if( set_getint( irc, "buddy_sendbuffer" ) && set_getint( irc, "buddy_sendbuffer_delay" ) > 0 ) … … 1494 1041 g_source_remove( u->sendbuf_timer ); 1495 1042 u->sendbuf_timer = g_timeout_add( delay, buddy_send_handler_delayed, u ); 1496 1497 return( 1 );1498 1043 } 1499 1044 else 1500 1045 { 1501 return( serv_send_im( irc, u, msg, flags ));1046 serv_send_im( irc, u, msg, flags ); 1502 1047 } 1503 1048 } … … 1604 1149 if( rv > 0 ) 1605 1150 { 1606 irc_write( irc, "ERROR :Closing Link: Ping Timeout: %d seconds", rv ); 1607 irc_free( irc ); 1151 irc_abort( irc, 0, "Ping Timeout: %d seconds", rv ); 1608 1152 return FALSE; 1609 1153 } -
irc.h
r7308b63 r9fae35c 33 33 #define IRC_PING_STRING "PinglBee" 34 34 35 /* #define FLOOD_SEND 36 * Not yet enabled by default due to some problems. 37 */ 38 #define FLOOD_SEND_INTERVAL 30 39 #define FLOOD_SEND_BYTES (1024*10) 40 #define FLOOD_SEND_MAXBUFFER (1024*20) 41 42 #define UMODES "ais" 35 #define UMODES "iasw" 36 #define UMODES_PRIV "Ro" 43 37 #define CMODES "nt" 44 38 #define CMODE "t" … … 47 41 typedef enum 48 42 { 49 USTATUS_OFFLINE ,43 USTATUS_OFFLINE = 0, 50 44 USTATUS_AUTHORIZED, 51 45 USTATUS_LOGGED_IN, 52 USTATUS_IDENTIFIED 46 USTATUS_IDENTIFIED, 47 USTATUS_SHUTDOWN = -1 53 48 } irc_status_t; 54 49 … … 110 105 111 106 irc_t *irc_new( int fd ); 107 void irc_abort( irc_t *irc, int immed, char *format, ... ); 112 108 void irc_free( irc_t *irc ); 113 109 114 int irc_exec( irc_t *irc, char **cmd ); 115 int irc_process( irc_t *irc ); 116 int irc_process_line( irc_t *irc, char *line ); 110 void irc_exec( irc_t *irc, char **cmd ); 111 void irc_process( irc_t *irc ); 112 char **irc_parse_line( char *line ); 113 char *irc_build_line( char **cmd ); 117 114 118 115 void irc_vawrite( irc_t *irc, char *format, va_list params ); … … 124 121 125 122 void irc_login( irc_t *irc ); 123 int irc_check_login( irc_t *irc ); 126 124 void irc_motd( irc_t *irc ); 127 125 void irc_names( irc_t *irc, char *channel ); 128 126 void irc_topic( irc_t *irc, char *channel ); 129 void irc_umode_set( irc_t *irc, char * who, char *s);127 void irc_umode_set( irc_t *irc, char *s, int allow_priv ); 130 128 void irc_who( irc_t *irc, char *channel ); 131 129 void irc_spawn( irc_t *irc, user_t *u ); … … 136 134 void irc_invite( irc_t *irc, char *nick, char *channel ); 137 135 void irc_whois( irc_t *irc, char *nick ); 138 int irc_away( irc_t *irc, char *away );139 136 void irc_setpass( irc_t *irc, const char *pass ); /* USE WITH CAUTION! */ 140 137 … … 144 141 int irc_noticefrom( irc_t *irc, char *nick, char *msg ); 145 142 146 intbuddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags );143 void buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags ); 147 144 148 145 #endif -
log.c
r7308b63 r9fae35c 38 38 openlog("bitlbee", LOG_PID, LOG_DAEMON); 39 39 40 logoutput.informational =&log_null;41 logoutput.warning =&log_null;42 logoutput.error =&log_null;40 logoutput.informational = &log_null; 41 logoutput.warning = &log_null; 42 logoutput.error = &log_null; 43 43 #ifdef DEBUG 44 logoutput.debug =&log_null;44 logoutput.debug = &log_null; 45 45 #endif 46 46 … … 51 51 /* I know it's ugly, but it works and I didn't feel like messing with pointer to function pointers */ 52 52 53 if(level ==LOGLVL_INFO) {54 if(output ==LOGOUTPUT_NULL)55 logoutput.informational =&log_null;56 else if(output ==LOGOUTPUT_IRC)57 logoutput.informational =&log_irc;58 else if(output ==LOGOUTPUT_SYSLOG)59 logoutput.informational =&log_syslog;60 else if(output ==LOGOUTPUT_CONSOLE)61 logoutput.informational =&log_console;53 if(level == LOGLVL_INFO) { 54 if(output == LOGOUTPUT_NULL) 55 logoutput.informational = &log_null; 56 else if(output == LOGOUTPUT_IRC) 57 logoutput.informational = &log_irc; 58 else if(output == LOGOUTPUT_SYSLOG) 59 logoutput.informational = &log_syslog; 60 else if(output == LOGOUTPUT_CONSOLE) 61 logoutput.informational = &log_console; 62 62 } 63 else if(level ==LOGLVL_WARNING) {64 if(output ==LOGOUTPUT_NULL)65 logoutput.warning =&log_null;66 else if(output ==LOGOUTPUT_IRC)67 logoutput.warning =&log_irc;68 else if(output ==LOGOUTPUT_SYSLOG)69 logoutput.warning =&log_syslog;70 else if(output ==LOGOUTPUT_CONSOLE)71 logoutput.warning =&log_console;63 else if(level == LOGLVL_WARNING) { 64 if(output == LOGOUTPUT_NULL) 65 logoutput.warning = &log_null; 66 else if(output == LOGOUTPUT_IRC) 67 logoutput.warning = &log_irc; 68 else if(output == LOGOUTPUT_SYSLOG) 69 logoutput.warning = &log_syslog; 70 else if(output == LOGOUTPUT_CONSOLE) 71 logoutput.warning = &log_console; 72 72 } 73 else if(level ==LOGLVL_ERROR) {74 if(output ==LOGOUTPUT_NULL)75 logoutput.error =&log_null;76 else if(output ==LOGOUTPUT_IRC)77 logoutput.error =&log_irc;78 else if(output ==LOGOUTPUT_SYSLOG)79 logoutput.error =&log_syslog;80 else if(output ==LOGOUTPUT_CONSOLE)81 logoutput.error =&log_console;73 else if(level == LOGLVL_ERROR) { 74 if(output == LOGOUTPUT_NULL) 75 logoutput.error = &log_null; 76 else if(output == LOGOUTPUT_IRC) 77 logoutput.error = &log_irc; 78 else if(output == LOGOUTPUT_SYSLOG) 79 logoutput.error = &log_syslog; 80 else if(output == LOGOUTPUT_CONSOLE) 81 logoutput.error = &log_console; 82 82 } 83 83 #ifdef DEBUG 84 else if(level ==LOGLVL_DEBUG) {85 if(output ==LOGOUTPUT_NULL)86 logoutput.debug =&log_null;87 else if(output ==LOGOUTPUT_IRC)88 logoutput.debug =&log_irc;89 else if(output ==LOGOUTPUT_SYSLOG)90 logoutput.debug =&log_syslog;91 else if(output ==LOGOUTPUT_CONSOLE)92 logoutput.debug =&log_console;84 else if(level == LOGLVL_DEBUG) { 85 if(output == LOGOUTPUT_NULL) 86 logoutput.debug = &log_null; 87 else if(output == LOGOUTPUT_IRC) 88 logoutput.debug = &log_irc; 89 else if(output == LOGOUTPUT_SYSLOG) 90 logoutput.debug = &log_syslog; 91 else if(output == LOGOUTPUT_CONSOLE) 92 logoutput.debug = &log_console; 93 93 } 94 94 #endif … … 106 106 va_end(ap); 107 107 108 if(level ==LOGLVL_INFO)108 if(level == LOGLVL_INFO) 109 109 (*(logoutput.informational))(level, msgstring); 110 if(level ==LOGLVL_WARNING)110 if(level == LOGLVL_WARNING) 111 111 (*(logoutput.warning))(level, msgstring); 112 if(level ==LOGLVL_ERROR)112 if(level == LOGLVL_ERROR) 113 113 (*(logoutput.error))(level, msgstring); 114 114 #ifdef DEBUG 115 if(level ==LOGLVL_DEBUG)115 if(level == LOGLVL_DEBUG) 116 116 (*(logoutput.debug))(level, msgstring); 117 117 #endif … … 133 133 134 134 static void log_irc(int level, char *message) { 135 if(level ==LOGLVL_ERROR)135 if(level == LOGLVL_ERROR) 136 136 irc_write_all(1, "ERROR :Error: %s", message); 137 if(level ==LOGLVL_WARNING)137 if(level == LOGLVL_WARNING) 138 138 irc_write_all(0, "ERROR :Warning: %s", message); 139 if(level ==LOGLVL_INFO)139 if(level == LOGLVL_INFO) 140 140 irc_write_all(0, "ERROR :Informational: %s", message); 141 141 #ifdef DEBUG 142 if(level ==LOGLVL_DEBUG)142 if(level == LOGLVL_DEBUG) 143 143 irc_write_all(0, "ERROR :Debug: %s", message); 144 144 #endif … … 148 148 149 149 static void log_syslog(int level, char *message) { 150 if(level ==LOGLVL_ERROR)150 if(level == LOGLVL_ERROR) 151 151 syslog(LOG_ERR, "%s", message); 152 if(level ==LOGLVL_WARNING)152 if(level == LOGLVL_WARNING) 153 153 syslog(LOG_WARNING, "%s", message); 154 if(level ==LOGLVL_INFO)154 if(level == LOGLVL_INFO) 155 155 syslog(LOG_INFO, "%s", message); 156 156 #ifdef DEBUG 157 if(level ==LOGLVL_DEBUG)157 if(level == LOGLVL_DEBUG) 158 158 syslog(LOG_DEBUG, "%s", message); 159 159 #endif … … 162 162 163 163 static void log_console(int level, char *message) { 164 if(level ==LOGLVL_ERROR)164 if(level == LOGLVL_ERROR) 165 165 fprintf(stderr, "Error: %s\n", message); 166 if(level ==LOGLVL_WARNING)166 if(level == LOGLVL_WARNING) 167 167 fprintf(stderr, "Warning: %s\n", message); 168 if(level ==LOGLVL_INFO)168 if(level == LOGLVL_INFO) 169 169 fprintf(stdout, "Informational: %s\n", message); 170 170 #ifdef DEBUG 171 if(level ==LOGLVL_DEBUG)171 if(level == LOGLVL_DEBUG) 172 172 fprintf(stdout, "Debug: %s\n", message); 173 173 #endif -
protocols/Makefile
r7308b63 r9fae35c 10 10 11 11 # [SH] Program variables 12 objects = http_client.o md5.o nogaim.o proxy.o sha.o $(SSL_CLIENT) util.o12 objects = http_client.o md5.o nogaim.o proxy.o sha.o $(SSL_CLIENT) 13 13 14 14 # [SH] The next two lines should contain the directory name (in $(subdirs)) -
protocols/http_client.c
r7308b63 r9fae35c 27 27 #include <stdio.h> 28 28 29 #include "sock.h"30 29 #include "http_client.h" 31 30 #include "url.h" 31 #include "sock.h" 32 32 33 33 -
protocols/jabber/jabber.c
r7308b63 r9fae35c 413 413 if (jd->die) 414 414 signoff(GJ_GC(gjc)); 415 } else if (len < 0 || errno != EAGAIN) {415 } else if (len == 0 || (len < 0 && (!sockerr_again() || gjc->ssl))) { 416 416 STATE_EVT(JCONN_STATE_OFF) 417 417 } … … 1249 1249 gjab_auth(gjc); 1250 1250 } else { 1251 gjab_reqroster(gjc); 1251 1252 account_online(GJ_GC(gjc)); 1252 1253 if (bud_list_cache_exists(GJ_GC(gjc))) 1254 do_import(GJ_GC(gjc), NULL); 1255 1253 1256 1254 ((struct jabber_data *)GJ_GC(gjc)->proto_data)->did_import = TRUE; 1257 1258 gjab_reqroster(gjc);1259 1255 } 1260 1256 } else { … … 1860 1856 xmlnode_insert_cdata(y, "away", -1); 1861 1857 y = xmlnode_insert_tag(x, "status"); 1862 { 1863 char *utf8 = str_to_utf8(message); 1864 xmlnode_insert_cdata(y, utf8, -1); 1865 g_free(utf8); 1866 } 1858 xmlnode_insert_cdata(y, message, -1); 1867 1859 gc->away = ""; 1868 1860 } else { -
protocols/msn/msn.c
r7308b63 r9fae35c 170 170 171 171 for( i = 0; msn_away_state_list[i].number > -1; i ++ ) 172 l = g_list_append( l, msn_away_state_list[i].name );172 l = g_list_append( l, (void*) msn_away_state_list[i].name ); 173 173 174 174 return( l ); … … 177 177 static char *msn_get_status_string( struct gaim_connection *gc, int number ) 178 178 { 179 struct msn_away_state *st = msn_away_state_by_number( number );179 const struct msn_away_state *st = msn_away_state_by_number( number ); 180 180 181 181 if( st ) 182 return( st->name );182 return( (char*) st->name ); 183 183 else 184 184 return( "" ); … … 189 189 char buf[1024]; 190 190 struct msn_data *md = gc->proto_data; 191 struct msn_away_state *st;191 const struct msn_away_state *st; 192 192 193 193 if( strcmp( state, GAIM_AWAY_CUSTOM ) == 0 ) -
protocols/msn/msn.h
r7308b63 r9fae35c 67 67 GSList *switchboards; 68 68 int buddycount; 69 struct msn_away_state *away_state;69 const struct msn_away_state *away_state; 70 70 }; 71 71 … … 131 131 132 132 int msn_chat_id; 133 extern struct msn_away_state msn_away_state_list[];134 extern struct msn_status_code msn_status_code_list[];133 extern const struct msn_away_state msn_away_state_list[]; 134 extern const struct msn_status_code msn_status_code_list[]; 135 135 136 136 /* Keep a list of all the active connections. We need these lists because … … 156 156 157 157 /* tables.c */ 158 struct msn_away_state *msn_away_state_by_number( int number );159 struct msn_away_state *msn_away_state_by_code( char *code );160 struct msn_away_state *msn_away_state_by_name( char *name );161 struct msn_status_code *msn_status_by_number( int number );158 const struct msn_away_state *msn_away_state_by_number( int number ); 159 const struct msn_away_state *msn_away_state_by_code( char *code ); 160 const struct msn_away_state *msn_away_state_by_name( char *name ); 161 const struct msn_status_code *msn_status_by_number( int number ); 162 162 163 163 /* sb.c */ -
protocols/msn/ns.c
r7308b63 r9fae35c 365 365 else if( strcmp( cmd[0], "ILN" ) == 0 ) 366 366 { 367 struct msn_away_state *st;367 const struct msn_away_state *st; 368 368 369 369 if( num_parts != 6 ) … … 393 393 else if( strcmp( cmd[0], "NLN" ) == 0 ) 394 394 { 395 struct msn_away_state *st;395 const struct msn_away_state *st; 396 396 397 397 if( num_parts != 5 ) … … 539 539 { 540 540 int num = atoi( cmd[0] ); 541 struct msn_status_code *err = msn_status_by_number( num );541 const struct msn_status_code *err = msn_status_by_number( num ); 542 542 543 543 g_snprintf( buf, sizeof( buf ), "Error reported by MSN server: %s", err->text ); -
protocols/msn/sb.c
r7308b63 r9fae35c 512 512 { 513 513 int num = atoi( cmd[0] ); 514 struct msn_status_code *err = msn_status_by_number( num );514 const struct msn_status_code *err = msn_status_by_number( num ); 515 515 516 516 g_snprintf( buf, sizeof( buf ), "Error reported by switchboard server: %s", err->text ); -
protocols/msn/tables.c
r7308b63 r9fae35c 27 27 #include "msn.h" 28 28 29 struct msn_away_state msn_away_state_list[] =29 const struct msn_away_state msn_away_state_list[] = 30 30 { 31 31 { 0, "NLN", "Available" }, … … 40 40 }; 41 41 42 struct msn_away_state *msn_away_state_by_number( int number )42 const struct msn_away_state *msn_away_state_by_number( int number ) 43 43 { 44 44 int i; … … 51 51 } 52 52 53 struct msn_away_state *msn_away_state_by_code( char *code )53 const struct msn_away_state *msn_away_state_by_code( char *code ) 54 54 { 55 55 int i; … … 62 62 } 63 63 64 struct msn_away_state *msn_away_state_by_name( char *name )64 const struct msn_away_state *msn_away_state_by_name( char *name ) 65 65 { 66 66 int i; … … 73 73 } 74 74 75 struct msn_status_code msn_status_code_list[] =75 const struct msn_status_code msn_status_code_list[] = 76 76 { 77 77 { 200, "Invalid syntax", 0 }, … … 144 144 }; 145 145 146 struct msn_status_code *msn_status_by_number( int number )146 const struct msn_status_code *msn_status_by_number( int number ) 147 147 { 148 148 static struct msn_status_code *unknown = NULL; -
protocols/nogaim.h
r7308b63 r9fae35c 288 288 G_MODULE_EXPORT void serv_got_chat_in( struct gaim_connection *gc, int id, char *who, int whisper, char *msg, time_t mtime ); 289 289 G_MODULE_EXPORT void serv_got_chat_left( struct gaim_connection *gc, int id ); 290 /* void serv_finish_login( struct gaim_connection *gc ); */291 290 292 291 /* util.c */ 293 G_MODULE_EXPORT char *utf8_to_str( const char *in );294 G_MODULE_EXPORT char *str_to_utf8( const char *in );295 292 G_MODULE_EXPORT void strip_linefeed( gchar *text ); 296 293 G_MODULE_EXPORT char *add_cr( char *text ); … … 299 296 G_MODULE_EXPORT time_t get_time( int year, int month, int day, int hour, int min, int sec ); 300 297 G_MODULE_EXPORT void strip_html( char *msg ); 301 G_MODULE_EXPORT char * escape_html(const char *html);298 G_MODULE_EXPORT char *escape_html( const char *html ); 302 299 G_MODULE_EXPORT void info_string_append(GString *str, char *newline, char *name, char *value); 300 G_MODULE_EXPORT char *ipv6_wrap( char *src ); 301 G_MODULE_EXPORT char *ipv6_unwrap( char *src ); 303 302 304 303 /* prefs.c */ -
protocols/oscar/oscar.c
r7308b63 r9fae35c 21 21 */ 22 22 23 #include "sock.h"24 23 #include <errno.h> 25 24 #include <ctype.h> … … 33 32 #include "bitlbee.h" 34 33 #include "proxy.h" 34 #include "sock.h" 35 35 36 36 #include "aim.h" … … 608 608 return; 609 609 } 610 /* [WvG] Wheeeee! Who needs error checking anyway? ;-) */ 610 611 read(pos->fd, m, 16); 611 612 m[16] = '\0'; -
protocols/oscar/rxqueue.c
r7308b63 r9fae35c 353 353 return -1; /* its a aim_conn_close()'d connection */ 354 354 355 if (conn->fd < 3) /* can happen when people abuse the interface */ 355 /* KIDS, THIS IS WHAT HAPPENS IF YOU USE CODE WRITTEN FOR GUIS IN A DAEMON! 356 357 And wouldn't it make sense to return something that prevents this function 358 from being called again IMMEDIATELY (and making the program suck up all 359 CPU time)?... 360 361 if (conn->fd < 3) 356 362 return 0; 363 */ 357 364 358 365 if (conn->status & AIM_CONN_STATUS_INPROGRESS) -
protocols/oscar/service.c
r7308b63 r9fae35c 736 736 737 737 tlvlen = aim_addtlvtochain32(&tl, 0x0006, data); 738 739 printf("%d\n", tlvlen);740 738 741 739 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 8))) -
protocols/ssl_bogus.c
r7308b63 r9fae35c 51 51 return( -1 ); 52 52 } 53 54 GaimInputCondition ssl_getdirection( void *conn ) 55 { 56 return GAIM_INPUT_READ; 57 } -
protocols/yahoo/Makefile
r7308b63 r9fae35c 10 10 11 11 # [SH] Program variables 12 objects = yahoo.o crypt.o libyahoo2.o yahoo_fn.o yahoo_httplib.o yahoo_ list.o yahoo_util.o12 objects = yahoo.o crypt.o libyahoo2.o yahoo_fn.o yahoo_httplib.o yahoo_util.o 13 13 14 14 CFLAGS += -Wall -DSTDC_HEADERS -DHAVE_STRING_H -DHAVE_STRCHR -DHAVE_MEMCPY -DHAVE_GLIB -
protocols/yahoo/yahoo.c
r7308b63 r9fae35c 189 189 { 190 190 struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data; 191 191 192 192 gc->away = NULL; 193 194 if (msg)193 194 if( msg ) 195 195 { 196 196 yd->current_status = YAHOO_STATUS_CUSTOM; 197 197 gc->away = ""; 198 198 } 199 else if (state)199 if( state ) 200 200 { 201 201 gc->away = ""; 202 if( g_strcasecmp( state, "Available" ) == 0 )202 if( g_strcasecmp( state, "Available" ) == 0 ) 203 203 { 204 204 yd->current_status = YAHOO_STATUS_AVAILABLE; … … 235 235 } 236 236 } 237 else if 237 else if( gc->is_idle ) 238 238 yd->current_status = YAHOO_STATUS_IDLE; 239 239 else 240 240 yd->current_status = YAHOO_STATUS_AVAILABLE; 241 241 242 yahoo_set_away( yd->y2_id, yd->current_status, msg, gc->away != NULL ); 242 if( yd->current_status == YAHOO_STATUS_INVISIBLE ) 243 yahoo_set_away( yd->y2_id, yd->current_status, NULL, gc->away != NULL ); 244 else 245 yahoo_set_away( yd->y2_id, yd->current_status, msg, gc->away != NULL ); 243 246 } 244 247 -
protocols/yahoo/yahoo_fn.c
r7308b63 r9fae35c 25 25 #include "yahoo_fn.h" 26 26 27 unsigned char table_0[256] = {27 static const unsigned char table_0[256] = { 28 28 0x5A, 0x41, 0x11, 0x77, 0x29, 0x9C, 0x31, 0xAD, 29 29 0x4A, 0x32, 0x1A, 0x6D, 0x56, 0x9F, 0x39, 0xA6, … … 59 59 0x7B, 0xBE, 0xF9, 0xAF, 0x82, 0x63, 0x47, 0x23 }; 60 60 61 unsigned char table_1[256] = {61 static const unsigned char table_1[256] = { 62 62 0x08, 0xCB, 0x54, 0xCF, 0x97, 0x53, 0x59, 0xF1, 63 63 0x66, 0xEC, 0xDB, 0x1B, 0xB1, 0xE2, 0x36, 0xEB, … … 93 93 0x05, 0x95, 0xBB, 0x79, 0x61, 0x3E, 0x81, 0xF7 }; 94 94 95 unsigned char table_2[32] = {95 static const unsigned char table_2[32] = { 96 96 0x19, 0x05, 0x09, 0x1C, 0x0B, 0x1A, 0x12, 0x03, 97 97 0x06, 0x04, 0x0D, 0x1D, 0x15, 0x0E, 0x1B, 0x18, … … 99 99 0x16, 0x0A, 0x10, 0x0F, 0x01, 0x14, 0x11, 0x17 }; 100 100 101 unsigned char table_3[256] = {101 static const unsigned char table_3[256] = { 102 102 0xBC, 0x1B, 0xCC, 0x1E, 0x5B, 0x59, 0x4F, 0xA8, 103 103 0x62, 0xC6, 0xC1, 0xBB, 0x83, 0x2D, 0xA3, 0xA6, … … 133 133 0x7C, 0xEF, 0xE0, 0x99, 0x09, 0xA0, 0x01, 0x7E }; 134 134 135 unsigned char table_4[32] = {135 static const unsigned char table_4[32] = { 136 136 0x1F, 0x0B, 0x00, 0x1E, 0x03, 0x0E, 0x15, 0x01, 137 137 0x1A, 0x17, 0x1D, 0x1B, 0x11, 0x0F, 0x0A, 0x12, … … 139 139 0x08, 0x05, 0x10, 0x19, 0x0C, 0x14, 0x16, 0x1C }; 140 140 141 unsigned char table_5[256] = {141 static const unsigned char table_5[256] = { 142 142 0x9A, 0xAB, 0x61, 0x28, 0x0A, 0x23, 0xFC, 0xBA, 143 143 0x90, 0x22, 0xB7, 0x62, 0xD9, 0x09, 0x91, 0xF4, … … 173 173 0x46, 0x73, 0x69, 0xD5, 0x10, 0xEE, 0x02, 0xEF }; 174 174 175 unsigned char table_6[32] = {175 static const unsigned char table_6[32] = { 176 176 0x1A, 0x1C, 0x0F, 0x0C, 0x00, 0x02, 0x13, 0x09, 177 177 0x11, 0x05, 0x0D, 0x12, 0x18, 0x0B, 0x04, 0x10, … … 179 179 0x19, 0x1F, 0x01, 0x0E, 0x15, 0x06, 0x0A, 0x1D }; 180 180 181 unsigned char table_7[256] = {181 static const unsigned char table_7[256] = { 182 182 0x52, 0x11, 0x72, 0xD0, 0x76, 0xD7, 0xAE, 0x03, 183 183 0x7F, 0x19, 0xF4, 0xB8, 0xB3, 0x5D, 0xCA, 0x2D, … … 213 213 0x88, 0x9E, 0x9C, 0x5B, 0x4D, 0x3A, 0x39, 0xEF }; 214 214 215 unsigned char table_8[32] = {215 static const unsigned char table_8[32] = { 216 216 0x13, 0x08, 0x1E, 0x1D, 0x17, 0x16, 0x07, 0x1F, 217 217 0x0E, 0x03, 0x1A, 0x19, 0x01, 0x12, 0x11, 0x10, … … 219 219 0x1C, 0x18, 0x0A, 0x15, 0x02, 0x1B, 0x06, 0x0D }; 220 220 221 unsigned char table_9[256] = {221 static const unsigned char table_9[256] = { 222 222 0x20, 0x2A, 0xDA, 0xFE, 0x76, 0x0D, 0xED, 0x39, 223 223 0x51, 0x4C, 0x46, 0x9A, 0xF1, 0xB0, 0x10, 0xC7, … … 253 253 0xF9, 0xF0, 0x2C, 0x74, 0xE9, 0x71, 0xC0, 0x2D }; 254 254 255 unsigned char table_10[32] = {255 static const unsigned char table_10[32] = { 256 256 0x1D, 0x12, 0x11, 0x0D, 0x1E, 0x19, 0x16, 0x1B, 257 257 0x18, 0x13, 0x07, 0x17, 0x0C, 0x02, 0x00, 0x15, … … 259 259 0x1F, 0x1A, 0x0B, 0x09, 0x0A, 0x14, 0x1C, 0x03 }; 260 260 261 unsigned char table_11[256] = {261 static const unsigned char table_11[256] = { 262 262 0x6B, 0x1D, 0xC6, 0x0A, 0xB7, 0xAC, 0xB2, 0x11, 263 263 0x29, 0xD3, 0xA2, 0x4D, 0xCB, 0x03, 0xEF, 0xA6, … … 293 293 0x64, 0x76, 0xFF, 0x9F, 0x2E, 0x02, 0xCC, 0x57 }; 294 294 295 unsigned char table_12[32] = {295 static const unsigned char table_12[32] = { 296 296 0x14, 0x1B, 0x18, 0x00, 0x1F, 0x15, 0x17, 0x07, 297 297 0x11, 0x1A, 0x0E, 0x13, 0x12, 0x06, 0x01, 0x03, … … 299 299 0x0D, 0x1E, 0x04, 0x05, 0x08, 0x16, 0x0A, 0x02 }; 300 300 301 unsigned char table_13[256] = {301 static const unsigned char table_13[256] = { 302 302 0x37, 0x8A, 0x1B, 0x91, 0xA5, 0x2B, 0x2D, 0x88, 303 303 0x8E, 0xFE, 0x0E, 0xD3, 0xF3, 0xE9, 0x7D, 0xD1, … … 333 333 0x97, 0x4A, 0xB8, 0x7A, 0xF4, 0xFB, 0x04, 0xA8 }; 334 334 335 unsigned char table_14[32] = {335 static const unsigned char table_14[32] = { 336 336 0x04, 0x14, 0x13, 0x15, 0x1A, 0x1B, 0x0F, 0x16, 337 337 0x02, 0x0D, 0x0C, 0x06, 0x10, 0x17, 0x01, 0x0B, … … 339 339 0x11, 0x09, 0x1D, 0x07, 0x0E, 0x12, 0x03, 0x00 }; 340 340 341 unsigned char table_15[256] = {341 static const unsigned char table_15[256] = { 342 342 0x61, 0x48, 0x58, 0x41, 0x7F, 0x88, 0x43, 0x42, 343 343 0xD9, 0x80, 0x81, 0xFE, 0xC6, 0x49, 0xD7, 0x2C, … … 373 373 0xAB, 0x8D, 0x02, 0x74, 0xBD, 0x3D, 0x8E, 0xDD }; 374 374 375 unsigned char table_16[256] = {375 static const unsigned char table_16[256] = { 376 376 0x3F, 0x9C, 0x17, 0xC1, 0x59, 0xC6, 0x23, 0x93, 377 377 0x4B, 0xDF, 0xCB, 0x55, 0x2B, 0xDE, 0xCD, 0xAD, … … 407 407 0xF4, 0xBE, 0xEA, 0x19, 0x43, 0x01, 0xB1, 0x96 }; 408 408 409 unsigned char table_17[256] = {409 static const unsigned char table_17[256] = { 410 410 0x7E, 0xF1, 0xD3, 0x75, 0x87, 0xA6, 0xED, 0x9E, 411 411 0xA9, 0xD5, 0xC6, 0xBF, 0xE6, 0x6A, 0xEE, 0x4B, … … 441 441 0x9F, 0x99, 0x62, 0xAA, 0xFA, 0x11, 0x0C, 0x52 }; 442 442 443 unsigned char table_18[256] = {443 static const unsigned char table_18[256] = { 444 444 0x0F, 0x42, 0x3D, 0x86, 0x3E, 0x66, 0xFE, 0x5C, 445 445 0x52, 0xE2, 0xA3, 0xB3, 0xCE, 0x16, 0xCC, 0x95, … … 475 475 0xFA, 0x4E, 0xEF, 0x54, 0xE6, 0x7F, 0xC0, 0x67 }; 476 476 477 unsigned char table_19[256] = {477 static const unsigned char table_19[256] = { 478 478 0xEA, 0xE7, 0x13, 0x14, 0xB9, 0xC0, 0xC4, 0x42, 479 479 0x49, 0x6E, 0x2A, 0xA6, 0x65, 0x3C, 0x6A, 0x40, … … 509 509 0x1E, 0x0D, 0xAE, 0x7B, 0x5E, 0x61, 0xE9, 0x63 }; 510 510 511 unsigned char table_20[32] = {511 static const unsigned char table_20[32] = { 512 512 0x0D, 0x0B, 0x11, 0x02, 0x05, 0x1B, 0x08, 0x1D, 513 513 0x04, 0x14, 0x01, 0x09, 0x00, 0x19, 0x1E, 0x15, … … 515 515 0x13, 0x1A, 0x06, 0x17, 0x0E, 0x12, 0x18, 0x03 }; 516 516 517 unsigned char table_21[256] = {517 static const unsigned char table_21[256] = { 518 518 0x4C, 0x94, 0xAD, 0x66, 0x9E, 0x69, 0x04, 0xA8, 519 519 0x61, 0xE0, 0xE1, 0x3D, 0xFD, 0x9C, 0xFB, 0x19, … … 549 549 0xFF, 0xD8, 0xE7, 0xDD, 0xBB, 0x78, 0xD5, 0x81 }; 550 550 551 unsigned char table_22[32] = {551 static const unsigned char table_22[32] = { 552 552 0x0B, 0x15, 0x1C, 0x0C, 0x06, 0x0A, 0x1D, 0x16, 553 553 0x12, 0x0E, 0x04, 0x11, 0x1F, 0x0F, 0x07, 0x02, … … 555 555 0x03, 0x00, 0x01, 0x08, 0x09, 0x14, 0x1B, 0x1E }; 556 556 557 unsigned char table_23[256] = {557 static const unsigned char table_23[256] = { 558 558 0x36, 0x53, 0x2D, 0xD0, 0x7A, 0xF0, 0xD5, 0x1C, 559 559 0x50, 0x61, 0x9A, 0x90, 0x0B, 0x29, 0x20, 0x77, … … 589 589 0x1D, 0x15, 0xC6, 0xBF, 0xA9, 0x43, 0xC0, 0x49 }; 590 590 591 unsigned char table_24[256] = {591 static const unsigned char table_24[256] = { 592 592 0xDC, 0x5A, 0xE6, 0x59, 0x64, 0xDA, 0x58, 0x40, 593 593 0x95, 0xF8, 0x2A, 0xE0, 0x39, 0x7E, 0x32, 0x89, … … 623 623 0xEA, 0x8D, 0x2D, 0x5F, 0xF6, 0xA7, 0x80, 0x3A }; 624 624 625 unsigned char table_25[32] = {625 static const unsigned char table_25[32] = { 626 626 0x0A, 0x11, 0x17, 0x03, 0x05, 0x0B, 0x18, 0x13, 627 627 0x09, 0x02, 0x00, 0x1C, 0x0C, 0x08, 0x1B, 0x14, … … 629 629 0x0F, 0x1A, 0x10, 0x04, 0x12, 0x15, 0x07, 0x1F }; 630 630 631 unsigned char table_26[32] = {631 static const unsigned char table_26[32] = { 632 632 0x19, 0x13, 0x1B, 0x01, 0x1C, 0x0D, 0x0C, 0x15, 633 633 0x0B, 0x00, 0x1A, 0x0F, 0x12, 0x16, 0x08, 0x0A, … … 635 635 0x1F, 0x07, 0x17, 0x05, 0x02, 0x0E, 0x1E, 0x09 }; 636 636 637 unsigned char table_27[256] = {637 static const unsigned char table_27[256] = { 638 638 0x72, 0xF0, 0x14, 0xCB, 0x61, 0xA5, 0xB2, 0x02, 639 639 0x75, 0x22, 0xC3, 0x9D, 0x5A, 0x63, 0xFA, 0x5F, … … 669 669 0x5E, 0x6F, 0x47, 0x64, 0xBC, 0x9A, 0x60, 0x7E }; 670 670 671 unsigned char table_28[32] = {671 static const unsigned char table_28[32] = { 672 672 0x15, 0x05, 0x08, 0x19, 0x02, 0x18, 0x1E, 0x07, 673 673 0x0D, 0x0C, 0x1A, 0x06, 0x17, 0x03, 0x10, 0x09, … … 675 675 0x1B, 0x13, 0x0A, 0x16, 0x0E, 0x00, 0x1D, 0x14 }; 676 676 677 unsigned char table_29[256] = {677 static const unsigned char table_29[256] = { 678 678 0x34, 0x59, 0x05, 0x13, 0x09, 0x1D, 0xDF, 0x77, 679 679 0x11, 0xA5, 0x92, 0x27, 0xCD, 0x7B, 0x5E, 0x80, … … 709 709 0x46, 0x62, 0xB6, 0xB0, 0x15, 0x04, 0x95, 0x4D }; 710 710 711 unsigned char table_30[32] = {711 static const unsigned char table_30[32] = { 712 712 0x00, 0x1C, 0x0E, 0x0C, 0x06, 0x16, 0x09, 0x12, 713 713 0x01, 0x13, 0x0B, 0x14, 0x11, 0x08, 0x04, 0x18, … … 715 715 0x1E, 0x1F, 0x0F, 0x07, 0x0D, 0x05, 0x1D, 0x0A }; 716 716 717 unsigned char table_31[256] = {717 static const unsigned char table_31[256] = { 718 718 0xDF, 0xD8, 0x3F, 0xBC, 0x5F, 0xC9, 0x8E, 0x4C, 719 719 0x0B, 0x3C, 0xE5, 0xBF, 0x39, 0xD5, 0x30, 0xDD, … … 749 749 0x92, 0x48, 0xF7, 0x0A, 0xF6, 0xE2, 0x4B, 0x56 }; 750 750 751 unsigned char table_32[256] = {751 static const unsigned char table_32[256] = { 752 752 0x7B, 0x0F, 0x56, 0x2F, 0x1E, 0x2A, 0x7A, 0xD1, 753 753 0x02, 0x91, 0x4E, 0x37, 0x6C, 0x10, 0xA7, 0xF2, … … 783 783 0x47, 0x6B, 0x8A, 0xA2, 0x9A, 0xA3, 0x45, 0x41 }; 784 784 785 unsigned char table_33[256] = {785 static const unsigned char table_33[256] = { 786 786 0xDE, 0xD3, 0x79, 0x67, 0x13, 0x5C, 0x04, 0xF2, 787 787 0xD9, 0x9F, 0x65, 0x56, 0xCC, 0x3B, 0xA4, 0x9A, … … 817 817 0x80, 0x3C, 0xEE, 0x47, 0xC6, 0x3A, 0x53, 0xF6 }; 818 818 819 unsigned char table_34[256] = {819 static const unsigned char table_34[256] = { 820 820 0xF0, 0xE9, 0x3E, 0xD6, 0x89, 0xC8, 0xC7, 0x23, 821 821 0x75, 0x26, 0x5F, 0x9C, 0x57, 0xB8, 0x2A, 0x29, … … 851 851 0x03, 0x05, 0xBF, 0x06, 0x1B, 0xC0, 0x1A, 0x60 }; 852 852 853 unsigned char table_35[256] = {853 static const unsigned char table_35[256] = { 854 854 0xCC, 0x40, 0xEF, 0x1F, 0xDB, 0xE5, 0x71, 0x51, 855 855 0x3B, 0x0F, 0x7D, 0x9C, 0x83, 0x17, 0x6F, 0x8F, … … 885 885 0x59, 0xC4, 0x9F, 0xD0, 0x66, 0x7B, 0x33, 0xB5 }; 886 886 887 unsigned char table_36[256] = {887 static const unsigned char table_36[256] = { 888 888 0xDB, 0x6F, 0xFE, 0xB3, 0x5C, 0x1F, 0xB8, 0xBF, 889 889 0xA3, 0x71, 0x11, 0x56, 0x90, 0xE2, 0x63, 0x18, … … 919 919 0x4B, 0xB6, 0x7B, 0x4D, 0xCF, 0x7E, 0x48, 0xE3 }; 920 920 921 unsigned char table_37[256] = {921 static const unsigned char table_37[256] = { 922 922 0x1F, 0xD6, 0xB1, 0xB3, 0x40, 0xAD, 0xDE, 0xB7, 923 923 0x19, 0xB4, 0xE7, 0x0B, 0x9C, 0x2D, 0xE0, 0xF5, … … 953 953 0x73, 0xC8, 0x86, 0x47, 0xDB, 0xAB, 0x6F, 0x8C }; 954 954 955 unsigned char table_38[256] = {955 static const unsigned char table_38[256] = { 956 956 0xAA, 0x8D, 0x37, 0x94, 0x99, 0xDD, 0x70, 0x77, 957 957 0x78, 0xC9, 0x0F, 0xFA, 0xE2, 0x05, 0xC2, 0x16, … … 987 987 0x09, 0x76, 0x00, 0x46, 0x4E, 0x53, 0xCE, 0x4A }; 988 988 989 unsigned char table_39[32] = {989 static const unsigned char table_39[32] = { 990 990 0x12, 0x18, 0x0E, 0x08, 0x16, 0x05, 0x06, 0x00, 991 991 0x11, 0x17, 0x15, 0x1B, 0x14, 0x01, 0x1F, 0x19, … … 993 993 0x0B, 0x13, 0x0C, 0x09, 0x1E, 0x02, 0x1A, 0x1C }; 994 994 995 unsigned char table_40[32] = {995 static const unsigned char table_40[32] = { 996 996 0x16, 0x02, 0x06, 0x0E, 0x0D, 0x1C, 0x08, 0x0A, 997 997 0x0F, 0x13, 0x0B, 0x18, 0x07, 0x04, 0x14, 0x01, … … 999 999 0x12, 0x19, 0x1D, 0x03, 0x0C, 0x00, 0x09, 0x15 }; 1000 1000 1001 unsigned char table_41[32] = {1001 static const unsigned char table_41[32] = { 1002 1002 0x13, 0x18, 0x04, 0x1F, 0x1D, 0x11, 0x03, 0x00, 1003 1003 0x10, 0x12, 0x06, 0x0A, 0x1C, 0x07, 0x15, 0x0E, … … 1005 1005 0x1A, 0x17, 0x14, 0x1E, 0x0D, 0x0F, 0x19, 0x1B }; 1006 1006 1007 unsigned char table_42[32] = {1007 static const unsigned char table_42[32] = { 1008 1008 0x00, 0x08, 0x15, 0x1D, 0x05, 0x18, 0x06, 0x07, 1009 1009 0x1F, 0x01, 0x0B, 0x03, 0x19, 0x13, 0x02, 0x1C, … … 1011 1011 0x1B, 0x16, 0x10, 0x0D, 0x0A, 0x14, 0x12, 0x04 }; 1012 1012 1013 unsigned char table_43[256] = {1013 static const unsigned char table_43[256] = { 1014 1014 0x34, 0xB7, 0x36, 0x85, 0x5F, 0x93, 0x98, 0x70, 1015 1015 0x1E, 0x59, 0x83, 0x60, 0x6F, 0xBF, 0xF9, 0xD0, … … 1045 1045 0x73, 0x76, 0x3A, 0x21, 0x53, 0xA4, 0x50, 0x6A }; 1046 1046 1047 unsigned char table_44[32] = {1047 static const unsigned char table_44[32] = { 1048 1048 0x1A, 0x0E, 0x0A, 0x17, 0x1F, 0x08, 0x10, 0x14, 1049 1049 0x0C, 0x0F, 0x09, 0x1C, 0x06, 0x18, 0x1E, 0x12, … … 1051 1051 0x16, 0x19, 0x05, 0x1D, 0x02, 0x07, 0x04, 0x1B }; 1052 1052 1053 unsigned char table_45[256] = {1053 static const unsigned char table_45[256] = { 1054 1054 0x5E, 0xD6, 0xE2, 0x54, 0x35, 0xC2, 0xAC, 0x9D, 1055 1055 0x92, 0x64, 0x57, 0x65, 0xC8, 0xAE, 0x21, 0xA9, … … 1085 1085 0xF9, 0x2B, 0x32, 0x8F, 0xFB, 0xC7, 0x07, 0x82 }; 1086 1086 1087 unsigned char table_46[256] = {1087 static const unsigned char table_46[256] = { 1088 1088 0x85, 0x78, 0xFE, 0x6C, 0x61, 0xA0, 0x71, 0xCC, 1089 1089 0x45, 0x54, 0x7A, 0xE6, 0x82, 0x1D, 0xA6, 0x02, … … 1119 1119 0xC7, 0xE4, 0x37, 0xE5, 0xFC, 0xBD, 0x99, 0x41 }; 1120 1120 1121 unsigned char table_47[32] = {1121 static const unsigned char table_47[32] = { 1122 1122 0x18, 0x1D, 0x16, 0x10, 0x11, 0x04, 0x1E, 0x08, 1123 1123 0x19, 0x0E, 0x0F, 0x02, 0x14, 0x1C, 0x07, 0x17, … … 1125 1125 0x13, 0x15, 0x0C, 0x00, 0x06, 0x1F, 0x03, 0x1B }; 1126 1126 1127 unsigned char table_48[32] = {1127 static const unsigned char table_48[32] = { 1128 1128 0x13, 0x08, 0x15, 0x01, 0x17, 0x10, 0x0F, 0x1F, 1129 1129 0x1D, 0x0D, 0x12, 0x03, 0x06, 0x0A, 0x1C, 0x19, … … 1131 1131 0x14, 0x09, 0x0C, 0x18, 0x05, 0x07, 0x0E, 0x0B }; 1132 1132 1133 unsigned char table_49[32] = {1133 static const unsigned char table_49[32] = { 1134 1134 0x1F, 0x0F, 0x19, 0x07, 0x18, 0x05, 0x1E, 0x1D, 1135 1135 0x15, 0x08, 0x17, 0x10, 0x0A, 0x0E, 0x0C, 0x1B, … … 1137 1137 0x12, 0x1C, 0x0B, 0x16, 0x14, 0x01, 0x11, 0x00 }; 1138 1138 1139 unsigned char table_50[32] = {1139 static const unsigned char table_50[32] = { 1140 1140 0x16, 0x18, 0x1C, 0x0E, 0x12, 0x00, 0x04, 0x1B, 1141 1141 0x1F, 0x13, 0x17, 0x0A, 0x1E, 0x03, 0x0C, 0x01, … … 1143 1143 0x06, 0x0D, 0x0B, 0x1D, 0x05, 0x07, 0x11, 0x1A }; 1144 1144 1145 unsigned char table_51[32] = {1145 static const unsigned char table_51[32] = { 1146 1146 0x1C, 0x0D, 0x1B, 0x07, 0x17, 0x0E, 0x06, 0x01, 1147 1147 0x12, 0x19, 0x03, 0x0B, 0x10, 0x08, 0x00, 0x1E, … … 1149 1149 0x0F, 0x11, 0x05, 0x09, 0x15, 0x16, 0x1F, 0x14 }; 1150 1150 1151 unsigned char table_52[256] = {1151 static const unsigned char table_52[256] = { 1152 1152 0x34, 0x0B, 0x47, 0xA3, 0x56, 0x30, 0x73, 0xD4, 1153 1153 0x4B, 0xF6, 0xA6, 0x80, 0x22, 0x95, 0xA5, 0xBB, … … 1183 1183 0x01, 0x0C, 0x5D, 0x7D, 0xB8, 0xBE, 0x6A, 0x16 }; 1184 1184 1185 unsigned char table_53[256] = {1185 static const unsigned char table_53[256] = { 1186 1186 0xE3, 0xF4, 0x8D, 0x72, 0x45, 0x32, 0x9D, 0xCE, 1187 1187 0x1F, 0x6B, 0xBC, 0xDC, 0xF1, 0xEC, 0x5A, 0x3B, … … 1217 1217 0xAB, 0x64, 0xE0, 0xBE, 0xDA, 0xBD, 0x96, 0x94 }; 1218 1218 1219 unsigned char table_54[32] = {1219 static const unsigned char table_54[32] = { 1220 1220 0x01, 0x02, 0x1D, 0x10, 0x0E, 0x11, 0x08, 0x14, 1221 1221 0x12, 0x09, 0x15, 0x17, 0x16, 0x04, 0x06, 0x1B, … … 1223 1223 0x0C, 0x0B, 0x0D, 0x05, 0x0F, 0x00, 0x19, 0x03 }; 1224 1224 1225 unsigned char table_55[32] = {1225 static const unsigned char table_55[32] = { 1226 1226 0x01, 0x12, 0x13, 0x09, 0x0B, 0x19, 0x03, 0x0E, 1227 1227 0x02, 0x1F, 0x1D, 0x1B, 0x1E, 0x11, 0x06, 0x05, … … 1229 1229 0x18, 0x10, 0x0F, 0x17, 0x1C, 0x0A, 0x04, 0x14 }; 1230 1230 1231 unsigned char table_56[256] = {1231 static const unsigned char table_56[256] = { 1232 1232 0xEF, 0x06, 0x5F, 0x11, 0x4B, 0x60, 0x13, 0xBB, 1233 1233 0x79, 0xD7, 0xE4, 0x6D, 0x22, 0xB4, 0x15, 0x50, … … 1263 1263 0x96, 0xD5, 0xEB, 0x64, 0x8A, 0xC8, 0x7A, 0xBE }; 1264 1264 1265 unsigned char table_57[256] = {1265 static const unsigned char table_57[256] = { 1266 1266 0xD1, 0x9B, 0x15, 0x06, 0xB4, 0xF6, 0x97, 0xF0, 1267 1267 0xC6, 0x5B, 0x88, 0x12, 0x25, 0xFA, 0x7B, 0x79, … … 1297 1297 0x4E, 0x3C, 0x84, 0x14, 0x28, 0x3A, 0xE9, 0xC0 }; 1298 1298 1299 unsigned char table_58[256] = {1299 static const unsigned char table_58[256] = { 1300 1300 0xE9, 0x81, 0x60, 0xA7, 0x18, 0xA0, 0x0F, 0x55, 1301 1301 0x2B, 0x52, 0xE0, 0x8B, 0x9D, 0x85, 0xD2, 0xA3, … … 1331 1331 0x68, 0x1E, 0xF6, 0xA6, 0x6C, 0xB2, 0xD1, 0x58 }; 1332 1332 1333 unsigned char table_59[256] = {1333 static const unsigned char table_59[256] = { 1334 1334 0x4C, 0x85, 0x2B, 0x14, 0xCC, 0x4D, 0x5F, 0xD7, 1335 1335 0xCE, 0x28, 0xC5, 0x0B, 0xA1, 0x99, 0x08, 0xDE, … … 1365 1365 0x5D, 0x1A, 0x8D, 0xC1, 0x58, 0x48, 0xAD, 0x0F }; 1366 1366 1367 unsigned char table_60[32] = {1367 static const unsigned char table_60[32] = { 1368 1368 0x1C, 0x06, 0x1E, 0x10, 0x1D, 0x05, 0x00, 0x0E, 1369 1369 0x0C, 0x02, 0x11, 0x19, 0x15, 0x18, 0x16, 0x07, … … 1371 1371 0x03, 0x08, 0x12, 0x04, 0x1B, 0x0A, 0x17, 0x1A }; 1372 1372 1373 unsigned char table_61[256] = {1373 static const unsigned char table_61[256] = { 1374 1374 0xC5, 0xA6, 0xF2, 0x6B, 0x4B, 0x58, 0xE0, 0x41, 1375 1375 0xC6, 0x2F, 0x13, 0xFE, 0xC1, 0x34, 0x3F, 0x24, … … 1405 1405 0xCF, 0x60, 0xAA, 0xA4, 0xEB, 0xC4, 0x4E, 0xC2 }; 1406 1406 1407 unsigned char table_62[256] = {1407 static const unsigned char table_62[256] = { 1408 1408 0x01, 0x59, 0xEC, 0xFC, 0x51, 0xD2, 0xE4, 0x9D, 1409 1409 0xAA, 0x61, 0xD5, 0xCA, 0x63, 0x5D, 0xCE, 0x36, … … 1439 1439 0xCF, 0xE9, 0xDB, 0xD3, 0x02, 0x9A, 0x0E, 0x5F }; 1440 1440 1441 unsigned char table_63[256] = {1441 static const unsigned char table_63[256] = { 1442 1442 0x0C, 0x02, 0xEE, 0x94, 0x2D, 0x76, 0x96, 0x75, 1443 1443 0x21, 0xDC, 0x37, 0x03, 0xC0, 0xF7, 0xDF, 0xEF, … … 1473 1473 0x8C, 0xE2, 0x83, 0xA7, 0xD6, 0x0E, 0xB3, 0xDD }; 1474 1474 1475 unsigned char table_64[32] = {1475 static const unsigned char table_64[32] = { 1476 1476 0x03, 0x05, 0x0D, 0x09, 0x1A, 0x16, 0x08, 0x10, 1477 1477 0x06, 0x1E, 0x1C, 0x15, 0x02, 0x04, 0x17, 0x0C, … … 1479 1479 0x0E, 0x00, 0x1D, 0x1F, 0x01, 0x0F, 0x07, 0x12 }; 1480 1480 1481 unsigned char table_65[32] = {1481 static const unsigned char table_65[32] = { 1482 1482 0x01, 0x0A, 0x1E, 0x14, 0x10, 0x1D, 0x0D, 0x17, 1483 1483 0x0E, 0x0C, 0x0F, 0x12, 0x04, 0x1A, 0x05, 0x02, … … 1485 1485 0x11, 0x00, 0x16, 0x06, 0x03, 0x18, 0x15, 0x07 }; 1486 1486 1487 unsigned char table_66[32] = {1487 static const unsigned char table_66[32] = { 1488 1488 0x1C, 0x18, 0x0C, 0x09, 0x05, 0x03, 0x15, 0x12, 1489 1489 0x0D, 0x02, 0x08, 0x0E, 0x19, 0x07, 0x13, 0x17, … … 1491 1491 0x0F, 0x10, 0x01, 0x1B, 0x00, 0x04, 0x1A, 0x16 }; 1492 1492 1493 unsigned char table_67[256] = {1493 static const unsigned char table_67[256] = { 1494 1494 0x6B, 0x49, 0xC8, 0x86, 0xFF, 0xC0, 0x5D, 0xEF, 1495 1495 0xF7, 0x06, 0xE0, 0x98, 0xA9, 0x72, 0x71, 0xD5, … … 1525 1525 0x24, 0x43, 0x21, 0x83, 0xFB, 0xFD, 0x8B, 0x96 }; 1526 1526 1527 unsigned char table_68[256] = {1527 static const unsigned char table_68[256] = { 1528 1528 0x93, 0xFF, 0x83, 0x70, 0x12, 0x2D, 0x1C, 0xD6, 1529 1529 0xF9, 0xEE, 0xCF, 0x94, 0x7B, 0xB5, 0xA4, 0x84, … … 1559 1559 0x8C, 0x6D, 0x91, 0x63, 0x3A, 0x4D, 0xC1, 0x01 }; 1560 1560 1561 unsigned char table_69[256] = {1561 static const unsigned char table_69[256] = { 1562 1562 0x21, 0x6B, 0x9B, 0xAE, 0x11, 0x5A, 0x91, 0xC2, 1563 1563 0x47, 0x8E, 0x87, 0x86, 0x4F, 0xFC, 0x8F, 0x66, … … 1593 1593 0x73, 0xDB, 0xB6, 0x83, 0xCE, 0x1E, 0xC1, 0x3C }; 1594 1594 1595 unsigned char table_70[256] = {1595 static const unsigned char table_70[256] = { 1596 1596 0x54, 0x23, 0xF1, 0x09, 0x9D, 0xEB, 0x26, 0xD9, 1597 1597 0x6C, 0xC1, 0xBC, 0x3D, 0x6E, 0xB0, 0x5F, 0xE2, … … 1627 1627 0x49, 0x84, 0x38, 0xC7, 0xE3, 0xD4, 0x1A, 0xBF }; 1628 1628 1629 unsigned char table_71[32] = {1629 static const unsigned char table_71[32] = { 1630 1630 0x17, 0x13, 0x0E, 0x1A, 0x0D, 0x18, 0x19, 0x10, 1631 1631 0x14, 0x11, 0x16, 0x05, 0x04, 0x00, 0x12, 0x0A, … … 1633 1633 0x0C, 0x06, 0x1B, 0x08, 0x1D, 0x01, 0x15, 0x1E }; 1634 1634 1635 unsigned char table_72[256] = {1635 static const unsigned char table_72[256] = { 1636 1636 0xC9, 0xA7, 0x1B, 0xEC, 0x2B, 0x8B, 0xB0, 0xEB, 1637 1637 0x7F, 0x39, 0x25, 0xD9, 0x1D, 0xD5, 0x67, 0xA0, … … 1667 1667 0x08, 0x53, 0xF2, 0xB9, 0x5A, 0x3E, 0xE9, 0xD2 }; 1668 1668 1669 unsigned char table_73[256] = {1669 static const unsigned char table_73[256] = { 1670 1670 0x36, 0x37, 0xED, 0xD8, 0xBF, 0xD7, 0x12, 0xB7, 1671 1671 0x40, 0x32, 0x19, 0x4A, 0x44, 0x2A, 0xCE, 0xA5, … … 1701 1701 0xFF, 0x90, 0x6B, 0xBC, 0x54, 0x95, 0xBD, 0x07 }; 1702 1702 1703 unsigned char table_74[256] = {1703 static const unsigned char table_74[256] = { 1704 1704 0xA7, 0xCF, 0x99, 0x1A, 0x13, 0xC7, 0xE9, 0xC4, 1705 1705 0xB6, 0x0E, 0x15, 0x09, 0xFF, 0xDF, 0xBE, 0x03, … … 1735 1735 0x2F, 0xD8, 0xC3, 0x7C, 0x9C, 0x98, 0xEA, 0x71 }; 1736 1736 1737 unsigned char table_75[256] = {1737 static const unsigned char table_75[256] = { 1738 1738 0xE7, 0xA5, 0x30, 0xE1, 0x9D, 0x81, 0xBE, 0x83, 1739 1739 0xB2, 0x1E, 0xE4, 0x69, 0x2F, 0x2B, 0x0D, 0xEB, … … 1769 1769 0x89, 0x46, 0x78, 0xDC, 0x32, 0x8B, 0x67, 0x36 }; 1770 1770 1771 unsigned char table_76[256] = {1771 static const unsigned char table_76[256] = { 1772 1772 0x3D, 0x66, 0x40, 0xC5, 0x1D, 0xF5, 0xE7, 0xB7, 1773 1773 0x2C, 0x23, 0x09, 0xC2, 0x68, 0xE6, 0xD3, 0x8D, … … 1803 1803 0xD1, 0x95, 0xC3, 0xA0, 0x0F, 0xCA, 0xAC, 0xFC }; 1804 1804 1805 unsigned char table_77[32] = {1805 static const unsigned char table_77[32] = { 1806 1806 0x1C, 0x0D, 0x1E, 0x01, 0x06, 0x16, 0x18, 0x17, 1807 1807 0x0B, 0x1F, 0x04, 0x0F, 0x00, 0x19, 0x08, 0x0A, … … 1809 1809 0x1A, 0x12, 0x13, 0x0E, 0x1D, 0x10, 0x02, 0x1B }; 1810 1810 1811 unsigned char table_78[32] = {1811 static const unsigned char table_78[32] = { 1812 1812 0x0E, 0x02, 0x17, 0x12, 0x1E, 0x09, 0x15, 0x03, 1813 1813 0x01, 0x0B, 0x0F, 0x11, 0x10, 0x0A, 0x16, 0x06, … … 1815 1815 0x13, 0x0D, 0x1B, 0x08, 0x19, 0x14, 0x05, 0x1A }; 1816 1816 1817 unsigned char table_79[32] = {1817 static const unsigned char table_79[32] = { 1818 1818 0x12, 0x0B, 0x11, 0x01, 0x07, 0x0E, 0x1A, 0x0D, 1819 1819 0x1E, 0x18, 0x14, 0x1F, 0x0A, 0x17, 0x19, 0x1B, … … 1821 1821 0x09, 0x06, 0x04, 0x16, 0x15, 0x1C, 0x05, 0x03 }; 1822 1822 1823 unsigned char table_80[256] = {1823 static const unsigned char table_80[256] = { 1824 1824 0x14, 0xE7, 0x31, 0x0F, 0xD1, 0x5F, 0xED, 0x1E, 1825 1825 0xA6, 0x77, 0x20, 0x57, 0x34, 0x64, 0x33, 0x0B, … … 1855 1855 0x39, 0xB9, 0xC0, 0x22, 0xF1, 0x4D, 0x90, 0xFC }; 1856 1856 1857 unsigned char table_81[32] = {1857 static const unsigned char table_81[32] = { 1858 1858 0x03, 0x02, 0x1D, 0x0E, 0x09, 0x1A, 0x0C, 0x11, 1859 1859 0x1C, 0x0D, 0x08, 0x12, 0x19, 0x10, 0x04, 0x17, … … 1861 1861 0x1E, 0x0B, 0x0F, 0x01, 0x07, 0x14, 0x1F, 0x06 }; 1862 1862 1863 unsigned char table_82[256] = {1863 static const unsigned char table_82[256] = { 1864 1864 0x53, 0xD3, 0x64, 0x89, 0x7D, 0xA5, 0x66, 0xA4, 1865 1865 0x09, 0x46, 0x17, 0x2C, 0xAF, 0x8C, 0x21, 0x5F, … … 1895 1895 0x6A, 0x78, 0xB5, 0x71, 0x56, 0x87, 0x7F, 0x86 }; 1896 1896 1897 unsigned char table_83[32] = {1897 static const unsigned char table_83[32] = { 1898 1898 0x1B, 0x0A, 0x1F, 0x01, 0x10, 0x08, 0x0E, 0x18, 1899 1899 0x06, 0x04, 0x00, 0x1C, 0x0C, 0x19, 0x0D, 0x16, … … 1901 1901 0x17, 0x1E, 0x1A, 0x1D, 0x0B, 0x11, 0x14, 0x15 }; 1902 1902 1903 unsigned char table_84[32] = {1903 static const unsigned char table_84[32] = { 1904 1904 0x02, 0x1A, 0x0D, 0x15, 0x01, 0x16, 0x1E, 0x00, 1905 1905 0x08, 0x1B, 0x04, 0x10, 0x1C, 0x18, 0x19, 0x14, … … 1907 1907 0x1D, 0x17, 0x13, 0x06, 0x0F, 0x05, 0x09, 0x1F }; 1908 1908 1909 unsigned char table_85[256] = {1909 static const unsigned char table_85[256] = { 1910 1910 0xC6, 0x7C, 0xCE, 0xBD, 0x84, 0x3E, 0x0B, 0xD8, 1911 1911 0xFE, 0xCC, 0x46, 0x50, 0xD1, 0xFB, 0xA0, 0x6D, … … 1941 1941 0x2D, 0x57, 0xE7, 0x82, 0x1E, 0x37, 0x63, 0x43 }; 1942 1942 1943 unsigned char table_86[32] = {1943 static const unsigned char table_86[32] = { 1944 1944 0x11, 0x07, 0x0F, 0x0A, 0x19, 0x1D, 0x0B, 0x09, 1945 1945 0x1C, 0x1E, 0x14, 0x06, 0x0C, 0x16, 0x13, 0x04, … … 1947 1947 0x10, 0x1A, 0x1F, 0x01, 0x17, 0x0E, 0x03, 0x1B }; 1948 1948 1949 unsigned char table_87[32] = {1949 static const unsigned char table_87[32] = { 1950 1950 0x17, 0x0E, 0x1D, 0x13, 0x0B, 0x19, 0x03, 0x06, 1951 1951 0x09, 0x01, 0x0D, 0x15, 0x1C, 0x16, 0x18, 0x1B, … … 1953 1953 0x02, 0x04, 0x07, 0x1A, 0x14, 0x0A, 0x0C, 0x05 }; 1954 1954 1955 unsigned char table_88[32] = {1955 static const unsigned char table_88[32] = { 1956 1956 0x09, 0x08, 0x17, 0x10, 0x0A, 0x07, 0x1C, 0x1F, 1957 1957 0x04, 0x0E, 0x01, 0x0C, 0x0D, 0x1B, 0x03, 0x15, … … 1959 1959 0x05, 0x11, 0x14, 0x00, 0x16, 0x1D, 0x12, 0x13 }; 1960 1960 1961 unsigned char table_89[32] = {1961 static const unsigned char table_89[32] = { 1962 1962 0x15, 0x1C, 0x1D, 0x14, 0x0F, 0x1A, 0x05, 0x02, 1963 1963 0x07, 0x09, 0x06, 0x08, 0x1F, 0x00, 0x10, 0x13, … … 1965 1965 0x12, 0x04, 0x11, 0x0A, 0x01, 0x0B, 0x17, 0x19 }; 1966 1966 1967 unsigned char table_90[256] = {1967 static const unsigned char table_90[256] = { 1968 1968 0x62, 0x36, 0x64, 0x0E, 0x4C, 0x6C, 0xBE, 0xCF, 1969 1969 0x25, 0x5A, 0x3D, 0x12, 0x54, 0x9F, 0xE7, 0xA5, … … 1999 1999 0x20, 0x94, 0x45, 0xED, 0xDC, 0xBD, 0x7E, 0x50 }; 2000 2000 2001 unsigned char table_91[32] = {2001 static const unsigned char table_91[32] = { 2002 2002 0x03, 0x04, 0x0C, 0x18, 0x10, 0x0D, 0x13, 0x1B, 2003 2003 0x1F, 0x07, 0x11, 0x17, 0x1C, 0x1D, 0x05, 0x06, … … 2005 2005 0x14, 0x16, 0x00, 0x15, 0x19, 0x09, 0x0F, 0x1E }; 2006 2006 2007 unsigned char table_92[32] = {2007 static const unsigned char table_92[32] = { 2008 2008 0x1E, 0x10, 0x01, 0x07, 0x11, 0x16, 0x15, 0x17, 2009 2009 0x1F, 0x14, 0x0C, 0x1C, 0x06, 0x03, 0x00, 0x18, … … 2011 2011 0x0F, 0x12, 0x0B, 0x13, 0x0A, 0x04, 0x1D, 0x1A }; 2012 2012 2013 unsigned char table_93[256] = {2013 static const unsigned char table_93[256] = { 2014 2014 0x76, 0x78, 0xA2, 0x94, 0x0E, 0x7F, 0xDF, 0xC1, 2015 2015 0xB9, 0xE1, 0x3D, 0x59, 0x6F, 0x1E, 0x53, 0x99, … … 2045 2045 0x24, 0x34, 0xE2, 0xEC, 0x85, 0x47, 0xF4, 0xB2 }; 2046 2046 2047 unsigned char table_94[32] = {2047 static const unsigned char table_94[32] = { 2048 2048 0x1C, 0x07, 0x05, 0x1A, 0x10, 0x1D, 0x14, 0x12, 2049 2049 0x08, 0x0F, 0x0C, 0x01, 0x04, 0x1B, 0x16, 0x0A, … … 2051 2051 0x0E, 0x09, 0x15, 0x19, 0x03, 0x18, 0x00, 0x0B }; 2052 2052 2053 unsigned char table_95[32] = {2053 static const unsigned char table_95[32] = { 2054 2054 0x12, 0x10, 0x11, 0x15, 0x03, 0x0A, 0x14, 0x05, 2055 2055 0x1D, 0x07, 0x17, 0x0D, 0x09, 0x08, 0x1B, 0x1F, … … 2057 2057 0x1E, 0x1C, 0x01, 0x0C, 0x1A, 0x0F, 0x13, 0x16 }; 2058 2058 2059 unsigned char table_96[256] = {2059 static const unsigned char table_96[256] = { 2060 2060 0x1C, 0x6E, 0xCD, 0xB4, 0xB3, 0x93, 0xA8, 0x2E, 2061 2061 0x4F, 0x09, 0xE3, 0x72, 0x64, 0x13, 0x21, 0xF5, … … 2091 2091 0x59, 0xCE, 0xE1, 0x57, 0x20, 0x58, 0x51, 0xD8 }; 2092 2092 2093 unsigned char table_97[256] = {2093 static const unsigned char table_97[256] = { 2094 2094 0x15, 0x2D, 0xAF, 0x36, 0xCF, 0xD3, 0xD0, 0xED, 2095 2095 0xB2, 0x1B, 0xFE, 0x92, 0xBD, 0xAD, 0x58, 0x0F, … … 2125 2125 0x83, 0x25, 0x9F, 0xD9, 0x99, 0xC1, 0xFD, 0xB3 }; 2126 2126 2127 unsigned char table_98[256] = {2127 static const unsigned char table_98[256] = { 2128 2128 0xC8, 0xE6, 0x38, 0x93, 0xE5, 0x03, 0x18, 0x1F, 2129 2129 0xE9, 0x5A, 0xB6, 0xAF, 0xC3, 0x95, 0x00, 0x51, … … 2159 2159 0x54, 0x3A, 0x13, 0x09, 0x2C, 0xB5, 0xC7, 0x63 }; 2160 2160 2161 unsigned char table_99[32] = {2161 static const unsigned char table_99[32] = { 2162 2162 0x19, 0x00, 0x10, 0x18, 0x09, 0x11, 0x13, 0x1D, 2163 2163 0x08, 0x1A, 0x02, 0x05, 0x03, 0x17, 0x12, 0x01, … … 2165 2165 0x0E, 0x16, 0x1E, 0x04, 0x1B, 0x0A, 0x0C, 0x1C }; 2166 2166 2167 unsigned char table_100[256] = {2167 static const unsigned char table_100[256] = { 2168 2168 0x9B, 0x3A, 0xAE, 0x60, 0x27, 0x67, 0x1E, 0x4E, 2169 2169 0x91, 0xDA, 0x85, 0x43, 0x5C, 0xCC, 0x89, 0x55, … … 2199 2199 0x30, 0x0C, 0xB2, 0x7B, 0xBE, 0xFB, 0x23, 0x2C }; 2200 2200 2201 unsigned char table_101[32] = {2201 static const unsigned char table_101[32] = { 2202 2202 0x18, 0x08, 0x14, 0x17, 0x03, 0x10, 0x19, 0x04, 2203 2203 0x0D, 0x1C, 0x06, 0x1D, 0x1E, 0x12, 0x11, 0x0B, … … 2205 2205 0x15, 0x0A, 0x0C, 0x1A, 0x00, 0x01, 0x1F, 0x09 }; 2206 2206 2207 unsigned char table_102[32] = {2207 static const unsigned char table_102[32] = { 2208 2208 0x17, 0x1F, 0x0E, 0x05, 0x13, 0x0C, 0x14, 0x1A, 2209 2209 0x0F, 0x01, 0x12, 0x1C, 0x00, 0x07, 0x0D, 0x02, … … 2211 2211 0x06, 0x15, 0x0A, 0x19, 0x09, 0x08, 0x1B, 0x0B }; 2212 2212 2213 unsigned char table_103[32] = {2213 static const unsigned char table_103[32] = { 2214 2214 0x0F, 0x09, 0x1E, 0x11, 0x0D, 0x08, 0x10, 0x00, 2215 2215 0x01, 0x1F, 0x1D, 0x1C, 0x12, 0x04, 0x07, 0x05, … … 2217 2217 0x18, 0x0B, 0x0A, 0x13, 0x0C, 0x0E, 0x03, 0x06 }; 2218 2218 2219 unsigned char table_104[256] = {2219 static const unsigned char table_104[256] = { 2220 2220 0xA4, 0x9F, 0x78, 0x39, 0x3D, 0x81, 0x51, 0x24, 2221 2221 0x46, 0x2A, 0x56, 0xE8, 0xDF, 0x73, 0xA8, 0xA2, … … 2251 2251 0x97, 0xBB, 0x37, 0x8C, 0x54, 0x53, 0x9E, 0x8F }; 2252 2252 2253 unsigned char table_105[256] = {2253 static const unsigned char table_105[256] = { 2254 2254 0x7B, 0x35, 0x11, 0x79, 0x07, 0x2F, 0xF6, 0x82, 2255 2255 0x8E, 0xB4, 0x6E, 0xD2, 0x6D, 0xC5, 0x8C, 0x1C, … … 2285 2285 0xBA, 0x1E, 0x44, 0x87, 0x45, 0x9F, 0xC9, 0x94 }; 2286 2286 2287 unsigned char table_106[32] = {2287 static const unsigned char table_106[32] = { 2288 2288 0x03, 0x11, 0x07, 0x1B, 0x0F, 0x14, 0x0C, 0x01, 2289 2289 0x04, 0x02, 0x09, 0x0A, 0x05, 0x12, 0x06, 0x1F, … … 2291 2291 0x1E, 0x1D, 0x17, 0x19, 0x13, 0x16, 0x0B, 0x1A }; 2292 2292 2293 unsigned char table_107[32] = {2293 static const unsigned char table_107[32] = { 2294 2294 0x13, 0x1B, 0x06, 0x11, 0x1C, 0x07, 0x08, 0x0E, 2295 2295 0x10, 0x05, 0x09, 0x18, 0x04, 0x15, 0x1E, 0x0F, … … 2297 2297 0x03, 0x0C, 0x0A, 0x1D, 0x14, 0x01, 0x16, 0x0B }; 2298 2298 2299 unsigned char table_108[256] = {2299 static const unsigned char table_108[256] = { 2300 2300 0x99, 0xA3, 0x48, 0xE8, 0x5A, 0x7D, 0x97, 0xCA, 2301 2301 0x7F, 0x06, 0x9B, 0x04, 0xE0, 0xF3, 0x18, 0xAE, … … 2331 2331 0xCC, 0xE2, 0x44, 0x73, 0xBE, 0x26, 0x8C, 0x5B }; 2332 2332 2333 unsigned char table_109[256] = {2333 static const unsigned char table_109[256] = { 2334 2334 0xE3, 0x95, 0xDB, 0x09, 0x82, 0x0A, 0x8F, 0x9E, 2335 2335 0xC9, 0xDC, 0x28, 0x35, 0x0F, 0x8B, 0xA8, 0xA5, … … 2365 2365 0x1E, 0xF4, 0xD5, 0xB1, 0x5C, 0x25, 0xE8, 0x1C }; 2366 2366 2367 unsigned char table_110[256] = {2367 static const unsigned char table_110[256] = { 2368 2368 0xC3, 0x06, 0x3C, 0xCB, 0xD2, 0x44, 0x9D, 0x48, 2369 2369 0x28, 0xAA, 0xA9, 0xD0, 0x64, 0x25, 0x56, 0xCA, … … 2399 2399 0x4B, 0xCF, 0xB4, 0x2F, 0xBB, 0xEF, 0xDB, 0x33 }; 2400 2400 2401 unsigned char table_111[32] = {2401 static const unsigned char table_111[32] = { 2402 2402 0x09, 0x0F, 0x00, 0x15, 0x12, 0x17, 0x1A, 0x0D, 2403 2403 0x1C, 0x0B, 0x01, 0x0A, 0x05, 0x1E, 0x1D, 0x0C, … … 2405 2405 0x10, 0x16, 0x11, 0x1F, 0x04, 0x06, 0x02, 0x13 }; 2406 2406 2407 unsigned char table_112[256] = {2407 static const unsigned char table_112[256] = { 2408 2408 0xF9, 0x7D, 0xBE, 0xD5, 0x9F, 0xB8, 0x95, 0x43, 2409 2409 0xDB, 0xAE, 0x7E, 0xEC, 0x5B, 0x58, 0x18, 0x49, … … 2439 2439 0xA1, 0xCC, 0xDF, 0x60, 0xD8, 0x5A, 0xE6, 0xD4 }; 2440 2440 2441 unsigned char table_113[256] = {2441 static const unsigned char table_113[256] = { 2442 2442 0x46, 0x9D, 0x39, 0xB2, 0x8D, 0x3B, 0x59, 0x5A, 2443 2443 0xD0, 0x9C, 0xE4, 0x04, 0x01, 0xE2, 0xB3, 0xD2, … … 2473 2473 0xFE, 0x7B, 0x67, 0xFF, 0x10, 0xEC, 0xC6, 0x86 }; 2474 2474 2475 unsigned char table_114[32] = {2475 static const unsigned char table_114[32] = { 2476 2476 0x11, 0x10, 0x04, 0x1D, 0x08, 0x15, 0x1A, 0x1B, 2477 2477 0x14, 0x18, 0x0F, 0x17, 0x16, 0x07, 0x1E, 0x0E, … … 2479 2479 0x1F, 0x19, 0x09, 0x1C, 0x01, 0x0D, 0x03, 0x05 }; 2480 2480 2481 unsigned char table_115[256] = {2481 static const unsigned char table_115[256] = { 2482 2482 0xB7, 0xBB, 0x63, 0x0D, 0xF0, 0x33, 0x5A, 0x05, 2483 2483 0xF2, 0x7F, 0x64, 0xDB, 0x51, 0xC9, 0x2C, 0x85, … … 2513 2513 0x8C, 0x17, 0xB5, 0xEB, 0xD5, 0xF3, 0x0B, 0x3C }; 2514 2514 2515 unsigned char table_116[32] = {2515 static const unsigned char table_116[32] = { 2516 2516 0x00, 0x05, 0x10, 0x1C, 0x0C, 0x1A, 0x04, 0x1B, 2517 2517 0x0A, 0x0D, 0x14, 0x0B, 0x07, 0x03, 0x12, 0x1E, … … 2519 2519 0x19, 0x18, 0x16, 0x02, 0x13, 0x0E, 0x17, 0x1D }; 2520 2520 2521 unsigned char table_117[256] = {2521 static const unsigned char table_117[256] = { 2522 2522 0xD0, 0x9A, 0xAB, 0xA8, 0xA7, 0xDF, 0x28, 0xCE, 2523 2523 0x3E, 0x51, 0xBF, 0x76, 0x03, 0xA0, 0x53, 0x3F, … … 2553 2553 0xC1, 0xFD, 0x92, 0xA1, 0xF7, 0xAE, 0xDC, 0x58 }; 2554 2554 2555 unsigned char table_118[256] = {2555 static const unsigned char table_118[256] = { 2556 2556 0x38, 0xA0, 0xA6, 0xFC, 0x7C, 0x5A, 0x97, 0x1D, 2557 2557 0xFD, 0x00, 0x20, 0xA2, 0x72, 0x10, 0x1F, 0x48, … … 2587 2587 0xD9, 0x2F, 0x02, 0xAC, 0x30, 0x6A, 0xD6, 0x95 }; 2588 2588 2589 unsigned char table_119[32] = {2589 static const unsigned char table_119[32] = { 2590 2590 0x14, 0x0A, 0x1C, 0x00, 0x0C, 0x1F, 0x1E, 0x0B, 2591 2591 0x12, 0x1D, 0x17, 0x08, 0x07, 0x04, 0x09, 0x10, … … 2593 2593 0x18, 0x02, 0x06, 0x01, 0x19, 0x16, 0x13, 0x0F }; 2594 2594 2595 unsigned char table_120[256] = {2595 static const unsigned char table_120[256] = { 2596 2596 0xCE, 0x89, 0xB2, 0x72, 0x04, 0x77, 0x64, 0xAE, 2597 2597 0x80, 0x99, 0xB5, 0x00, 0x7B, 0x50, 0x9D, 0xE3, … … 2627 2627 0x5E, 0xCA, 0xFD, 0x11, 0xA3, 0xC7, 0xC0, 0x91 }; 2628 2628 2629 unsigned char table_121[32] = {2629 static const unsigned char table_121[32] = { 2630 2630 0x1E, 0x12, 0x06, 0x1D, 0x15, 0x1F, 0x13, 0x0B, 2631 2631 0x10, 0x0D, 0x1C, 0x01, 0x0A, 0x0E, 0x02, 0x19, … … 2633 2633 0x14, 0x08, 0x18, 0x05, 0x09, 0x0F, 0x1B, 0x07 }; 2634 2634 2635 unsigned char table_122[256] = {2635 static const unsigned char table_122[256] = { 2636 2636 0x85, 0xDF, 0x7F, 0x7C, 0x56, 0xF0, 0x0C, 0x7D, 2637 2637 0x76, 0xA8, 0x58, 0x31, 0x25, 0x8A, 0x0D, 0x23, … … 2667 2667 0xCE, 0x2D, 0x4E, 0x83, 0xC3, 0x69, 0xEE, 0xB2 }; 2668 2668 2669 unsigned char table_123[256] = {2669 static const unsigned char table_123[256] = { 2670 2670 0x9D, 0xFB, 0x3C, 0x81, 0xAA, 0x05, 0xB2, 0xBE, 2671 2671 0xD1, 0x5F, 0x4C, 0xE0, 0xA3, 0xF4, 0xDE, 0x35, … … 2701 2701 0x48, 0x77, 0xD0, 0x0A, 0x8A, 0x3A, 0x43, 0x79 }; 2702 2702 2703 unsigned char table_124[256] = {2703 static const unsigned char table_124[256] = { 2704 2704 0x6C, 0xC3, 0x28, 0x2F, 0x42, 0x4B, 0x7C, 0x3C, 2705 2705 0xCE, 0x24, 0xC8, 0x51, 0x25, 0x3F, 0x49, 0x8D, … … 2735 2735 0x62, 0x1B, 0xDE, 0x91, 0x87, 0x97, 0x05, 0x2E }; 2736 2736 2737 unsigned char table_125[32] = {2737 static const unsigned char table_125[32] = { 2738 2738 0x1A, 0x18, 0x12, 0x15, 0x00, 0x1C, 0x01, 0x0B, 2739 2739 0x19, 0x1B, 0x1F, 0x11, 0x07, 0x10, 0x1E, 0x06, … … 2741 2741 0x02, 0x03, 0x13, 0x14, 0x09, 0x1D, 0x05, 0x0F }; 2742 2742 2743 unsigned char table_126[32] = {2743 static const unsigned char table_126[32] = { 2744 2744 0x1C, 0x1D, 0x07, 0x12, 0x18, 0x1A, 0x19, 0x09, 2745 2745 0x0F, 0x14, 0x1F, 0x0B, 0x13, 0x04, 0x0E, 0x1E, … … 2747 2747 0x15, 0x10, 0x11, 0x08, 0x00, 0x03, 0x06, 0x02 }; 2748 2748 2749 unsigned char table_127[256] = {2749 static const unsigned char table_127[256] = { 2750 2750 0xA0, 0x66, 0xD8, 0x08, 0xEA, 0x39, 0x78, 0xAB, 2751 2751 0x61, 0x4E, 0xC7, 0xD1, 0xA3, 0x1C, 0x9F, 0xCB, … … 2781 2781 0x70, 0xF8, 0x17, 0xCD, 0xB0, 0xCC, 0x82, 0x2D }; 2782 2782 2783 unsigned char table_128[32] = {2783 static const unsigned char table_128[32] = { 2784 2784 0x1A, 0x1C, 0x09, 0x17, 0x1B, 0x0B, 0x16, 0x1E, 2785 2785 0x14, 0x0C, 0x12, 0x0E, 0x05, 0x03, 0x1F, 0x15, … … 2787 2787 0x02, 0x08, 0x0F, 0x18, 0x07, 0x04, 0x1D, 0x06 }; 2788 2788 2789 unsigned char table_129[256] = {2789 static const unsigned char table_129[256] = { 2790 2790 0x9D, 0x5F, 0xE8, 0x99, 0x57, 0x07, 0x16, 0xA6, 2791 2791 0x9F, 0xB6, 0xDE, 0xED, 0x2D, 0xB3, 0xC0, 0x8E, … … 2821 2821 0x09, 0x45, 0x6B, 0xD7, 0x0B, 0x89, 0x4F, 0x2A }; 2822 2822 2823 unsigned char table_130[32] = {2823 static const unsigned char table_130[32] = { 2824 2824 0x07, 0x03, 0x15, 0x0B, 0x02, 0x11, 0x17, 0x14, 2825 2825 0x05, 0x10, 0x0A, 0x0F, 0x01, 0x1C, 0x1D, 0x0E, … … 2827 2827 0x1B, 0x00, 0x08, 0x0D, 0x0C, 0x1E, 0x04, 0x1F }; 2828 2828 2829 unsigned char table_131[32] = {2829 static const unsigned char table_131[32] = { 2830 2830 0x1D, 0x13, 0x1B, 0x10, 0x07, 0x03, 0x0A, 0x02, 2831 2831 0x00, 0x0C, 0x0E, 0x0B, 0x0D, 0x18, 0x12, 0x1F, … … 2833 2833 0x19, 0x05, 0x0F, 0x17, 0x06, 0x01, 0x09, 0x16 }; 2834 2834 2835 unsigned char table_132[256] = {2835 static const unsigned char table_132[256] = { 2836 2836 0x33, 0x8D, 0x45, 0x6F, 0xFF, 0xF5, 0xB6, 0x53, 2837 2837 0x3B, 0xF3, 0x07, 0xA4, 0x97, 0xEB, 0x6B, 0xA5, … … 2867 2867 0xC4, 0x7F, 0xA0, 0xD8, 0xEF, 0x03, 0x70, 0xF6 }; 2868 2868 2869 unsigned char table_133[256] = {2869 static const unsigned char table_133[256] = { 2870 2870 0x02, 0xF0, 0xED, 0xC4, 0xE4, 0x67, 0x60, 0x8B, 2871 2871 0xF3, 0x77, 0x92, 0xE0, 0x85, 0x93, 0x1E, 0x8E, … … 2901 2901 0x5A, 0x35, 0xB0, 0xAE, 0x82, 0x79, 0x1D, 0x52 }; 2902 2902 2903 unsigned char table_134[32] = {2903 static const unsigned char table_134[32] = { 2904 2904 0x09, 0x0F, 0x10, 0x0C, 0x03, 0x15, 0x07, 0x17, 2905 2905 0x0E, 0x0B, 0x1D, 0x08, 0x19, 0x11, 0x00, 0x0A, … … 2907 2907 0x02, 0x1B, 0x1A, 0x04, 0x05, 0x1F, 0x1C, 0x1E }; 2908 2908 2909 unsigned char table_135[256] = {2909 static const unsigned char table_135[256] = { 2910 2910 0x14, 0x34, 0xEA, 0x02, 0x2B, 0x5A, 0x10, 0x51, 2911 2911 0xF3, 0x8F, 0x28, 0xB2, 0x50, 0x8B, 0x01, 0xCC, … … 2941 2941 0x00, 0x63, 0xD9, 0xBE, 0xF2, 0x60, 0x25, 0x62 }; 2942 2942 2943 unsigned char table_136[256] = {2943 static const unsigned char table_136[256] = { 2944 2944 0xD3, 0x1A, 0x00, 0xED, 0x59, 0x24, 0xA3, 0xF2, 2945 2945 0xBA, 0x58, 0x4C, 0x5C, 0x75, 0x48, 0x98, 0xB0, … … 2975 2975 0x93, 0x1D, 0x9B, 0x5B, 0x40, 0xEE, 0x42, 0x19 }; 2976 2976 2977 unsigned char table_137[32] = {2977 static const unsigned char table_137[32] = { 2978 2978 0x0F, 0x09, 0x02, 0x06, 0x18, 0x0B, 0x1E, 0x05, 2979 2979 0x11, 0x1D, 0x16, 0x01, 0x13, 0x10, 0x0E, 0x1A, … … 2981 2981 0x03, 0x1F, 0x0A, 0x12, 0x0C, 0x07, 0x04, 0x1C }; 2982 2982 2983 unsigned char table_138[32] = {2983 static const unsigned char table_138[32] = { 2984 2984 0x0D, 0x1C, 0x1F, 0x15, 0x0F, 0x14, 0x1B, 0x12, 2985 2985 0x09, 0x0B, 0x19, 0x07, 0x11, 0x16, 0x0C, 0x04, … … 2987 2987 0x01, 0x06, 0x18, 0x17, 0x10, 0x1A, 0x02, 0x00 }; 2988 2988 2989 unsigned char table_139[32] = {2989 static const unsigned char table_139[32] = { 2990 2990 0x05, 0x15, 0x1D, 0x02, 0x0F, 0x03, 0x17, 0x1A, 2991 2991 0x0A, 0x00, 0x1F, 0x12, 0x0E, 0x11, 0x1B, 0x13, … … 2993 2993 0x0C, 0x04, 0x16, 0x19, 0x1C, 0x06, 0x10, 0x01 }; 2994 2994 2995 unsigned char table_140[32] = {2995 static const unsigned char table_140[32] = { 2996 2996 0x06, 0x1E, 0x0C, 0x11, 0x13, 0x08, 0x15, 0x01, 2997 2997 0x1D, 0x03, 0x0F, 0x19, 0x18, 0x04, 0x00, 0x14, … … 2999 2999 0x1F, 0x17, 0x09, 0x0A, 0x0D, 0x16, 0x10, 0x1C }; 3000 3000 3001 unsigned char table_141[256] = {3001 static const unsigned char table_141[256] = { 3002 3002 0xE1, 0x0A, 0x28, 0xCD, 0x8A, 0x1E, 0x26, 0x10, 3003 3003 0xC0, 0x6F, 0x06, 0x2C, 0xF8, 0x51, 0x6C, 0x8F, … … 3033 3033 0x98, 0x54, 0xB8, 0xDC, 0x46, 0xDF, 0x87, 0xE5 }; 3034 3034 3035 unsigned char table_142[256] = {3035 static const unsigned char table_142[256] = { 3036 3036 0x90, 0x94, 0xBE, 0x14, 0x99, 0xEB, 0x45, 0x0F, 3037 3037 0x34, 0x4A, 0xE3, 0x79, 0xD2, 0x64, 0x4D, 0x69, … … 3067 3067 0xCC, 0x1E, 0x87, 0xD7, 0x01, 0x1F, 0x51, 0x95 }; 3068 3068 3069 unsigned char table_143[32] = {3069 static const unsigned char table_143[32] = { 3070 3070 0x0E, 0x16, 0x18, 0x11, 0x0C, 0x01, 0x12, 0x1F, 3071 3071 0x08, 0x15, 0x0A, 0x06, 0x1C, 0x1E, 0x02, 0x1A, … … 3073 3073 0x0D, 0x14, 0x09, 0x0B, 0x1B, 0x00, 0x1D, 0x04 }; 3074 3074 3075 unsigned char table_144[32] = {3075 static const unsigned char table_144[32] = { 3076 3076 0x00, 0x1B, 0x17, 0x19, 0x1D, 0x11, 0x0D, 0x1A, 3077 3077 0x13, 0x03, 0x1E, 0x09, 0x10, 0x0E, 0x15, 0x05, … … 3079 3079 0x16, 0x14, 0x02, 0x04, 0x07, 0x18, 0x12, 0x0C }; 3080 3080 3081 unsigned char table_145[256] = {3081 static const unsigned char table_145[256] = { 3082 3082 0xF9, 0x2C, 0x38, 0x74, 0xDA, 0x65, 0x85, 0x0E, 3083 3083 0xBA, 0x64, 0xDB, 0xE3, 0xB6, 0x8B, 0x0B, 0x5E, … … 3113 3113 0x69, 0xF6, 0xEF, 0xC2, 0xAD, 0x03, 0xB3, 0x1E }; 3114 3114 3115 unsigned char table_146[256] = {3115 static const unsigned char table_146[256] = { 3116 3116 0x1C, 0xF5, 0x16, 0xD2, 0xCC, 0xDC, 0x1E, 0x29, 3117 3117 0xE3, 0x17, 0x3B, 0x66, 0x6A, 0xF7, 0x03, 0xB2, … … 3147 3147 0x7D, 0x96, 0x76, 0x99, 0xB5, 0x48, 0x98, 0x10 }; 3148 3148 3149 unsigned char table_147[32] = {3149 static const unsigned char table_147[32] = { 3150 3150 0x17, 0x07, 0x0D, 0x16, 0x00, 0x1B, 0x1F, 0x09, 3151 3151 0x10, 0x11, 0x14, 0x0A, 0x02, 0x06, 0x13, 0x0C, … … 3153 3153 0x1C, 0x1A, 0x03, 0x18, 0x04, 0x0B, 0x1D, 0x0E }; 3154 3154 3155 unsigned char table_148[256] = {3155 static const unsigned char table_148[256] = { 3156 3156 0xFB, 0x23, 0xBC, 0x5A, 0x8C, 0x02, 0x42, 0x3B, 3157 3157 0x95, 0x0C, 0x21, 0x0E, 0x14, 0xDF, 0x11, 0xC0, … … 3187 3187 0x09, 0x43, 0xBF, 0xD0, 0x55, 0xDD, 0x3F, 0x24 }; 3188 3188 3189 unsigned char table_149[32] = {3189 static const unsigned char table_149[32] = { 3190 3190 0x1B, 0x0B, 0x0C, 0x06, 0x1F, 0x17, 0x04, 0x1A, 3191 3191 0x1E, 0x02, 0x0F, 0x16, 0x0E, 0x09, 0x10, 0x01, … … 3193 3193 0x18, 0x1D, 0x14, 0x0D, 0x07, 0x08, 0x15, 0x12 }; 3194 3194 3195 unsigned char table_150[256] = {3195 static const unsigned char table_150[256] = { 3196 3196 0x57, 0xBC, 0x9D, 0x46, 0x14, 0xD0, 0x94, 0x95, 3197 3197 0x1B, 0x12, 0xB8, 0xD4, 0x53, 0x73, 0x83, 0xE6, … … 3227 3227 0x97, 0xC9, 0xF3, 0x04, 0xD8, 0xF4, 0x80, 0x44 }; 3228 3228 3229 unsigned char table_151[256] = {3229 static const unsigned char table_151[256] = { 3230 3230 0x78, 0x6C, 0xC5, 0x0C, 0x2D, 0xA7, 0x97, 0x9C, 3231 3231 0x22, 0x76, 0x3E, 0x81, 0x51, 0x47, 0x59, 0x71, … … 3261 3261 0x43, 0x3A, 0x53, 0x9E, 0x80, 0x88, 0x07, 0x9D }; 3262 3262 3263 unsigned char table_152[32] = {3263 static const unsigned char table_152[32] = { 3264 3264 0x02, 0x1A, 0x17, 0x1D, 0x01, 0x03, 0x13, 0x1E, 3265 3265 0x05, 0x18, 0x06, 0x0A, 0x0C, 0x04, 0x1B, 0x00, … … 3267 3267 0x14, 0x12, 0x0D, 0x10, 0x19, 0x11, 0x08, 0x15 }; 3268 3268 3269 unsigned char table_153[32] = {3269 static const unsigned char table_153[32] = { 3270 3270 0x0E, 0x14, 0x12, 0x1E, 0x1C, 0x02, 0x06, 0x16, 3271 3271 0x18, 0x0D, 0x17, 0x0C, 0x1D, 0x11, 0x08, 0x19, … … 3273 3273 0x1A, 0x0A, 0x05, 0x10, 0x00, 0x01, 0x15, 0x09 }; 3274 3274 3275 unsigned char table_154[256] = {3275 static const unsigned char table_154[256] = { 3276 3276 0x27, 0x5A, 0x08, 0x5B, 0xF4, 0x39, 0x13, 0x6F, 3277 3277 0x67, 0xEA, 0x22, 0xCA, 0x5C, 0xCF, 0x18, 0x7C, … … 3307 3307 0x53, 0xE1, 0xDD, 0x72, 0x95, 0x52, 0x34, 0xB5 }; 3308 3308 3309 unsigned char table_155[256] = {3309 static const unsigned char table_155[256] = { 3310 3310 0x75, 0x58, 0xC5, 0xA5, 0x83, 0x16, 0xF3, 0x7F, 3311 3311 0x94, 0xDE, 0xA0, 0xF6, 0xFD, 0x89, 0xA8, 0x06, … … 3341 3341 0x8B, 0x33, 0xFC, 0xBB, 0x00, 0xA2, 0xDF, 0xDA }; 3342 3342 3343 unsigned char table_156[256] = {3343 static const unsigned char table_156[256] = { 3344 3344 0x31, 0x25, 0xB1, 0xD3, 0xAF, 0xAE, 0x84, 0x2C, 3345 3345 0x71, 0x5E, 0xD8, 0x80, 0x6F, 0x3E, 0x48, 0x86, … … 3375 3375 0xF1, 0x68, 0xBE, 0x35, 0x40, 0x8C, 0xD4, 0x47 }; 3376 3376 3377 unsigned char table_157[32] = {3377 static const unsigned char table_157[32] = { 3378 3378 0x00, 0x0D, 0x03, 0x02, 0x11, 0x04, 0x18, 0x0B, 3379 3379 0x14, 0x1D, 0x1C, 0x13, 0x1B, 0x17, 0x10, 0x15, … … 3381 3381 0x08, 0x06, 0x0C, 0x0E, 0x1F, 0x0F, 0x0A, 0x05 }; 3382 3382 3383 unsigned char table_158[256] = {3383 static const unsigned char table_158[256] = { 3384 3384 0x68, 0x26, 0x80, 0x0B, 0xB8, 0xD5, 0x8C, 0xB7, 3385 3385 0x65, 0xEF, 0xBC, 0x94, 0x28, 0xB9, 0xB2, 0xD2, … … 3415 3415 0x9A, 0x57, 0xA2, 0x74, 0xC6, 0xFE, 0x9B, 0x58 }; 3416 3416 3417 unsigned char table_159[256] = {3417 static const unsigned char table_159[256] = { 3418 3418 0xE5, 0xBF, 0x84, 0x56, 0xD6, 0x43, 0x3E, 0xA5, 3419 3419 0x64, 0x87, 0x44, 0x63, 0x4A, 0x4C, 0x8D, 0x24, … … 3449 3449 0xCB, 0x9B, 0x13, 0x8F, 0xA4, 0x28, 0x23, 0x85 }; 3450 3450 3451 unsigned char table_160[256] = {3451 static const unsigned char table_160[256] = { 3452 3452 0x35, 0x44, 0x0E, 0x92, 0x75, 0x83, 0x9D, 0x53, 3453 3453 0xA5, 0x90, 0xF8, 0xF7, 0x54, 0x74, 0xDF, 0x3D, … … 3483 3483 0xBB, 0x2C, 0xE5, 0xC3, 0x67, 0xA1, 0x10, 0xB9 }; 3484 3484 3485 unsigned char table_161[256] = {3485 static const unsigned char table_161[256] = { 3486 3486 0x8F, 0x1A, 0x81, 0xA2, 0x2C, 0x56, 0x6D, 0xCD, 3487 3487 0x4A, 0x33, 0x50, 0xE9, 0xE0, 0x12, 0x5A, 0x43, … … 3517 3517 0xBE, 0x0A, 0x36, 0x41, 0xC0, 0x8C, 0xE4, 0xAA }; 3518 3518 3519 unsigned char table_162[256] = {3519 static const unsigned char table_162[256] = { 3520 3520 0xF7, 0x1B, 0xC0, 0x31, 0x5A, 0x23, 0xEA, 0xE9, 3521 3521 0xFB, 0x14, 0x6A, 0xE8, 0x04, 0x65, 0x5B, 0x2C, … … 3551 3551 0x38, 0xCC, 0x58, 0x44, 0xBF, 0x93, 0x5D, 0xC7 }; 3552 3552 3553 unsigned char table_163[32] = {3553 static const unsigned char table_163[32] = { 3554 3554 0x1B, 0x14, 0x12, 0x15, 0x11, 0x1D, 0x17, 0x19, 3555 3555 0x10, 0x09, 0x08, 0x06, 0x1A, 0x16, 0x07, 0x13, … … 3557 3557 0x04, 0x01, 0x03, 0x0C, 0x0D, 0x1E, 0x02, 0x0F }; 3558 3558 3559 unsigned char table_164[32] = {3559 static const unsigned char table_164[32] = { 3560 3560 0x15, 0x00, 0x10, 0x0B, 0x1D, 0x0A, 0x06, 0x1C, 3561 3561 0x0D, 0x1F, 0x17, 0x0F, 0x03, 0x14, 0x13, 0x12, … … 3563 3563 0x02, 0x0C, 0x0E, 0x01, 0x07, 0x19, 0x11, 0x05 }; 3564 3564 3565 unsigned char table_165[256] = {3565 static const unsigned char table_165[256] = { 3566 3566 0x98, 0xF5, 0x1D, 0xFB, 0x13, 0x20, 0x41, 0xA3, 3567 3567 0xE3, 0x76, 0x49, 0x7E, 0x60, 0xD8, 0x68, 0x30, … … 3597 3597 0x1A, 0x26, 0xCC, 0xB1, 0xF9, 0xFA, 0x97, 0xE9 }; 3598 3598 3599 unsigned char table_166[256] = {3599 static const unsigned char table_166[256] = { 3600 3600 0xCB, 0xEA, 0x2A, 0x36, 0x6D, 0x93, 0x4E, 0xD5, 3601 3601 0xBC, 0x6A, 0xD4, 0x68, 0xF7, 0x18, 0xAB, 0x8B, … … 3631 3631 0x1C, 0xE0, 0x51, 0x16, 0x43, 0x07, 0x0A, 0x3F }; 3632 3632 3633 unsigned char table_167[256] = {3633 static const unsigned char table_167[256] = { 3634 3634 0x91, 0xEA, 0x4F, 0x6A, 0x6E, 0x2D, 0x27, 0x22, 3635 3635 0x44, 0xA5, 0x6D, 0xE3, 0x45, 0x06, 0xE2, 0x87, … … 3665 3665 0x14, 0x15, 0x25, 0x32, 0x6C, 0x69, 0x1A, 0xCF }; 3666 3666 3667 unsigned char table_168[256] = {3667 static const unsigned char table_168[256] = { 3668 3668 0x28, 0xEE, 0xB1, 0xFD, 0xB3, 0xEF, 0x36, 0x8E, 3669 3669 0x85, 0x5D, 0x1C, 0x53, 0x1E, 0xDA, 0xBA, 0x3C, … … 3699 3699 0x66, 0x2E, 0x08, 0x32, 0x4C, 0x33, 0x7E, 0xE1 }; 3700 3700 3701 unsigned char table_169[256] = {3701 static const unsigned char table_169[256] = { 3702 3702 0xA4, 0x31, 0xA9, 0x3F, 0x13, 0x4D, 0x1B, 0x29, 3703 3703 0x73, 0x43, 0xF1, 0xE7, 0x9C, 0xC2, 0xF6, 0xCD, … … 3733 3733 0x6B, 0x0A, 0x59, 0x9E, 0x5E, 0x38, 0x45, 0x80 }; 3734 3734 3735 unsigned char table_170[256] = {3735 static const unsigned char table_170[256] = { 3736 3736 0xE3, 0x00, 0x99, 0x03, 0xF6, 0xDD, 0xD1, 0x41, 3737 3737 0x58, 0x7E, 0xD9, 0x46, 0x04, 0xAF, 0x5C, 0x43, … … 3767 3767 0x48, 0x30, 0x87, 0x83, 0x12, 0x4D, 0x65, 0xDF }; 3768 3768 3769 unsigned char table_171[32] = {3769 static const unsigned char table_171[32] = { 3770 3770 0x07, 0x06, 0x11, 0x08, 0x0C, 0x1F, 0x19, 0x02, 3771 3771 0x14, 0x04, 0x0D, 0x18, 0x1A, 0x05, 0x17, 0x13, … … 3773 3773 0x1D, 0x10, 0x00, 0x12, 0x0B, 0x0E, 0x09, 0x0A }; 3774 3774 3775 unsigned char table_172[32] = {3775 static const unsigned char table_172[32] = { 3776 3776 0x11, 0x01, 0x1F, 0x06, 0x1A, 0x04, 0x02, 0x09, 3777 3777 0x05, 0x0D, 0x0B, 0x18, 0x0E, 0x12, 0x1B, 0x17, … … 3779 3779 0x03, 0x0C, 0x00, 0x10, 0x0A, 0x1C, 0x0F, 0x13 }; 3780 3780 3781 unsigned char table_173[32] = {3781 static const unsigned char table_173[32] = { 3782 3782 0x1F, 0x0B, 0x13, 0x00, 0x16, 0x15, 0x14, 0x0A, 3783 3783 0x1D, 0x05, 0x1E, 0x1A, 0x0F, 0x04, 0x0E, 0x01, … … 3785 3785 0x03, 0x11, 0x18, 0x10, 0x1C, 0x1B, 0x06, 0x0D }; 3786 3786 3787 unsigned char table_174[32] = {3787 static const unsigned char table_174[32] = { 3788 3788 0x02, 0x1B, 0x0C, 0x17, 0x1F, 0x05, 0x15, 0x1E, 3789 3789 0x16, 0x09, 0x1A, 0x12, 0x0F, 0x1C, 0x18, 0x0A, … … 3791 3791 0x1D, 0x0E, 0x06, 0x00, 0x01, 0x07, 0x0B, 0x03 }; 3792 3792 3793 unsigned char table_175[32] = {3793 static const unsigned char table_175[32] = { 3794 3794 0x00, 0x06, 0x0B, 0x08, 0x0C, 0x04, 0x1A, 0x1C, 3795 3795 0x05, 0x1E, 0x14, 0x03, 0x0A, 0x18, 0x12, 0x1D, … … 3797 3797 0x11, 0x19, 0x10, 0x0D, 0x1B, 0x02, 0x01, 0x15 }; 3798 3798 3799 unsigned char table_176[32] = {3799 static const unsigned char table_176[32] = { 3800 3800 0x12, 0x03, 0x1A, 0x15, 0x04, 0x19, 0x0B, 0x1B, 3801 3801 0x17, 0x1E, 0x0D, 0x05, 0x11, 0x14, 0x1C, 0x00, … … 3803 3803 0x13, 0x09, 0x16, 0x1D, 0x0F, 0x0C, 0x01, 0x1F }; 3804 3804 3805 unsigned char table_177[256] = {3805 static const unsigned char table_177[256] = { 3806 3806 0x5E, 0x4D, 0x76, 0xFE, 0xB5, 0x50, 0x83, 0x23, 3807 3807 0x72, 0xDD, 0x93, 0x08, 0x69, 0xAD, 0xEC, 0x3B, … … 3837 3837 0x5A, 0xC5, 0xE0, 0x58, 0x41, 0x4E, 0x4A, 0xAF }; 3838 3838 3839 unsigned char table_178[256] = {3839 static const unsigned char table_178[256] = { 3840 3840 0x33, 0xBA, 0x98, 0xDA, 0x07, 0x2C, 0x22, 0x9B, 3841 3841 0xE0, 0xED, 0xB7, 0xA1, 0x93, 0xEB, 0xDC, 0x49, … … 3871 3871 0x95, 0x9E, 0xBF, 0xEF, 0xF8, 0x45, 0x00, 0xB4 }; 3872 3872 3873 unsigned char table_179[256] = {3873 static const unsigned char table_179[256] = { 3874 3874 0x50, 0x3D, 0x41, 0x42, 0x06, 0x5B, 0xD6, 0x34, 3875 3875 0x9D, 0x3C, 0x7B, 0x14, 0xE2, 0x9B, 0x80, 0x15, … … 3905 3905 0x2A, 0x04, 0x18, 0xA5, 0xA2, 0x6E, 0x07, 0xE3 }; 3906 3906 3907 unsigned char table_180[256] = {3907 static const unsigned char table_180[256] = { 3908 3908 0xDA, 0xCC, 0x72, 0xA6, 0xE7, 0x07, 0xFD, 0x25, 3909 3909 0x92, 0x39, 0x49, 0x02, 0xD6, 0x09, 0xA8, 0x65, … … 3939 3939 0x62, 0x4F, 0xCF, 0xB2, 0xC2, 0x59, 0xDB, 0x67 }; 3940 3940 3941 unsigned char table_181[256] = {3941 static const unsigned char table_181[256] = { 3942 3942 0x2B, 0xED, 0x14, 0x05, 0x80, 0xCC, 0x5A, 0xF8, 3943 3943 0x43, 0xB7, 0x86, 0xC6, 0xEE, 0xA6, 0xD7, 0xD6, … … 3973 3973 0x32, 0x24, 0x7D, 0x9B, 0xD2, 0x83, 0x35, 0xCD }; 3974 3974 3975 unsigned char table_182[256] = {3975 static const unsigned char table_182[256] = { 3976 3976 0x06, 0x7F, 0x66, 0xB5, 0xBA, 0x1E, 0xFD, 0x51, 3977 3977 0x81, 0x8D, 0x28, 0xA3, 0x15, 0x37, 0xDC, 0x58, … … 4007 4007 0x7B, 0x17, 0x0B, 0x0A, 0x41, 0x03, 0xD4, 0x4B }; 4008 4008 4009 unsigned char table_183[32] = {4009 static const unsigned char table_183[32] = { 4010 4010 0x1E, 0x1B, 0x11, 0x07, 0x08, 0x06, 0x18, 0x17, 4011 4011 0x0D, 0x0F, 0x12, 0x03, 0x1D, 0x04, 0x0A, 0x1A, … … 4013 4013 0x16, 0x05, 0x1C, 0x0E, 0x02, 0x00, 0x09, 0x15 }; 4014 4014 4015 unsigned char table_184[32] = {4015 static const unsigned char table_184[32] = { 4016 4016 0x0F, 0x1D, 0x17, 0x16, 0x0D, 0x05, 0x13, 0x1F, 4017 4017 0x1B, 0x09, 0x1C, 0x1E, 0x15, 0x01, 0x06, 0x08, … … 4019 4019 0x18, 0x0E, 0x03, 0x11, 0x12, 0x14, 0x19, 0x00 }; 4020 4020 4021 unsigned char table_185[256] = {4021 static const unsigned char table_185[256] = { 4022 4022 0xA5, 0xEE, 0x2E, 0x28, 0xA7, 0xAC, 0xD9, 0xB2, 4023 4023 0x6E, 0x04, 0xB4, 0x03, 0xE8, 0x92, 0x5F, 0x4D, … … 4053 4053 0x2B, 0xC5, 0x98, 0x18, 0x66, 0x15, 0x9C, 0xBC }; 4054 4054 4055 unsigned char table_186[256] = {4055 static const unsigned char table_186[256] = { 4056 4056 0xB7, 0xFA, 0x03, 0x7C, 0x76, 0x43, 0xA7, 0x15, 4057 4057 0x4B, 0x4F, 0x04, 0xAA, 0x4E, 0xD2, 0x52, 0xC8, … … 4087 4087 0x11, 0x3B, 0x94, 0xE8, 0x7D, 0x7B, 0xD9, 0x5A }; 4088 4088 4089 unsigned char table_187[32] = {4089 static const unsigned char table_187[32] = { 4090 4090 0x0F, 0x04, 0x1D, 0x1B, 0x15, 0x10, 0x01, 0x0B, 4091 4091 0x00, 0x17, 0x13, 0x07, 0x1E, 0x1F, 0x08, 0x0A, … … 4093 4093 0x0E, 0x18, 0x03, 0x1C, 0x12, 0x11, 0x0D, 0x02 }; 4094 4094 4095 st ruct yahoo_fn yahoo_fntable[5][96] =4095 static const struct yahoo_fn yahoo_fntable[5][96] = 4096 4096 {{{ IDENT, 0, 0 }, 4097 4097 { IDENT, 0, 0 }, … … 4582 4582 int yahoo_xfrm( int table, int depth, int seed ) 4583 4583 { 4584 struct yahoo_fn *xfrm;4584 const struct yahoo_fn *xfrm; 4585 4585 int i, j, z; 4586 4586 unsigned int n = seed; -
protocols/yahoo/yahoo_list.h
r7308b63 r9fae35c 21 21 */ 22 22 23 /*24 * This is a replacement for the GList. It only provides functions that25 * we use in Ayttm. Thanks to Meredyyd from everybuddy dev for doing26 * most of it.27 */28 29 23 #ifndef __YLIST_H__ 30 24 #define __YLIST_H__ 31 25 32 #ifdef __cplusplus 33 extern "C" { 26 /* GLib has linked list already, so I don't see why libyahoo2 has to copy this... */ 27 28 typedef GList YList; 29 30 #define y_list_append g_list_append 31 #define y_list_concat g_list_concat 32 #define y_list_copy g_list_copy 33 #define y_list_empty g_list_empty 34 #define y_list_find g_list_find 35 #define y_list_find_custom g_list_find_custom 36 #define y_list_foreach g_list_foreach 37 #define y_list_free g_list_free 38 #define y_list_free_1 g_list_free_1 39 #define y_list_insert_sorted g_list_insert_sorted 40 #define y_list_length g_list_length 41 #define y_list_next g_list_next 42 #define y_list_nth g_list_nth 43 #define y_list_prepend g_list_prepend 44 #define y_list_remove g_list_remove 45 #define y_list_remove_link g_list_remove_link 46 #define y_list_singleton g_list_singleton 47 34 48 #endif 35 36 typedef struct _YList {37 struct _YList *next;38 struct _YList *prev;39 void *data;40 } YList;41 42 typedef int (*YListCompFunc) (const void *, const void *);43 typedef void (*YListFunc) (void *, void *);44 45 YList *y_list_append(YList * list, void *data);46 YList *y_list_prepend(YList * list, void *data);47 YList *y_list_remove_link(YList * list, const YList * link);48 YList *y_list_remove(YList * list, void *data);49 50 YList *y_list_insert_sorted(YList * list, void * data, YListCompFunc comp);51 52 YList *y_list_copy(YList * list);53 54 YList *y_list_concat(YList * list, YList * add);55 56 YList *y_list_find(YList * list, const void *data);57 YList *y_list_find_custom(YList * list, const void *data, YListCompFunc comp);58 59 YList *y_list_nth(YList * list, int n);60 61 void y_list_foreach(YList * list, YListFunc fn, void *user_data);62 63 void y_list_free_1(YList * list);64 void y_list_free(YList * list);65 int y_list_length(const YList * list);66 int y_list_empty(const YList * list);67 int y_list_singleton(const YList * list);68 69 #define y_list_next(list) list->next70 71 #ifdef __cplusplus72 }73 #endif74 #endif -
protocols/yahoo/yahoo_util.c
r7308b63 r9fae35c 50 50 51 51 return new_string; 52 }53 54 char * y_str_to_utf8(const char *in)55 {56 unsigned int n, i = 0;57 char *result = NULL;58 59 if(in == NULL || *in == '\0')60 return "";61 62 result = y_new(char, strlen(in) * 2 + 1);63 64 /* convert a string to UTF-8 Format */65 for (n = 0; n < strlen(in); n++) {66 unsigned char c = (unsigned char)in[n];67 68 if (c < 128) {69 result[i++] = (char) c;70 } else {71 result[i++] = (char) ((c >> 6) | 192);72 result[i++] = (char) ((c & 63) | 128);73 }74 }75 result[i] = '\0';76 return result;77 }78 79 char * y_utf8_to_str(const char *in)80 {81 int i = 0;82 unsigned int n;83 char *result = NULL;84 85 if(in == NULL || *in == '\0')86 return "";87 88 result = y_new(char, strlen(in) + 1);89 90 /* convert a string from UTF-8 Format */91 for (n = 0; n < strlen(in); n++) {92 unsigned char c = in[n];93 94 if (c < 128) {95 result[i++] = (char) c;96 } else {97 result[i++] = (c << 6) | (in[++n] & 63);98 }99 }100 result[i] = '\0';101 return result;102 52 } 103 53 -
root_commands.c
r7308b63 r9fae35c 32 32 #include <string.h> 33 33 34 command_t commands[] = { 35 { "help", 0, cmd_help }, 36 { "identify", 1, cmd_identify }, 37 { "register", 1, cmd_register }, 38 { "drop", 1, cmd_drop }, 39 { "account", 1, cmd_account }, 40 { "add", 2, cmd_add }, 41 { "info", 1, cmd_info }, 42 { "rename", 2, cmd_rename }, 43 { "remove", 1, cmd_remove }, 44 { "block", 1, cmd_block }, 45 { "allow", 1, cmd_allow }, 46 { "save", 0, cmd_save }, 47 { "set", 0, cmd_set }, 48 { "yes", 0, cmd_yesno }, 49 { "no", 0, cmd_yesno }, 50 { "blist", 0, cmd_blist }, 51 { "nick", 1, cmd_nick }, 52 { "import_buddies", 1, cmd_import_buddies }, 53 { "qlist", 0, cmd_qlist }, 54 { NULL } 55 }; 56 57 int cmd_help( irc_t *irc, char **cmd ) 34 void root_command_string( irc_t *irc, user_t *u, char *command, int flags ) 35 { 36 char *cmd[IRC_MAX_ARGS]; 37 char *s; 38 int k; 39 char q = 0; 40 41 memset( cmd, 0, sizeof( cmd ) ); 42 cmd[0] = command; 43 k = 1; 44 for( s = command; *s && k < ( IRC_MAX_ARGS - 1 ); s ++ ) 45 if( *s == ' ' && !q ) 46 { 47 *s = 0; 48 while( *++s == ' ' ); 49 if( *s == '"' || *s == '\'' ) 50 { 51 q = *s; 52 s ++; 53 } 54 if( *s ) 55 { 56 cmd[k++] = s; 57 s --; 58 } 59 } 60 else if( *s == q ) 61 { 62 q = *s = 0; 63 } 64 cmd[k] = NULL; 65 66 root_command( irc, cmd ); 67 } 68 69 void root_command( irc_t *irc, char *cmd[] ) 70 { 71 int i; 72 73 if( !cmd[0] ) 74 return; 75 76 for( i = 0; commands[i].command; i++ ) 77 if( g_strcasecmp( commands[i].command, cmd[0] ) == 0 ) 78 { 79 if( !cmd[commands[i].required_parameters] ) 80 { 81 irc_usermsg( irc, "Not enough parameters given (need %d)", commands[i].required_parameters ); 82 return; 83 } 84 commands[i].execute( irc, cmd ); 85 return; 86 } 87 88 irc_usermsg( irc, "Unknown command: %s. Please use \x02help commands\x02 to get a list of available commands.", cmd[0] ); 89 } 90 91 static void cmd_help( irc_t *irc, char **cmd ) 58 92 { 59 93 char param[80]; … … 75 109 irc_usermsg( irc, "%s", s ); 76 110 g_free( s ); 77 return( 1 );78 111 } 79 112 else 80 113 { 81 114 irc_usermsg( irc, "Error opening helpfile." ); 82 return( 0 ); 83 } 84 } 85 86 int cmd_identify( irc_t *irc, char **cmd ) 115 } 116 } 117 118 static void cmd_identify( irc_t *irc, char **cmd ) 87 119 { 88 120 storage_status_t status = storage_load( irc->nick, cmd[1], irc ); … … 97 129 case STORAGE_OK: 98 130 irc_usermsg( irc, "Password accepted" ); 131 irc_umode_set( irc, "+R", 1 ); 99 132 break; 100 133 default: … … 102 135 break; 103 136 } 104 105 return( 0 ); 106 } 107 108 int cmd_register( irc_t *irc, char **cmd ) 137 } 138 139 static void cmd_register( irc_t *irc, char **cmd ) 109 140 { 110 141 if( global.conf->authmode == AUTHMODE_REGISTERED ) 111 142 { 112 143 irc_usermsg( irc, "This server does not allow registering new accounts" ); 113 return ( 0 );144 return; 114 145 } 115 146 … … 122 153 case STORAGE_OK: 123 154 irc->status = USTATUS_IDENTIFIED; 155 irc_umode_set( irc, "+R", 1 ); 124 156 break; 125 157 … … 128 160 break; 129 161 } 130 131 return( 0 ); 132 } 133 134 int cmd_drop( irc_t *irc, char **cmd ) 162 } 163 164 static void cmd_drop( irc_t *irc, char **cmd ) 135 165 { 136 166 storage_status_t status; … … 140 170 case STORAGE_NO_SUCH_USER: 141 171 irc_usermsg( irc, "That account does not exist" ); 142 return( 0 );172 break; 143 173 case STORAGE_INVALID_PASSWORD: 144 174 irc_usermsg( irc, "Password invalid" ); 145 return( 0 );175 break; 146 176 case STORAGE_OK: 147 177 irc_setpass( irc, NULL ); 178 irc->status = USTATUS_LOGGED_IN; 179 irc_umode_set( irc, "-R", 1 ); 148 180 irc_usermsg( irc, "Account `%s' removed", irc->nick ); 149 return( 0 );181 break; 150 182 default: 151 183 irc_usermsg( irc, "Error: '%d'", status ); 152 return( 0 );153 } 154 } 155 156 intcmd_account( irc_t *irc, char **cmd )184 break; 185 } 186 } 187 188 static void cmd_account( irc_t *irc, char **cmd ) 157 189 { 158 190 account_t *a; … … 161 193 { 162 194 irc_usermsg( irc, "This server only accepts registered users" ); 163 return ( 0 );195 return; 164 196 } 165 197 … … 171 203 { 172 204 irc_usermsg( irc, "Not enough parameters" ); 173 return ( 0 );205 return; 174 206 } 175 207 … … 179 211 { 180 212 irc_usermsg( irc, "Unknown protocol" ); 181 return ( 0 );213 return; 182 214 } 183 215 … … 241 273 { 242 274 irc_usermsg( irc, "Account already online" ); 243 return ( 0 );275 return; 244 276 } 245 277 else … … 251 283 { 252 284 irc_usermsg( irc, "Invalid account" ); 253 return ( 0 );285 return; 254 286 } 255 287 } … … 297 329 { 298 330 irc_usermsg( irc, "Account already offline" ); 299 return ( 0 );331 return; 300 332 } 301 333 } … … 303 335 { 304 336 irc_usermsg( irc, "Invalid account" ); 305 return ( 0 );337 return; 306 338 } 307 339 } … … 310 342 irc_usermsg( irc, "Unknown command: account %s. Please use \x02help commands\x02 to get a list of available commands.", cmd[1] ); 311 343 } 312 313 return( 1 ); 314 } 315 316 int cmd_add( irc_t *irc, char **cmd ) 344 } 345 346 static void cmd_add( irc_t *irc, char **cmd ) 317 347 { 318 348 account_t *a; … … 321 351 { 322 352 irc_usermsg( irc, "Invalid account" ); 323 return ( 1 );353 return; 324 354 } 325 355 else if( !( a->gc && ( a->gc->flags & OPT_LOGGED_IN ) ) ) 326 356 { 327 357 irc_usermsg( irc, "That account is not on-line" ); 328 return ( 1 );358 return; 329 359 } 330 360 … … 334 364 { 335 365 irc_usermsg( irc, "The requested nick `%s' is invalid", cmd[3] ); 336 return ( 0 );366 return; 337 367 } 338 368 else if( user_find( irc, cmd[3] ) ) 339 369 { 340 370 irc_usermsg( irc, "The requested nick `%s' already exists", cmd[3] ); 341 return ( 0 );371 return; 342 372 } 343 373 else … … 350 380 351 381 irc_usermsg( irc, "User `%s' added to your contact list as `%s'", cmd[2], user_findhandle( a->gc, cmd[2] )->nick ); 352 353 return( 0 ); 354 } 355 356 int cmd_info( irc_t *irc, char **cmd ) 382 } 383 384 static void cmd_info( irc_t *irc, char **cmd ) 357 385 { 358 386 struct gaim_connection *gc; … … 365 393 { 366 394 irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] ); 367 return ( 1 );395 return; 368 396 } 369 397 gc = u->gc; … … 373 401 { 374 402 irc_usermsg( irc, "Invalid account" ); 375 return ( 1 );403 return; 376 404 } 377 405 else if( !( ( gc = a->gc ) && ( a->gc->flags & OPT_LOGGED_IN ) ) ) 378 406 { 379 407 irc_usermsg( irc, "That account is not on-line" ); 380 return ( 1 );408 return; 381 409 } 382 410 … … 384 412 { 385 413 irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] ); 386 return( 1 );387 }388 gc->prpl->get_info( gc, cmd[2] );389 390 return( 0 );391 } 392 393 intcmd_rename( irc_t *irc, char **cmd )414 } 415 else 416 { 417 gc->prpl->get_info( gc, cmd[2] ); 418 } 419 } 420 421 static void cmd_rename( irc_t *irc, char **cmd ) 394 422 { 395 423 user_t *u; … … 398 426 { 399 427 irc_usermsg( irc, "Nick `%s' can't be changed", cmd[1] ); 400 return( 1 ); 401 } 402 if( user_find( irc, cmd[2] ) && ( nick_cmp( cmd[1], cmd[2] ) != 0 ) ) 428 } 429 else if( user_find( irc, cmd[2] ) && ( nick_cmp( cmd[1], cmd[2] ) != 0 ) ) 403 430 { 404 431 irc_usermsg( irc, "Nick `%s' already exists", cmd[2] ); 405 return( 1 ); 406 } 407 if( !nick_ok( cmd[2] ) ) 432 } 433 else if( !nick_ok( cmd[2] ) ) 408 434 { 409 435 irc_usermsg( irc, "Nick `%s' is invalid", cmd[2] ); 410 return( 1 ); 411 } 412 if( !( u = user_find( irc, cmd[1] ) ) ) 436 } 437 else if( !( u = user_find( irc, cmd[1] ) ) ) 413 438 { 414 439 irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] ); 415 return( 1 );416 }417 user_rename( irc, cmd[1], cmd[2] );418 irc_write( irc, ":%s!%s@%s NICK %s", cmd[1], u->user, u->host, cmd[2] );419 if( g_strcasecmp( cmd[1], irc->mynick ) == 0 )420 {421 g_free( irc->mynick );422 irc->mynick = g_strdup( cmd[2]);423 }424 else if( u->send_handler == buddy_send_handler )425 {426 nick_set( irc, u->handle, u->gc->prpl, cmd[2] );427 }428 429 irc_usermsg( irc, "Nick successfully changed" );430 431 return( 0 );432 } 433 434 intcmd_remove( irc_t *irc, char **cmd )440 } 441 else 442 { 443 user_rename( irc, cmd[1], cmd[2] ); 444 irc_write( irc, ":%s!%s@%s NICK %s", cmd[1], u->user, u->host, cmd[2] ); 445 if( g_strcasecmp( cmd[1], irc->mynick ) == 0 ) 446 { 447 g_free( irc->mynick ); 448 irc->mynick = g_strdup( cmd[2] ); 449 } 450 else if( u->send_handler == buddy_send_handler ) 451 { 452 nick_set( irc, u->handle, u->gc->prpl, cmd[2] ); 453 } 454 455 irc_usermsg( irc, "Nick successfully changed" ); 456 } 457 } 458 459 static void cmd_remove( irc_t *irc, char **cmd ) 435 460 { 436 461 user_t *u; … … 440 465 { 441 466 irc_usermsg( irc, "Buddy `%s' not found", cmd[1] ); 442 return ( 1 );467 return; 443 468 } 444 469 s = g_strdup( u->handle ); … … 451 476 g_free( s ); 452 477 453 return ( 0 );454 } 455 456 intcmd_block( irc_t *irc, char **cmd )478 return; 479 } 480 481 static void cmd_block( irc_t *irc, char **cmd ) 457 482 { 458 483 struct gaim_connection *gc; … … 465 490 { 466 491 irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] ); 467 return ( 1 );492 return; 468 493 } 469 494 gc = u->gc; … … 473 498 { 474 499 irc_usermsg( irc, "Invalid account" ); 475 return ( 1 );500 return; 476 501 } 477 502 else if( !( ( gc = a->gc ) && ( a->gc->flags & OPT_LOGGED_IN ) ) ) 478 503 { 479 504 irc_usermsg( irc, "That account is not on-line" ); 480 return ( 1 );505 return; 481 506 } 482 507 … … 491 516 irc_usermsg( irc, "Buddy `%s' moved from your permit- to your deny-list", cmd[2] ); 492 517 } 493 494 return( 0 ); 495 } 496 497 int cmd_allow( irc_t *irc, char **cmd ) 518 } 519 520 static void cmd_allow( irc_t *irc, char **cmd ) 498 521 { 499 522 struct gaim_connection *gc; … … 506 529 { 507 530 irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] ); 508 return ( 1 );531 return; 509 532 } 510 533 gc = u->gc; … … 514 537 { 515 538 irc_usermsg( irc, "Invalid account" ); 516 return ( 1 );539 return; 517 540 } 518 541 else if( !( ( gc = a->gc ) && ( a->gc->flags & OPT_LOGGED_IN ) ) ) 519 542 { 520 543 irc_usermsg( irc, "That account is not on-line" ); 521 return ( 1 );544 return; 522 545 } 523 546 … … 533 556 irc_usermsg( irc, "Buddy `%s' moved from your deny- to your permit-list", cmd[2] ); 534 557 } 535 536 return( 0 ); 537 } 538 539 int cmd_yesno( irc_t *irc, char **cmd ) 558 } 559 560 static void cmd_yesno( irc_t *irc, char **cmd ) 540 561 { 541 562 query_t *q = NULL; … … 545 566 { 546 567 irc_usermsg( irc, "Did I ask you something?" ); 547 return ( 0 );568 return; 548 569 } 549 570 … … 555 576 { 556 577 irc_usermsg( irc, "Invalid query number" ); 557 return ( 0 );578 return; 558 579 } 559 580 … … 565 586 { 566 587 irc_usermsg( irc, "Uhm, I never asked you something like that..." ); 567 return ( 0 );588 return; 568 589 } 569 590 } … … 573 594 else if( g_strcasecmp( cmd[0], "no" ) == 0 ) 574 595 query_answer( irc, q, 0 ); 575 576 return( 1 ); 577 } 578 579 int cmd_set( irc_t *irc, char **cmd ) 596 } 597 598 static void cmd_set( irc_t *irc, char **cmd ) 580 599 { 581 600 if( cmd[1] && cmd[2] ) … … 599 618 } 600 619 } 601 602 return( 0 ); 603 } 604 605 int cmd_save( irc_t *irc, char **cmd ) 620 } 621 622 static void cmd_save( irc_t *irc, char **cmd ) 606 623 { 607 624 if( storage_save( irc, TRUE ) == STORAGE_OK ) … … 609 626 else 610 627 irc_usermsg( irc, "Configuration could not be saved!" ); 611 612 return( 0 ); 613 } 614 615 int cmd_blist( irc_t *irc, char **cmd ) 628 } 629 630 static void cmd_blist( irc_t *irc, char **cmd ) 616 631 { 617 632 int online = 0, away = 0, offline = 0; … … 655 670 656 671 irc_usermsg( irc, "%d buddies (%d available, %d away, %d offline)", n_online + n_away + n_offline, n_online, n_away, n_offline ); 657 658 return( 0 ); 659 } 660 661 int cmd_nick( irc_t *irc, char **cmd ) 672 } 673 674 static void cmd_nick( irc_t *irc, char **cmd ) 662 675 { 663 676 account_t *a; … … 691 704 a->gc->prpl->set_info( a->gc, cmd[2] ); 692 705 } 693 694 return( 1 ); 695 } 696 697 int cmd_qlist( irc_t *irc, char **cmd ) 706 } 707 708 static void cmd_qlist( irc_t *irc, char **cmd ) 698 709 { 699 710 query_t *q = irc->queries; … … 703 714 { 704 715 irc_usermsg( irc, "There are no pending questions." ); 705 return ( 0 );716 return; 706 717 } 707 718 … … 713 724 else 714 725 irc_usermsg( irc, "%d, BitlBee: %s", num, q->question ); 715 716 return( 0 ); 717 } 718 719 int cmd_import_buddies( irc_t *irc, char **cmd ) 726 } 727 728 static void cmd_import_buddies( irc_t *irc, char **cmd ) 720 729 { 721 730 struct gaim_connection *gc; … … 726 735 { 727 736 irc_usermsg( irc, "Invalid account" ); 728 return ( 0 );737 return; 729 738 } 730 739 else if( !( ( gc = a->gc ) && ( a->gc->flags & OPT_LOGGED_IN ) ) ) 731 740 { 732 741 irc_usermsg( irc, "That account is not on-line" ); 733 return ( 0 );742 return; 734 743 } 735 744 … … 752 761 { 753 762 irc_usermsg( irc, "Invalid argument: %s", cmd[2] ); 754 return ( 0 );763 return; 755 764 } 756 765 } … … 766 775 767 776 irc_usermsg( irc, "Sent all add requests. Please wait for a while, the server needs some time to handle all the adds." ); 768 769 return( 0 ); 770 } 777 } 778 779 const command_t commands[] = { 780 { "help", 0, cmd_help, 0 }, 781 { "identify", 1, cmd_identify, 0 }, 782 { "register", 1, cmd_register, 0 }, 783 { "drop", 1, cmd_drop, 0 }, 784 { "account", 1, cmd_account, 0 }, 785 { "add", 2, cmd_add, 0 }, 786 { "info", 1, cmd_info, 0 }, 787 { "rename", 2, cmd_rename, 0 }, 788 { "remove", 1, cmd_remove, 0 }, 789 { "block", 1, cmd_block, 0 }, 790 { "allow", 1, cmd_allow, 0 }, 791 { "save", 0, cmd_save, 0 }, 792 { "set", 0, cmd_set, 0 }, 793 { "yes", 0, cmd_yesno, 0 }, 794 { "no", 0, cmd_yesno, 0 }, 795 { "blist", 0, cmd_blist, 0 }, 796 { "nick", 1, cmd_nick, 0 }, 797 { "import_buddies", 1, cmd_import_buddies, 0 }, 798 { "qlist", 0, cmd_qlist, 0 }, 799 { NULL } 800 }; -
sock.h
r7308b63 r9fae35c 1 1 #include <errno.h> 2 2 #include <fcntl.h> 3 4 /* To cut down on the ifdef stuff a little bit in other places */ 5 #ifdef IPV6 6 #define AF_INETx AF_INET6 7 #else 8 #define AF_INETx AF_INET 9 #endif 3 10 4 11 #ifndef _WIN32 -
storage_text.c
r7308b63 r9fae35c 71 71 user_t *ru = user_find( irc, ROOT_NICK ); 72 72 73 if( irc->status == USTATUS_IDENTIFIED )73 if( irc->status >= USTATUS_IDENTIFIED ) 74 74 return( 1 ); 75 75 -
unix.c
r7308b63 r9fae35c 32 32 #include <unistd.h> 33 33 #include <sys/time.h> 34 #include <sys/wait.h> 34 35 35 36 global_t global; /* Against global namespace pollution */ … … 46 47 global.loop = g_main_new( FALSE ); 47 48 48 log_init( 49 log_init(); 49 50 50 51 nogaim_init(); … … 70 71 log_message( LOGLVL_INFO, "Bitlbee %s starting in daemon mode.", BITLBEE_VERSION ); 71 72 } 73 else if( global.conf->runmode == RUNMODE_FORKDAEMON ) 74 { 75 i = bitlbee_daemon_init(); 76 log_message( LOGLVL_INFO, "Bitlbee %s starting in forking daemon mode.", BITLBEE_VERSION ); 77 } 72 78 if( i != 0 ) 73 79 return( i ); 74 80 75 global.storage = storage_init( global.conf->primary_storage, 76 global.conf->migrate_storage ); 81 global.storage = storage_init( global.conf->primary_storage, global.conf->migrate_storage ); 77 82 if ( global.storage == NULL) { 78 83 log_message( LOGLVL_ERROR, "Unable to load storage backend '%s'", global.conf->primary_storage ); … … 84 89 memset( &sig, 0, sizeof( sig ) ); 85 90 sig.sa_handler = sighandler; 91 sigaction( SIGCHLD, &sig, &old ); 86 92 sigaction( SIGPIPE, &sig, &old ); 87 93 sig.sa_flags = SA_RESETHAND; … … 107 113 static void sighandler( int signal ) 108 114 { 109 /* FIXME: In fact, calling log_message() here can be dangerous. But well, let's take the risk for now.*/115 /* FIXME: Calling log_message() here is not a very good idea! */ 110 116 111 117 if( signal == SIGTERM ) … … 133 139 } 134 140 } 141 else if( signal == SIGCHLD ) 142 { 143 pid_t pid; 144 int st; 145 146 while( ( pid = waitpid( 0, &st, WNOHANG ) ) > 0 ) 147 { 148 if( WIFSIGNALED( st ) ) 149 log_message( LOGLVL_INFO, "Client %d terminated normally. (status = %d)", pid, WEXITSTATUS( st ) ); 150 else if( WIFEXITED( st ) ) 151 log_message( LOGLVL_INFO, "Client %d killed by signal %d.", pid, WTERMSIG( st ) ); 152 } 153 } 135 154 else if( signal != SIGPIPE ) 136 155 { -
url.c
r7308b63 r9fae35c 40 40 else 41 41 { 42 if( g_strncasecmp( set_url, "https", i - set_url ) == 0 ) 42 if( g_strncasecmp( set_url, "http", i - set_url ) == 0 ) 43 url->proto = PROTO_HTTP; 44 else if( g_strncasecmp( set_url, "https", i - set_url ) == 0 ) 43 45 url->proto = PROTO_HTTPS; 44 else if( g_strncasecmp( set_url, "http", i - set_url ) == 0 )45 url->proto = PROTO_HTTP;46 46 else if( g_strncasecmp( set_url, "socks4", i - set_url ) == 0 ) 47 47 url->proto = PROTO_SOCKS4; -
user.h
r7308b63 r9fae35c 45 45 int sendbuf_flags; 46 46 47 int(*send_handler) ( irc_t *irc, struct __USER *u, char *msg, int flags );47 void (*send_handler) ( irc_t *irc, struct __USER *u, char *msg, int flags ); 48 48 49 49 struct __USER *next; -
util.c
r7308b63 r9fae35c 6 6 7 7 /* 8 * nogaim 9 * 10 * Gaim without gaim - for BitlBee 8 * Various utility functions. Some are copied from Gaim to support the 9 * IM-modules, most are from BitlBee. 11 10 * 12 11 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> 13 12 * (and possibly other members of the Gaim team) 14 * Copyright 2002-200 4 Wilmer van der Gaast <lintux@lintux.cx>13 * Copyright 2002-2005 Wilmer van der Gaast <wilmer@gaast.net> 15 14 */ 16 15 … … 32 31 */ 33 32 34 /* Parts from util.c from gaim needed by nogaim */35 33 #define BITLBEE_CORE 36 34 #include "nogaim.h" … … 38 36 #include <stdlib.h> 39 37 #include <string.h> 38 #include <ctype.h> 40 39 #include <glib.h> 41 40 #include <time.h> 42 43 char *utf8_to_str(const char *in)44 {45 int n = 0, i = 0;46 int inlen;47 char *result;48 49 if (!in)50 return NULL;51 52 inlen = strlen(in);53 54 result = g_malloc(inlen + 1);55 56 while (n <= inlen - 1) {57 long c = (long)in[n];58 if (c < 0x80)59 result[i++] = (char)c;60 else {61 if ((c & 0xC0) == 0xC0)62 result[i++] =63 (char)(((c & 0x03) << 6) | (((unsigned char)in[++n]) & 0x3F));64 else if ((c & 0xE0) == 0xE0) {65 if (n + 2 <= inlen) {66 result[i] =67 (char)(((c & 0xF) << 4) | (((unsigned char)in[++n]) & 0x3F));68 result[i] =69 (char)(((unsigned char)result[i]) |70 (((unsigned char)in[++n]) & 0x3F));71 i++;72 } else73 n += 2;74 } else if ((c & 0xF0) == 0xF0)75 n += 3;76 else if ((c & 0xF8) == 0xF8)77 n += 4;78 else if ((c & 0xFC) == 0xFC)79 n += 5;80 }81 n++;82 }83 result[i] = '\0';84 85 return result;86 }87 88 char *str_to_utf8(const char *in)89 {90 int n = 0, i = 0;91 int inlen;92 char *result = NULL;93 94 if (!in)95 return NULL;96 97 inlen = strlen(in);98 99 result = g_malloc(inlen * 2 + 1);100 101 while (n < inlen) {102 long c = (long)in[n];103 if (c == 27) {104 n += 2;105 if (in[n] == 'x')106 n++;107 if (in[n] == '3')108 n++;109 n += 2;110 continue;111 }112 /* why are we removing newlines and carriage returns?113 if ((c == 0x0D) || (c == 0x0A)) {114 n++;115 continue;116 }117 */118 if (c < 128)119 result[i++] = (char)c;120 else {121 result[i++] = (char)((c >> 6) | 192);122 result[i++] = (char)((c & 63) | 128);123 }124 n++;125 }126 result[i] = '\0';127 128 return result;129 }130 41 131 42 void strip_linefeed(gchar *text) … … 271 182 { 272 183 char code[8]; 273 char is ;184 char is[4]; 274 185 } htmlentity_t; 275 186 276 187 /* FIXME: This is ISO8859-1(5) centric, so might cause problems with other charsets. */ 277 188 278 static htmlentity_t ent[] = 279 { 280 { "lt", '<' }, 281 { "gt", '>' }, 282 { "amp", '&' }, 283 { "quot", '"' }, 284 { "aacute", 'á' }, 285 { "eacute", 'é' }, 286 { "iacute", 'é' }, 287 { "oacute", 'ó' }, 288 { "uacute", 'ú' }, 289 { "agrave", 'à' }, 290 { "egrave", 'è' }, 291 { "igrave", 'ì' }, 292 { "ograve", 'ò' }, 293 { "ugrave", 'ù' }, 294 { "acirc", 'â' }, 295 { "ecirc", 'ê' }, 296 { "icirc", 'î' }, 297 { "ocirc", 'ô' }, 298 { "ucirc", 'û' }, 299 { "nbsp", ' ' }, 300 { "", 0 } 189 static const htmlentity_t ent[] = 190 { 191 { "lt", "<" }, 192 { "gt", ">" }, 193 { "amp", "&" }, 194 { "quot", "\"" }, 195 { "aacute", "á" }, 196 { "eacute", "é" }, 197 { "iacute", "é" }, 198 { "oacute", "ó" }, 199 { "uacute", "ú" }, 200 { "agrave", "à" }, 201 { "egrave", "è" }, 202 { "igrave", "ì" }, 203 { "ograve", "ò" }, 204 { "ugrave", "ù" }, 205 { "acirc", "â" }, 206 { "ecirc", "ê" }, 207 { "icirc", "î" }, 208 { "ocirc", "ô" }, 209 { "ucirc", "û" }, 210 { "auml", "ä" }, 211 { "euml", "ë" }, 212 { "iuml", "ï" }, 213 { "ouml", "ö" }, 214 { "uuml", "ü" }, 215 { "nbsp", " " }, 216 { "", "" } 301 217 }; 302 218 … … 347 263 if( g_strncasecmp( ent[i].code, cs, strlen( ent[i].code ) ) == 0 ) 348 264 { 349 *(s++) = ent[i].is; 265 int j; 266 267 for( j = 0; ent[i].is[j]; j ++ ) 268 *(s++) = ent[i].is[j]; 269 350 270 matched = 1; 351 271 break; … … 412 332 g_string_sprintfa( str, "%s%s: %s", newline, name, value ); 413 333 } 334 335 /* Decode%20a%20file%20name */ 336 void http_decode( char *s ) 337 { 338 char *t; 339 int i, j, k; 340 341 t = g_new( char, strlen( s ) + 1 ); 342 343 for( i = j = 0; s[i]; i ++, j ++ ) 344 { 345 if( s[i] == '%' ) 346 { 347 if( sscanf( s + i + 1, "%2x", &k ) ) 348 { 349 t[j] = k; 350 i += 2; 351 } 352 else 353 { 354 *t = 0; 355 break; 356 } 357 } 358 else 359 { 360 t[j] = s[i]; 361 } 362 } 363 t[j] = 0; 364 365 strcpy( s, t ); 366 g_free( t ); 367 } 368 369 /* Warning: This one explodes the string. Worst-cases can make the string 3x its original size! */ 370 /* This fuction is safe, but make sure you call it safely as well! */ 371 void http_encode( char *s ) 372 { 373 char *t; 374 int i, j; 375 376 t = g_strdup( s ); 377 378 for( i = j = 0; t[i]; i ++, j ++ ) 379 { 380 /* if( t[i] <= ' ' || ((unsigned char *)t)[i] >= 128 || t[i] == '%' ) */ 381 if( !isalnum( t[i] ) ) 382 { 383 sprintf( s + j, "%%%02X", ((unsigned char*)t)[i] ); 384 j += 2; 385 } 386 else 387 { 388 s[j] = t[i]; 389 } 390 } 391 s[j] = 0; 392 393 g_free( t ); 394 } 395 396 /* Strip newlines from a string. Modifies the string passed to it. */ 397 char *strip_newlines( char *source ) 398 { 399 int i; 400 401 for( i = 0; source[i] != '\0'; i ++ ) 402 if( source[i] == '\n' || source[i] == '\r' ) 403 source[i] = ' '; 404 405 return source; 406 } 407 408 #ifdef IPV6 409 /* Wrap an IPv4 address into IPv6 space. Not thread-safe... */ 410 char *ipv6_wrap( char *src ) 411 { 412 static char dst[64]; 413 int i; 414 415 for( i = 0; src[i]; i ++ ) 416 if( ( src[i] < '0' || src[i] > '9' ) && src[i] != '.' ) 417 break; 418 419 /* Hmm, it's not even an IP... */ 420 if( src[i] ) 421 return src; 422 423 g_snprintf( dst, sizeof( dst ), "::ffff:%s", src ); 424 425 return dst; 426 } 427 428 /* Unwrap an IPv4 address into IPv6 space. Thread-safe, because it's very simple. :-) */ 429 char *ipv6_unwrap( char *src ) 430 { 431 int i; 432 433 if( g_strncasecmp( src, "::ffff:", 7 ) != 0 ) 434 return src; 435 436 for( i = 7; src[i]; i ++ ) 437 if( ( src[i] < '0' || src[i] > '9' ) && src[i] != '.' ) 438 break; 439 440 /* Hmm, it's not even an IP... */ 441 if( src[i] ) 442 return src; 443 444 return ( src + 7 ); 445 } 446 #endif
Note: See TracChangeset
for help on using the changeset viewer.