Mercurial > pidgin.yaz
annotate console/gntconn.c @ 14089:10e8eb6a4910
[gaim-migrate @ 16712]
Pretty large commit here. Basically I got sick of having to verify
that gc is still valid on all the callback functions for
gaim_proxy_connect(). The fix for this for gaim_proxy_connect() to
return something that allows the connection attempt to be canceled.
It's not quite there yet, but this is a good first step. I changed
gaim_proxy_connect() to return a reference to a new
GaimProxyConnectInfo (this used to be called PHB). Eventually this
can be passed to a function that'll cancel the connection attempt.
I also decided to add an error_cb instead of using connect_cb and
passing a file descriptor of -1. And proxy.c will also pass an
error message to callers which should explain the reason that the
connection attempt failed.
Oh, and proxy.c now never calls gaim_connection_error()
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 12 Aug 2006 10:12:43 +0000 |
parents | 841a5ffbfee4 |
children | 81650a27f253 |
rev | line source |
---|---|
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #include "notify.h" |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 #include "gntconn.h" |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 #include "gntgaim.h" |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 static void |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 gg_connection_report_disconnect(GaimConnection *gc, const char *text) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 char *act, *primary, *secondary; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 GaimAccount *account = gaim_connection_get_account(gc); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 act = g_strdup_printf(_("%s (%s)"), gaim_account_get_username(account), |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 gaim_account_get_protocol_name(account)); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 primary = g_strdup_printf(_("%s disconnected."), act); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 secondary = g_strdup_printf(_("%s was disconnected due to the following error:\n%s"), |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 act, text); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 gaim_notify_error(account, _("Connection Error"), primary, secondary); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 g_free(act); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 g_free(primary); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
23 g_free(secondary); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 static GaimConnectionUiOps ops = |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 .connect_progress = NULL, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 .connected = NULL, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 .disconnected = NULL, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 .notice = NULL, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 .report_disconnect = gg_connection_report_disconnect |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 }; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 GaimConnectionUiOps *gg_connections_get_ui_ops() |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 return &ops; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 void gg_connections_init() |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 {} |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 void gg_connections_uninit() |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 {} |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 |