/********************************************************************\ * BitlBee -- An IRC to other IM-networks gateway * * * * Copyright 2002-2012 Wilmer van der Gaast and others * \********************************************************************/ /* IRC commands */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BITLBEE_CORE #include "bitlbee.h" #include "help.h" #include "ipc.h" static void irc_cmd_pass( irc_t *irc, char **cmd ) { if( irc->status & USTATUS_LOGGED_IN ) { char *send_cmd[] = { "identify", cmd[1], NULL }; /* We're already logged in, this client seems to send the PASS command last. (Possibly it won't send it at all if it turns out we don't require it, which will break this feature.) Try to identify using the given password. */ root_command( irc, send_cmd ); return; } /* Handling in pre-logged-in state, first see if this server is password-protected: */ else if( global.conf->auth_pass && ( strncmp( global.conf->auth_pass, "md5:", 4 ) == 0 ? md5_verify_password( cmd[1], global.conf->auth_pass + 4 ) == 0 : strcmp( cmd[1], global.conf->auth_pass ) == 0 ) ) { irc->status |= USTATUS_AUTHORIZED; irc_check_login( irc ); } else if( global.conf->auth_pass ) { irc_send_num( irc, 464, ":Incorrect password" ); } else { /* Remember the password and try to identify after USER/NICK. */ irc_setpass( irc, cmd[1] ); irc_check_login( irc ); } } static void irc_cmd_user( irc_t *irc, char **cmd ) { irc->user->user = g_strdup( cmd[1] ); irc->user->fullname = g_strdup( cmd[4] ); irc_check_login( irc ); } static void irc_cmd_nick( irc_t *irc, char **cmd ) { irc_user_t *iu; if( ( iu = irc_user_by_name( irc, cmd[1] ) ) && iu != irc->user ) { irc_send_num( irc, 433, "%s :This nick is already in use", cmd[1] ); } else if( !nick_ok( NULL, cmd[1] ) ) { /* [SH] Invalid characters. */ irc_send_num( irc, 432, "%s :This nick contains invalid characters", cmd[1] ); } else if( irc->status & USTATUS_LOGGED_IN ) { /* WATCH OUT: iu from the first if reused here to check if the new nickname is the same (other than case, possibly). If it is, no need to reset identify-status. */ if( ( irc->status & USTATUS_IDENTIFIED ) && iu != irc->user ) { irc_setpass( irc, NULL ); irc->status &= ~USTATUS_IDENTIFIED; irc_umode_set( irc, "-R", 1 ); irc_rootmsg( irc, "Changing nicks resets your identify status. " "Re-identify or register a new account if you want " "your configuration to be saved. See \x02help " "nick_changes\x02." ); } if( strcmp( cmd[1], irc->user->nick ) != 0 ) irc_user_set_nick( irc->user, cmd[1] ); } else { g_free( irc->user->nick ); irc->user->nick = g_strdup( cmd[1] ); irc_check_login( irc ); } } static void irc_cmd_quit( irc_t *irc, char **cmd ) { if( cmd[1] && *cmd[1] ) irc_abort( irc, 0, "Quit: %s", cmd[1] ); else irc_abort( irc, 0, "Leaving..." ); } static void irc_cmd_ping( irc_t *irc, char **cmd ) { irc_write( irc, ":%s PONG %s :%s", irc->root->host, irc->root->host, cmd[1]?cmd[1]:irc->root->host ); } static void irc_cmd_pong( irc_t *irc, char **cmd ) { /* We could check the value we get back from the user, but in fact we don't care, we're just happy s/he's still alive. */ irc->last_pong = gettime(); irc->pinging = 0; } static void irc_cmd_join( irc_t *irc, char **cmd ) { char *comma, *s = cmd[1]; while( s ) { irc_channel_t *ic; if( ( comma = strchr( s, ',' ) ) ) *comma = '\0'; if( ( ic = irc_channel_by_name( irc, s ) ) == NULL && ( ic = irc_channel_new( irc, s ) ) ) { if( strcmp( set_getstr( &ic->set, "type" ), "control" ) != 0 ) { /* Autoconfiguration is for control channels only ATM. */ } else if( bee_group_by_name( ic->irc->b, ic->name + 1, FALSE ) ) { set_setstr( &ic->set, "group", ic->name +
#ifndef __OSCAR_INFO_H__
#define __OSCAR_INFO_H__
#define AIM_CB_FAM_LOC 0x0002
/*
* SNAC Family: Location Services.
*/
#define AIM_CB_LOC_ERROR 0x0001
#define AIM_CB_LOC_REQRIGHTS 0x0002
#define AIM_CB_LOC_RIGHTSINFO 0x0003
#define AIM_CB_LOC_SETUSERINFO 0x0004
#define AIM_CB_LOC_REQUSERINFO 0x0005
#define AIM_CB_LOC_USERINFO 0x0006
#define AIM_CB_LOC_WATCHERSUBREQ 0x0007
#define AIM_CB_LOC_WATCHERNOT 0x0008
#define AIM_CB_LOC_DEFAULT 0xffff
#define AIM_CAPS_BUDDYICON 0x00000001
#define AIM_CAPS_VOICE 0x00000002
#define AIM_CAPS_IMIMAGE 0x00000004
#define AIM_CAPS_CHAT 0x00000008
#define AIM_CAPS_GETFILE 0x00000010
#define AIM_CAPS_SENDFILE 0x00000020
#define AIM_CAPS_GAMES 0x00000040
#define AIM_CAPS_SAVESTOCKS 0x00000080
#define AIM_CAPS_SENDBUDDYLIST 0x00000100
#define AIM_CAPS_GAMES2 0x00000200
#define AIM_CAPS_ICQ 0x00000400
#define AIM_CAPS_APINFO 0x00000800
#define AIM_CAPS_ICQRTF 0x00001000
#define AIM_CAPS_EMPTY 0x00002000
#define AIM_CAPS_ICQSERVERRELAY 0x00004000
#define AIM_CAPS_ICQUNKNOWN 0x00008000
#define AIM_CAPS_TRILLIANCRYPT 0x00010000
#define AIM_CAPS_UTF8 0x00020000
#define AIM_CAPS_INTEROP 0x00040000
#define AIM_CAPS_ICHAT 0x00080000
#define AIM_CAPS_EXTCHAN2 0x00100000
#define AIM_CAPS_LAST 0x00200000
int aim_0002_000b(aim_session_t *sess, aim_conn_t *conn, const char *sn);
#endif /* __OSCAR_INFO_H__ */