mirror of
https://github.com/irssi/irssi.git
synced 2026-08-09 20:00:23 +02:00
..adding new files..
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@171 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
d01b094151
commit
c95034c6de
206 changed files with 31247 additions and 0 deletions
96
src/fe-common/core/fe-server.c
Normal file
96
src/fe-common/core/fe-server.c
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
fe-server.c : irssi
|
||||
|
||||
Copyright (C) 1999 Timo Sirainen
|
||||
|
||||
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 "module.h"
|
||||
#include "module-formats.h"
|
||||
#include "signals.h"
|
||||
#include "settings.h"
|
||||
#include "network.h"
|
||||
|
||||
#include "levels.h"
|
||||
#include "server.h"
|
||||
|
||||
static void sig_server_looking(SERVER_REC *server)
|
||||
{
|
||||
g_return_if_fail(server != NULL);
|
||||
|
||||
printformat(server, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_LOOKING_UP, server->connrec->address);
|
||||
}
|
||||
|
||||
static void sig_server_connecting(SERVER_REC *server, IPADDR *ip)
|
||||
{
|
||||
char ipaddr[MAX_IP_LEN];
|
||||
|
||||
g_return_if_fail(server != NULL);
|
||||
g_return_if_fail(ip != NULL);
|
||||
|
||||
net_ip2host(ip, ipaddr);
|
||||
printformat(server, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_CONNECTING,
|
||||
server->connrec->address, ipaddr, server->connrec->port);
|
||||
}
|
||||
|
||||
static void sig_server_connected(SERVER_REC *server)
|
||||
{
|
||||
g_return_if_fail(server != NULL);
|
||||
|
||||
printformat(server, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||
IRCTXT_CONNECTION_ESTABLISHED, server->connrec->address);
|
||||
}
|
||||
|
||||
static void sig_connect_failed(SERVER_REC *server, gchar *msg)
|
||||
{
|
||||
g_return_if_fail(server != NULL);
|
||||
|
||||
if (msg == NULL) {
|
||||
/* no message so this wasn't unexpected fail - send
|
||||
connection_lost message instead */
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||
IRCTXT_CONNECTION_LOST, server->connrec->address);
|
||||
} else {
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
|
||||
IRCTXT_CANT_CONNECT, server->connrec->address, server->connrec->port, msg);
|
||||
}
|
||||
}
|
||||
|
||||
static void sig_server_disconnected(SERVER_REC *server)
|
||||
{
|
||||
g_return_if_fail(server != NULL);
|
||||
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||
IRCTXT_CONNECTION_LOST, server->connrec->address);
|
||||
}
|
||||
|
||||
void fe_server_init(void)
|
||||
{
|
||||
signal_add("server looking", (SIGNAL_FUNC) sig_server_looking);
|
||||
signal_add("server connecting", (SIGNAL_FUNC) sig_server_connecting);
|
||||
signal_add("server connected", (SIGNAL_FUNC) sig_server_connected);
|
||||
signal_add("server connect failed", (SIGNAL_FUNC) sig_connect_failed);
|
||||
signal_add("server disconnected", (SIGNAL_FUNC) sig_server_disconnected);
|
||||
}
|
||||
|
||||
void fe_server_deinit(void)
|
||||
{
|
||||
signal_remove("server looking", (SIGNAL_FUNC) sig_server_looking);
|
||||
signal_remove("server connecting", (SIGNAL_FUNC) sig_server_connecting);
|
||||
signal_remove("server connected", (SIGNAL_FUNC) sig_server_connected);
|
||||
signal_remove("server connect failed", (SIGNAL_FUNC) sig_connect_failed);
|
||||
signal_remove("server disconnected", (SIGNAL_FUNC) sig_server_disconnected);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue