Documentation files
[cascardo/rnetproxy.git] / jabber_server.c
1 /*
2 ** Copyright (C) 2006 Thadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
3 **  
4 ** This program is free software; you can redistribute it and/or modify
5 ** it under the terms of the GNU General Public License as published by
6 ** the Free Software Foundation; either version 2 of the License, or
7 ** (at your option) any later version.
8 **  
9 ** This program is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 ** GNU General Public License for more details.
13 **  
14 ** You should have received a copy of the GNU General Public License
15 ** along with this program; if not, write to the Free Software
16 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 **  
18 */
19
20 #include <gnet.h>
21 #include <glib.h>
22 #include <iksemel.h>
23 #include "jabber.h"
24
25 static void jabber_server_connect (net_hook_t* hook)
26 {
27   g_message ("Connected to jabber server.");
28 }
29
30 static void jabber_server_close (net_hook_t* hook)
31 {
32   g_message ("Server disconnected.");
33 }
34
35 static void jabber_server_write (net_hook_t* hook)
36 {
37 }
38
39 static void jabber_server_read (net_hook_t* hook, gchar* buffer, size_t len)
40 {
41   gnet_conn_write (hook->peer, buffer, len);
42 }
43
44 net_hook_t* jabber_server_hook_new (net_hook_t* client_hook, char* server)
45 {
46   net_hook_t* hook;
47   hook = g_slice_new (net_hook_t);
48   hook->conn = gnet_conn_new (server, 5222, nethook_event, hook);
49   hook->peer = client_hook->conn;
50   hook->server = TRUE;
51   hook->connect = jabber_server_connect;
52   hook->close = jabber_server_close;
53   hook->write = jabber_server_write;
54   hook->read = jabber_server_read;
55   hook->data = NULL; /*iks_stream_new ("jabber:client", hook, jabber_server_parser);*/
56   return hook;
57 }