1 |
/* Copyright (C) 2003 Stephane Thiell |
2 |
* |
3 |
* This file is part of pxyservd (from pxys) |
4 |
* |
5 |
* This program is free software; you can redistribute it and/or |
6 |
* modify it under the terms of the GNU General Public License |
7 |
* as published by the Free Software Foundation; either version 2 |
8 |
* of the License, or (at your option) any later version. |
9 |
* |
10 |
* This program is distributed in the hope that it will be useful, |
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
* GNU General Public License for more details. |
14 |
* |
15 |
* You should have received a copy of the GNU General Public License |
16 |
* along with this program; if not, write to the Free Software |
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 |
* |
19 |
*/ |
20 |
#define RCSID "$Id: irc_auth.c,v 1.2 2004/01/01 02:13:10 mbuna Exp $" |
21 |
|
22 |
#include "irc_auth.h" |
23 |
#include <assert.h> |
24 |
#include <stdlib.h> |
25 |
#include <time.h> |
26 |
#include <unistd.h> |
27 |
|
28 |
#include "cfgloader.h" |
29 |
#include "irc_client.h" |
30 |
#include "irc_msg.h" |
31 |
#include "irc_send.h" |
32 |
|
33 |
extern time_t gBirthTime; |
34 |
|
35 |
void |
36 |
irc_auth(const char *password) |
37 |
{ |
38 |
assert(gMe.name != NULL); /* I have to be initialized at this point */ |
39 |
|
40 |
send_raw("%s :%s" CRLF, MSG_PASS, password); |
41 |
|
42 |
/* Register as a service server (+s) */ |
43 |
send_raw("%s %s %d %ld %ld J10 %s%s +s :%s" CRLF, MSG_SERVER, |
44 |
gMe.name, 1, gBirthTime, peak_time(), gMe.yy, MYCLIENT_NUM64, |
45 |
gConfig->server.info); |
46 |
|
47 |
irc_client_register(); |
48 |
irc_client_burst(); |
49 |
|
50 |
send_raw("%s %s" CRLF, gMe.yy, TOK_END_OF_BURST); |
51 |
} |
52 |
|
53 |
void |
54 |
irc_auth_finalize() |
55 |
{ |
56 |
irc_client_unregister(); |
57 |
} |