-/*
-** Copyright (C) 2006 Thadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
-** Copyright (C) 2009 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
-**
-** 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
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-**
-*/
-
-#include <glib.h>
-#include "null.h"
-
-static void
-null_connect (net_hook_t *hook)
-{
-}
-
-static void
-null_close (net_hook_t *hook)
-{
- if (hook->peer)
- {
- hook->peer->peer = NULL;
- hc_conn_close (hook->peer->conn);
- }
- hc_conn_close (hook->conn);
- g_slice_free (net_hook_t, hook);
-}
-
-static void
-null_read (net_hook_t *hook, gchar *buffer, size_t len)
-{
- hc_conn_write (hook->peer->conn, buffer, len);
-}
-
-static void
-null_error (net_hook_t *hook)
-{
- g_message ("Error in POP3 client connection.");
-}
-
-static net_hook_t *
-null_server_hook_new (net_hook_t *client_hook, char *server, char *port)
-{
- net_hook_t *hook;
- int fd;
- HCConn *conn;
- hook = g_slice_new (net_hook_t);
- hook->peer = client_hook;
- hook->server = TRUE;
- hook->connect = null_connect;
- hook->close = null_close;
- hook->read = null_read;
- hook->data = NULL;
- conn = hc_conn_new (NULL, NULL);
- hook->conn = hc_conn_new (nethook_event, hook);
- fd = hc_tcp_connect (server, port);
- hc_conn_set_driver_channel (conn, fd);
- hc_conn_set_driver_ssl (hook->conn, conn);
- return hook;
-}
-
-net_hook_t *
-null_hook_new (HCConn *conn, char *server, char *port)
-{
- net_hook_t *hook;
- hook = g_slice_new (net_hook_t);
- hook->conn = conn;
- hook->peer = NULL;
- hook->server = FALSE;
- hook->connect = null_connect;
- hook->close = null_close;
- hook->read = null_read;
- hook->data = server;
- hook->peer = null_server_hook_new (hook, server, port);
- hc_conn_set_callback (hook->conn, nethook_event, hook);
- return hook;
-}
-
-void
-null_destroy (net_hook_t *hook)
-{
- g_slice_free (net_hook_t, hook);
-}