]> arthur.barton.de Git - ngircd-alex.git/blob - src/ngircd/irc-op.c
2590f9164bb682ad41656170c9456318a3bb80f8
[ngircd-alex.git] / src / ngircd / irc-op.c
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
4  *
5  * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
6  * der GNU General Public License (GPL), wie von der Free Software Foundation
7  * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
8  * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
9  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
10  * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
11  *
12  * $Id: irc-op.c,v 1.2 2002/06/01 14:39:34 alex Exp $
13  *
14  * irc-op.c: Befehle zur Channel-Verwaltung
15  */
16
17
18 #include "portab.h"
19
20 #include "imp.h"
21 #include <assert.h>
22 #include <string.h>
23 #include <stdio.h>
24
25 #include "conn.h"
26 #include "client.h"
27 #include "channel.h"
28 #include "defines.h"
29 #include "irc-write.h"
30 #include "log.h"
31 #include "messages.h"
32 #include "parse.h"
33
34 #include "exp.h"
35 #include "irc-op.h"
36
37
38 GLOBAL BOOLEAN
39 IRC_KICK( CLIENT *Client, REQUEST *Req )
40 {
41         CLIENT *target, *from;
42         
43         assert( Client != NULL );
44         assert( Req != NULL );
45
46         /* Valider Client? */
47         if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
48
49         /* Falsche Anzahl Parameter? */
50         if(( Req->argc < 2) || ( Req->argc > 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
51
52         if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
53         else from = Client;
54         if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
55         
56         /* Ziel-User suchen */
57         target = Client_Search( Req->argv[1] );
58         if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHNICK_MSG, Client_ID( from ), Req->argv[1] );
59
60         Channel_Kick( target, from, Req->argv[0], Req->argc == 3 ? Req->argv[2] : Client_ID( from ));
61         return CONNECTED;
62 } /* IRC_KICK */        
63
64
65 GLOBAL BOOLEAN
66 IRC_BAN( CLIENT *Client, REQUEST *Req )
67 {
68         assert( Client != NULL );
69         assert( Req != NULL );
70
71         /* Valider Client? */
72         if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
73
74         /* Keine Parameter? */
75         if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
76
77         return CONNECTED;
78 } /* IRC_BAN */ 
79
80
81 GLOBAL BOOLEAN
82 IRC_INVITE( CLIENT *Client, REQUEST *Req )
83 {
84         assert( Client != NULL );
85         assert( Req != NULL );
86
87         /* Valider Client? */
88         if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
89
90         /* Keine Parameter? */
91         if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
92
93         return CONNECTED;
94 } /* IRC_INVITE */
95
96
97 /* -eof- */