Improve error reporting from the curses wrapper
[centerim5.git] / src / Connections.h
blobbcb3fdc2286ba949d6817f13ad5a97e226f55a00
1 // Copyright (C) 2007 Mark Pustjens <pustjens@dds.nl>
2 // Copyright (C) 2010-2015 Petr Pavlu <setup@dagobah.cz>
3 //
4 // This file is part of CenterIM.
5 //
6 // CenterIM is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // CenterIM is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef CONNECTIONS_H
20 #define CONNECTIONS_H
22 #include <cppconsui/CppConsUI.h>
23 #include <libpurple/purple.h>
25 #define CONNECTIONS (Connections::instance())
27 class Connections {
28 public:
29 static Connections *instance();
31 private:
32 PurpleConnectionUiOps centerim_connection_ui_ops;
34 static Connections *my_instance_;
36 Connections();
37 ~Connections();
38 CONSUI_DISABLE_COPY(Connections);
40 static void init();
41 static void finalize();
42 friend class CenterIM;
44 void reconnectAccount(PurpleAccount *account);
46 static void connect_progress_(
47 PurpleConnection *gc, const char *text, size_t step, size_t step_count)
49 CONNECTIONS->connect_progress(gc, text, step, step_count);
51 static void connected_(PurpleConnection *gc) { CONNECTIONS->connected(gc); }
52 static void disconnected_(PurpleConnection *gc)
54 CONNECTIONS->disconnected(gc);
56 static void notice_(PurpleConnection *gc, const char *text)
58 CONNECTIONS->notice(gc, text);
60 static void network_connected_() { CONNECTIONS->network_connected(); }
61 static void network_disconnected_() { CONNECTIONS->network_disconnected(); }
62 static void report_disconnect_reason_(
63 PurpleConnection *gc, PurpleConnectionError reason, const char *text)
65 CONNECTIONS->report_disconnect_reason(gc, reason, text);
68 void connect_progress(
69 PurpleConnection *gc, const char *text, size_t step, size_t step_count);
70 void connected(PurpleConnection *gc);
71 void disconnected(PurpleConnection *gc);
72 void notice(PurpleConnection *gc, const char *text);
73 void network_connected();
74 void network_disconnected();
75 void report_disconnect_reason(
76 PurpleConnection *gc, PurpleConnectionError reason, const char *text);
79 #endif // CONNECTIONS_H
81 // vim: set tabstop=2 shiftwidth=2 textwidth=80 expandtab: