-#define CONNECTED TRUE
-#define DISCONNECTED FALSE
-
-
-LOCAL BOOLEAN Hello_User( CLIENT *Client );
-LOCAL BOOLEAN Show_MOTD( CLIENT *Client );
-
-
-GLOBAL VOID IRC_Init( VOID )
-{
-} /* IRC_Init */
-
-
-GLOBAL VOID IRC_Exit( VOID )
-{
-} /* IRC_Exit */
-
-
-GLOBAL BOOLEAN IRC_WriteStrClient( CLIENT *Client, CLIENT *Prefix, CHAR *Format, ... )
-{
- /* Text an Clients, lokal bzw. remote, senden. */
-
- CHAR buffer[1000];
- BOOLEAN ok = CONNECTED;
- CONN_ID send_to;
- va_list ap;
-
- assert( Client != NULL );
- assert( Format != NULL );
-
- va_start( ap, Format );
- vsnprintf( buffer, 1000, Format, ap );
- va_end( ap );
-
- if( Client->conn_id != NONE ) send_to = Client->conn_id;
- else send_to = Client->introducer->conn_id;
-
- if( Prefix ) ok = Conn_WriteStr( Client->conn_id, ":%s %s", Client_GetID( Prefix ), buffer );
- else ok = Conn_WriteStr( Client->conn_id, buffer );
-
- return ok;
-} /* IRC_WriteStrClient */
-
-
-GLOBAL BOOLEAN IRC_WriteStrRelated( CLIENT *Client, CHAR *Format, ... )
-{
- CHAR buffer[1000];
- BOOLEAN ok = CONNECTED;
- va_list ap;
-
- assert( Client != NULL );
- assert( Format != NULL );
-
- va_start( ap, Format );
- vsnprintf( buffer, 1000, Format, ap );
- va_end( ap );
-
- /* an den Client selber */
- ok = IRC_WriteStrClient( Client, Client, buffer );
-
- return ok;
-} /* IRC_WriteStrRelated */
-
-
-GLOBAL BOOLEAN IRC_PASS( CLIENT *Client, REQUEST *Req )
-{
- assert( Client != NULL );
- assert( Req != NULL );
-
- /* Fehler liefern, wenn kein lokaler Client */
- if( Client->conn_id <= NONE ) return IRC_WriteStrClient( Client, This_Server, ERR_UNKNOWNCOMMAND_MSG, Client_Nick( Client ), Req->command );
-
- if(( Client->type == CLIENT_UNKNOWN ) && ( Req->argc == 1))
- {
- /* noch nicht registrierte unbekannte Verbindung */
- Log( LOG_DEBUG, "Connection %d: got PASS command ...", Client->conn_id );
-
- /* Passwort speichern */
- strncpy( Client->pass, Req->argv[0], CLIENT_PASS_LEN );
- Client->pass[CLIENT_PASS_LEN - 1] = '\0';
-
- Client->type = CLIENT_GOTPASS;
- return CONNECTED;
- }
- else if((( Client->type == CLIENT_UNKNOWN ) || ( Client->type == CLIENT_UNKNOWNSERVER )) && (( Req->argc == 3 ) || ( Req->argc == 4 )))
- {
- /* noch nicht registrierte Server-Verbindung */
- Log( LOG_DEBUG, "Connection %d: got PASS command (new server link) ...", Client->conn_id );
-
- /* Passwort speichern */
- strncpy( Client->pass, Req->argv[0], CLIENT_PASS_LEN );
- Client->pass[CLIENT_PASS_LEN - 1] = '\0';
-
- Client->type = CLIENT_GOTPASSSERVER;
- return CONNECTED;
- }
- else if(( Client->type == CLIENT_UNKNOWN ) || ( Client->type == CLIENT_UNKNOWNSERVER ))
- {
- /* Falsche Anzahl Parameter? */
- return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Nick( Client ), Req->command );
- }
- else return IRC_WriteStrClient( Client, This_Server, ERR_ALREADYREGISTRED_MSG, Client_Nick( Client ));
-} /* IRC_PASS */
-
-
-GLOBAL BOOLEAN IRC_SERVER( CLIENT *Client, REQUEST *Req )
-{
- assert( Client != NULL );
- assert( Req != NULL );
-
- /* Fehler liefern, wenn kein lokaler Client */
- if( Client->conn_id <= NONE ) return IRC_WriteStrClient( Client, This_Server, ERR_UNKNOWNCOMMAND_MSG, Client_Nick( Client ), Req->command );
-
- if( Client->type == CLIENT_GOTPASSSERVER )
- {
- /* Verbindung soll als Server-Server-Verbindung registriert werden */
- Log( LOG_DEBUG, "Connection %d: got SERVER command (new server link) ...", Client->conn_id );
-
- /* Falsche Anzahl Parameter? */
- if( Req->argc != 3 ) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Nick( Client ), Req->command );
-
- /* Ist ein Server mit dieser ID bereits registriert? */
- if( ! Client_CheckID( Client, Req->argv[0] )) return DISCONNECTED;
-
- /* Server-Strukturen fuellen ;-) */
- strncpy( Client->nick, Req->argv[0], CLIENT_ID_LEN );
- Client->nick[CLIENT_ID_LEN - 1] = '\0';
- strncpy( Client->info, Req->argv[2], CLIENT_INFO_LEN );
- Client->info[CLIENT_INFO_LEN - 1] = '\0';
-
- Log( LOG_NOTICE, "Server \"%s\" (%s) registered (connection %d).", Client->nick, Client->info, Client->conn_id );
-
- Client->type = CLIENT_SERVER;
- return CONNECTED;
- }
- else if( Client->type == CLIENT_SERVER )
- {
- /* Neuer Server wird im Netz angekuendigt */
- return CONNECTED;
- }
- else return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Nick( Client ), Req->command );
-} /* IRC_SERVER */