annotate plugins/autorecon.c @ 11256:bb0d7b719af2

[gaim-migrate @ 13430] I give you regex filtering in the debug window. We keep a buffer of all the text, so when unpausing all the messages that were output when paused will be displayed, as well as when you change the filter. This _should_ be alright on systems that don't have regex.h but I haven't gotten anyone to test it recently, if it's busted, just #ifdef HAVE_REGEX_H it. committer: Tailor Script <tailor@pidgin.im>
author Gary Kramlich <grim@reaperworld.com>
date Sat, 13 Aug 2005 22:09:34 +0000
parents 50224ac8184d
children a32bf50ee5d1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5607
diff changeset
1 #include "internal.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5607
diff changeset
2
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5607
diff changeset
3 #include "connection.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5607
diff changeset
4 #include "debug.h"
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
5 #include "pluginpref.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5607
diff changeset
6 #include "prpl.h"
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
7 #include "signals.h"
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9930
diff changeset
8 #include "version.h"
4202
59751fe608c5 [gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents: 4113
diff changeset
9
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
10
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
11 #define AUTORECON_PLUGIN_ID "core-autorecon"
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
12
2216
66783ad29e55 [gaim-migrate @ 2226]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1818
diff changeset
13 #define INITIAL 8000
4590
3b8e6c2b4a50 [gaim-migrate @ 4874]
Luke Schierer <lschiere@pidgin.im>
parents: 4585
diff changeset
14 #define MAXTIME 2048000
2216
66783ad29e55 [gaim-migrate @ 2226]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1818
diff changeset
15
6113
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
16 typedef struct {
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
17 int delay;
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
18 guint timeout;
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
19 } GaimAutoRecon;
2216
66783ad29e55 [gaim-migrate @ 2226]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1818
diff changeset
20
6113
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
21 static GHashTable *hash = NULL;
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
22
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
23 static GSList *accountReconnecting = NULL;
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
24
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
25 #define AUTORECON_OPT "/plugins/core/autorecon"
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
26 #define OPT_HIDE_CONNECTED AUTORECON_OPT "/hide_connected_error"
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
27 #define OPT_HIDE_CONNECTING AUTORECON_OPT "/hide_connecting_error"
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
28 #define OPT_RESTORE_STATE AUTORECON_OPT "/restore_state"
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
29 #define OPT_HIDE_RECONNECTING_DIALOG AUTORECON_OPT "/hide_reconnecting_dialog"
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
30
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
31 /* storage of original (old_ops) and modified (new_ops) ui ops to allow us to
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
32 intercept calls to report_disconnect */
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
33 static GaimConnectionUiOps *old_ops = NULL;
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
34 static GaimConnectionUiOps *new_ops = NULL;
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
35
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
36 static void
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
37 connect_progress(GaimConnection *gc, const char *text,
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
38 size_t step, size_t step_count)
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
39 {
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
40 if (old_ops == NULL || old_ops->connect_progress == NULL) {
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
41 /* there's nothing to call through to, so don't bother
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
42 checking prefs */
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
43 return;
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
44 } else if (gaim_prefs_get_bool(OPT_HIDE_RECONNECTING_DIALOG) && accountReconnecting &&
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
45 g_slist_find(accountReconnecting, gc->account)) {
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
46 /* this is a reconnecting, and we're hiding those */
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
47 gaim_debug(GAIM_DEBUG_INFO, "autorecon",
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
48 "hide connecting dialog while reconnecting\n");
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
49 return;
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
50 }
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
51
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
52 old_ops->connect_progress(gc, text, step, step_count);
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
53 }
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
54
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
55 static void
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
56 connected(GaimConnection *gc)
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
57 {
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
58 if (old_ops == NULL || old_ops->connected == NULL) {
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
59 /* there's nothing to call through to, so don't bother
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
60 checking prefs */
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
61 return;
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
62 } else if (gaim_prefs_get_bool(OPT_HIDE_RECONNECTING_DIALOG) && accountReconnecting &&
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
63 g_slist_find(accountReconnecting, gc->account)) {
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
64 /* this is a reconnecting, and we're hiding those */
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
65 gaim_debug(GAIM_DEBUG_INFO, "autorecon",
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
66 "hide connecting dialog while reconnecting\n");
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
67 return;
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
68 }
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
69
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
70 old_ops->connected(gc);
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
71 }
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
72
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
73 static void
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
74 disconnected(GaimConnection *gc)
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
75 {
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
76 if (old_ops == NULL || old_ops->disconnected == NULL) {
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
77 /* there's nothing to call through to, so don't bother
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
78 checking prefs */
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
79 return;
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
80 } else if (gaim_prefs_get_bool(OPT_HIDE_RECONNECTING_DIALOG) && accountReconnecting &&
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
81 g_slist_find(accountReconnecting, gc->account)) {
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
82 /* this is a reconnecting, and we're hiding those */
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
83 gaim_debug(GAIM_DEBUG_INFO, "autorecon",
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
84 "hide connecting dialog while reconnecting\n");
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
85 return;
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
86 }
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
87
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
88 old_ops->disconnected(gc);
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
89 }
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
90
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
91 static void
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
92 notice(GaimConnection *gc, const char *text)
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
93 {
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
94 if (old_ops == NULL || old_ops->notice == NULL) {
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
95 /* there's nothing to call through to, so don't bother
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
96 checking prefs */
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
97 return;
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
98 } else if (gaim_prefs_get_bool(OPT_HIDE_RECONNECTING_DIALOG) && accountReconnecting &&
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
99 g_slist_find(accountReconnecting, gc->account)) {
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
100 /* this is a reconnecting, and we're hiding those */
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
101 gaim_debug(GAIM_DEBUG_INFO, "autorecon",
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
102 "hide connecting dialog while reconnecting\n");
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
103 }
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
104
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
105 old_ops->notice(gc, text);
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
106 }
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
107
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
108 static void
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
109 report_disconnect(GaimConnection *gc, const char *text)
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
110 {
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
111 if (old_ops == NULL || old_ops->report_disconnect == NULL) {
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
112 /* there's nothing to call through to, so don't bother
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
113 checking prefs */
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
114 return;
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
115
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
116 } else if (gc->state == GAIM_CONNECTED
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
117 && gaim_prefs_get_bool(OPT_HIDE_CONNECTED)) {
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
118 /* this is a connected error, and we're hiding those */
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
119 gaim_debug(GAIM_DEBUG_INFO, "autorecon",
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10020
diff changeset
120 "hid disconnect error message (%s)\n", text);
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
121 return;
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
122
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
123 } else if (gc->state == GAIM_CONNECTING
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
124 && gaim_prefs_get_bool(OPT_HIDE_CONNECTING)) {
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
125 /* this is a connecting error, and we're hiding those */
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
126 gaim_debug(GAIM_DEBUG_INFO, "autorecon",
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10020
diff changeset
127 "hid error message while connecting (%s)\n", text);
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
128 return;
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
129 }
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
130
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
131 /* if we haven't returned by now, then let's pass to the real
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
132 function */
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
133 old_ops->report_disconnect(gc, text);
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
134 }
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
135
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
136
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
137 static gboolean
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
138 do_signon(gpointer data)
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
139 {
5587
1c55b1540e18 [gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents: 5227
diff changeset
140 GaimAccount *account = data;
6113
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
141 GaimAutoRecon *info;
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
142
5227
6d1707dc8c3d [gaim-migrate @ 5597]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
143 gaim_debug(GAIM_DEBUG_INFO, "autorecon", "do_signon called\n");
6113
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
144 g_return_val_if_fail(account != NULL, FALSE);
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
145 info = g_hash_table_lookup(hash, account);
4494
b5a50a6a13b0 [gaim-migrate @ 4769]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4491
diff changeset
146
5607
eeba9205dd0f [gaim-migrate @ 6011]
Nathan Walp <nwalp@pidgin.im>
parents: 5587
diff changeset
147 if (g_list_index(gaim_accounts_get_all(), account) < 0)
1817
b367beee6448 [gaim-migrate @ 1827]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1404
diff changeset
148 return FALSE;
6113
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
149
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
150 if (info)
7372
4ce6952d7908 [gaim-migrate @ 7967]
Nathan Walp <nwalp@pidgin.im>
parents: 7112
diff changeset
151 info->timeout = 0;
4ce6952d7908 [gaim-migrate @ 7967]
Nathan Walp <nwalp@pidgin.im>
parents: 7112
diff changeset
152
5587
1c55b1540e18 [gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents: 5227
diff changeset
153 gaim_debug(GAIM_DEBUG_INFO, "autorecon", "calling gaim_account_connect\n");
10738
55af3fa46329 [gaim-migrate @ 12340]
Mark Doliner <mark@kingant.net>
parents: 10574
diff changeset
154 gaim_account_connect(account);
5587
1c55b1540e18 [gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents: 5227
diff changeset
155 gaim_debug(GAIM_DEBUG_INFO, "autorecon", "done calling gaim_account_connect\n");
6113
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
156
1817
b367beee6448 [gaim-migrate @ 1827]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1404
diff changeset
157 return FALSE;
1378
aedeb1218a0a [gaim-migrate @ 1388]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1165
diff changeset
158 }
aedeb1218a0a [gaim-migrate @ 1388]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1165
diff changeset
159
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
160
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
161 static void
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
162 reconnect(GaimConnection *gc, void *m)
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
163 {
6113
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
164 GaimAccount *account;
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
165 GaimAutoRecon *info;
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
166 GSList* listAccount;
6113
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
167
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
168 g_return_if_fail(gc != NULL);
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
169 account = gaim_connection_get_account(gc);
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
170 info = g_hash_table_lookup(hash, account);
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
171 if (accountReconnecting)
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
172 listAccount = g_slist_find(accountReconnecting, account);
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
173 else
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
174 listAccount = NULL;
6113
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
175
2216
66783ad29e55 [gaim-migrate @ 2226]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1818
diff changeset
176 if (!gc->wants_to_die) {
6113
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
177 if (info == NULL) {
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
178 info = g_new0(GaimAutoRecon, 1);
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
179 g_hash_table_insert(hash, account, info);
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
180 info->delay = INITIAL;
8249
b51ed4506180 [gaim-migrate @ 8972]
Mark Doliner <mark@kingant.net>
parents: 8246
diff changeset
181 } else {
6113
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
182 info->delay = MIN(2 * info->delay, MAXTIME);
8250
b248c1f4efbd [gaim-migrate @ 8973]
Mark Doliner <mark@kingant.net>
parents: 8249
diff changeset
183 if (info->timeout != 0)
b248c1f4efbd [gaim-migrate @ 8973]
Mark Doliner <mark@kingant.net>
parents: 8249
diff changeset
184 g_source_remove(info->timeout);
8249
b51ed4506180 [gaim-migrate @ 8972]
Mark Doliner <mark@kingant.net>
parents: 8246
diff changeset
185 }
6113
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
186 info->timeout = g_timeout_add(info->delay, do_signon, account);
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
187
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
188 if (!listAccount)
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
189 accountReconnecting = g_slist_prepend(accountReconnecting, account);
6113
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
190 } else if (info != NULL) {
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
191 g_hash_table_remove(hash, account);
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
192
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
193 if (listAccount)
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
194 accountReconnecting = g_slist_delete_link(accountReconnecting, listAccount);
2216
66783ad29e55 [gaim-migrate @ 2226]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1818
diff changeset
195 }
9546
ebbe4390f75b [gaim-migrate @ 10375]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
196 }
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
197
6113
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
198 static void
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
199 reconnected(GaimConnection *gc, void *m)
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
200 {
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
201 GaimAccount *account;
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
202
10574
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10401
diff changeset
203 g_return_if_fail(gc != NULL);
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10401
diff changeset
204
10942
77cb56ff14e1 [gaim-migrate @ 12733]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10757
diff changeset
205 account = gaim_connection_get_account(gc);
77cb56ff14e1 [gaim-migrate @ 12733]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10757
diff changeset
206
77cb56ff14e1 [gaim-migrate @ 12733]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10757
diff changeset
207 g_hash_table_remove(hash, account);
77cb56ff14e1 [gaim-migrate @ 12733]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10757
diff changeset
208
10574
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10401
diff changeset
209 if (accountReconnecting == NULL)
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10401
diff changeset
210 return;
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10401
diff changeset
211
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
212 accountReconnecting = g_slist_remove(accountReconnecting, account);
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
213 }
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
214
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
215 static void
6113
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
216 free_auto_recon(gpointer data)
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
217 {
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
218 GaimAutoRecon *info = data;
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
219
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
220 if (info->timeout != 0)
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
221 g_source_remove(info->timeout);
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
222
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
223 g_free(info);
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
224 }
30d4c432101c [gaim-migrate @ 6575]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
225
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
226
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
227 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
228 plugin_load(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
229 {
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
230 /* this was the suggested way to override a single function of the
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
231 real ui ops. However, there's a mild concern of having more than one
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
232 bit of code making a new ui op call-through copy. If plugins A and B
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
233 both override the ui ops (in that order), B thinks that the
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
234 overridden ui ops A created was the original. If A unloads first,
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
235 and swaps out and frees its overridden version, then B is calling
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
236 through to a free'd ui op. There needs to be a way to "stack up"
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
237 overridden ui ops or something... I have a good idea of how to write
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
238 such a creature if someone wants it done. - siege 2004-04-20 */
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
239
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
240 /* get old ops, make a copy with a minor change */
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
241 old_ops = gaim_connections_get_ui_ops();
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
242 new_ops = (GaimConnectionUiOps *) g_memdup(old_ops,
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
243 sizeof(GaimConnectionUiOps));
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
244 new_ops->connect_progress = connect_progress;
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
245 new_ops->connected = connected;
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
246 new_ops->disconnected = disconnected;
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
247 new_ops->notice = notice;
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
248 new_ops->report_disconnect = report_disconnect;
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
249 gaim_connections_set_ui_ops(new_ops);
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
250
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
251 hash = g_hash_table_new_full(g_int_hash, g_int_equal, NULL,
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
252 free_auto_recon);
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
253
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
254 accountReconnecting = NULL;
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 2398
diff changeset
255
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
256 gaim_signal_connect(gaim_connections_get_handle(), "signed-off",
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
257 plugin, GAIM_CALLBACK(reconnect), NULL);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
258
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
259 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
260 plugin, GAIM_CALLBACK(reconnected), NULL);
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
261
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
262 return TRUE;
3802
9bcb42faccc0 [gaim-migrate @ 3945]
Sean Egan <seanegan@gmail.com>
parents: 3630
diff changeset
263 }
9bcb42faccc0 [gaim-migrate @ 3945]
Sean Egan <seanegan@gmail.com>
parents: 3630
diff changeset
264
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
265
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
266 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
267 plugin_unload(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
268 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
269 g_hash_table_destroy(hash);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
270 hash = NULL;
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
271
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
272 if (accountReconnecting) {
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
273 g_slist_free(accountReconnecting);
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
274 accountReconnecting = NULL;
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
275 }
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
276
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
277 gaim_connections_set_ui_ops(old_ops);
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
278 g_free(new_ops);
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
279 old_ops = new_ops = NULL;
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
280
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
281 return TRUE;
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 2398
diff changeset
282 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 2398
diff changeset
283
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
284
10748
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
285 static
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
286 GaimPluginPrefFrame *get_plugin_pref_frame(GaimPlugin *plugin)
8d19e10c187f [gaim-migrate @ 12350]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
287 {
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
288 GaimPluginPrefFrame *frame = gaim_plugin_pref_frame_new();
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
289 GaimPluginPref *pref;
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
290
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
291 pref = gaim_plugin_pref_new_with_label(_("Error Message Suppression"));
9549
d80ed3ba45a4 [gaim-migrate @ 10378]
Luke Schierer <lschiere@pidgin.im>
parents: 9546
diff changeset
292 gaim_plugin_pref_frame_add(frame, pref);
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
293
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
294 pref = gaim_plugin_pref_new_with_name_and_label(OPT_HIDE_CONNECTED,
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
295 _("Hide Disconnect Errors"));
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
296 gaim_plugin_pref_frame_add(frame, pref);
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
297
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
298 pref = gaim_plugin_pref_new_with_name_and_label(OPT_HIDE_CONNECTING,
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
299 _("Hide Login Errors"));
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
300 gaim_plugin_pref_frame_add(frame, pref);
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
301
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
302 pref = gaim_plugin_pref_new_with_name_and_label(OPT_HIDE_RECONNECTING_DIALOG,
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
303 _("Hide Reconnecting Dialog"));
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
304 gaim_plugin_pref_frame_add(frame, pref);
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
305
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
306 return frame;
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
307 }
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
308
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
309
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
310 static GaimPluginUiInfo pref_info = {
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
311 get_plugin_pref_frame
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
312 };
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
313
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
314
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
315 static GaimPluginInfo info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
316 {
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9930
diff changeset
317 GAIM_PLUGIN_MAGIC,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9930
diff changeset
318 GAIM_MAJOR_VERSION,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9930
diff changeset
319 GAIM_MINOR_VERSION,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
320 GAIM_PLUGIN_STANDARD, /**< type */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
321 NULL, /**< ui_requirement */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
322 0, /**< flags */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
323 NULL, /**< dependencies */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
324 GAIM_PRIORITY_DEFAULT, /**< priority */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
325
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
326 AUTORECON_PLUGIN_ID, /**< id */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
327 N_("Auto-Reconnect"), /**< name */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
328 VERSION, /**< version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
329 /** summary */
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
330 N_("When you are kicked offline, this reconnects you."),
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
331 /** description */
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
332 N_("When you are kicked offline, this reconnects you."),
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
333 "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
334 GAIM_WEBSITE, /**< homepage */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
335
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
336 plugin_load, /**< load */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
337 plugin_unload, /**< unload */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
338 NULL, /**< destroy */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
339
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
340 NULL, /**< ui_info */
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
341 NULL, /**< extra_info */
8993
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8774
diff changeset
342 &pref_info, /**< prefs_info */
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8774
diff changeset
343 NULL
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
344 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
345
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
346
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
347 static void
5920
7d385de2f9cd [gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents: 5873
diff changeset
348 init_plugin(GaimPlugin *plugin)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4590
diff changeset
349 {
8774
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
350 gaim_prefs_add_none(AUTORECON_OPT);
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
351 gaim_prefs_add_bool(OPT_HIDE_CONNECTED, FALSE);
5205743477bb [gaim-migrate @ 9536]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
352 gaim_prefs_add_bool(OPT_HIDE_CONNECTING, FALSE);
10020
c06c4a697b31 [gaim-migrate @ 10944]
Luke Schierer <lschiere@pidgin.im>
parents: 9971
diff changeset
353 gaim_prefs_add_bool(OPT_HIDE_RECONNECTING_DIALOG, FALSE);
9971
ab5db2c5da79 [gaim-migrate @ 10882]
Mark Doliner <mark@kingant.net>
parents: 9961
diff changeset
354 gaim_prefs_remove(OPT_RESTORE_STATE);
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 2398
diff changeset
355 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 2398
diff changeset
356
6063
5239a3b4ab33 [gaim-migrate @ 6513]
Nathan Walp <nwalp@pidgin.im>
parents: 5920
diff changeset
357 GAIM_INIT_PLUGIN(autorecon, init_plugin, info)