Mercurial > pidgin
annotate src/protocols/msn/servconn.h @ 11642:58bc500cf226
[gaim-migrate @ 13919]
sf patch #1324285, from Casey Harkins
fix "sounds while away" in HEAD
This patch adds a GaimAccount as a parameter to the
sound playing functions, allowing the caller to specify
the account the sound is related to. If the account is
not NULL and the while_away preference is not set, then
the account is checked to see if it is away, if so, the
sound is not played.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 12 Oct 2005 02:27:32 +0000 |
parents | bcfea6c3d5c9 |
children | 33bef17125c2 |
rev | line source |
---|---|
5309 | 1 /** |
2 * @file servconn.h Server connection functions | |
3 * | |
4 * gaim | |
5 * | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
6 * Gaim is the legal property of its developers, whose names are too numerous |
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
8 * source distribution. |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
9 * |
5309 | 10 * This program is free software; you can redistribute it and/or modify |
11 * it under the terms of the GNU General Public License as published by | |
12 * the Free Software Foundation; either version 2 of the License, or | |
13 * (at your option) any later version. | |
14 * | |
15 * This program is distributed in the hope that it will be useful, | |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 * GNU General Public License for more details. | |
19 * | |
20 * You should have received a copy of the GNU General Public License | |
21 * along with this program; if not, write to the Free Software | |
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
23 */ | |
24 #ifndef _MSN_SERVCONN_H_ | |
25 #define _MSN_SERVCONN_H_ | |
26 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8646
diff
changeset
|
27 typedef struct _MsnServConn MsnServConn; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
28 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
29 #include "session.h" |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8646
diff
changeset
|
30 #include "cmdproc.h" |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
31 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8646
diff
changeset
|
32 #include "proxy.h" |
10463 | 33 #include "httpconn.h" |
5309 | 34 |
10481 | 35 /** |
36 * Connection error types. | |
10463 | 37 */ |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8646
diff
changeset
|
38 typedef enum |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8646
diff
changeset
|
39 { |
10481 | 40 MSN_SERVCONN_ERROR_NONE, |
41 MSN_SERVCONN_ERROR_CONNECT, | |
42 MSN_SERVCONN_ERROR_WRITE, | |
43 MSN_SERVCONN_ERROR_READ, | |
44 | |
45 } MsnServConnError; | |
46 | |
47 /** | |
48 * Connection types. | |
49 */ | |
50 typedef enum | |
51 { | |
52 MSN_SERVCONN_NS, | |
53 MSN_SERVCONN_SB | |
5309 | 54 |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8808
diff
changeset
|
55 } MsnServConnType; |
5962
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
56 |
10481 | 57 /** |
58 * A Connection. | |
10463 | 59 */ |
5309 | 60 struct _MsnServConn |
61 { | |
10463 | 62 MsnServConnType type; /**< The type of this connection. */ |
63 MsnSession *session; /**< The MSN session of this connection. */ | |
64 MsnCmdProc *cmdproc; /**< The command processor of this connection. */ | |
5309 | 65 |
10463 | 66 gboolean connected; /**< A flag that states if it's connected. */ |
67 gboolean processing; /**< A flag that states if something is working | |
68 with this connection. */ | |
69 gboolean wasted; /**< A flag that states if it should be destroyed. */ | |
5309 | 70 |
10463 | 71 char *host; /**< The host this connection is connected or should be |
72 connected to. */ | |
73 int num; /**< A number id of this connection. */ | |
7288
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
74 |
10463 | 75 MsnHttpConn *httpconn; /**< The HTTP connection this connection should use. */ |
5309 | 76 |
10463 | 77 int fd; /**< The connection's file descriptor. */ |
78 int inpa; /**< The connection's input handler. */ | |
79 | |
80 char *rx_buf; /**< The receive buffer. */ | |
81 int rx_len; /**< The receive buffer lenght. */ | |
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
82 |
10463 | 83 size_t payload_len; /**< The length of the payload. |
84 It's only set when we've received a command that | |
85 has a payload. */ | |
5309 | 86 |
10463 | 87 void (*connect_cb)(MsnServConn *); /**< The callback to call when connecting. */ |
88 void (*disconnect_cb)(MsnServConn *); /**< The callback to call when disconnecting. */ | |
89 void (*destroy_cb)(MsnServConn *); /**< The callback to call when destroying. */ | |
5309 | 90 }; |
91 | |
10463 | 92 /** |
93 * Creates a new connection object. | |
94 * | |
95 * @param session The session. | |
96 * @param type The type of the connection. | |
97 */ | |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8808
diff
changeset
|
98 MsnServConn *msn_servconn_new(MsnSession *session, MsnServConnType type); |
10463 | 99 |
100 /** | |
101 * Destroys a connection object. | |
102 * | |
103 * @param servconn The connection. | |
104 */ | |
5309 | 105 void msn_servconn_destroy(MsnServConn *servconn); |
106 | |
10463 | 107 /** |
108 * Connects to a host. | |
109 * | |
110 * @param servconn The connection. | |
111 * @param host The host. | |
112 * @param port The port. | |
113 */ | |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
114 gboolean msn_servconn_connect(MsnServConn *servconn, const char *host, int port); |
10463 | 115 |
116 /** | |
117 * Disconnects. | |
118 * | |
119 * @param servconn The connection. | |
120 */ | |
5309 | 121 void msn_servconn_disconnect(MsnServConn *servconn); |
122 | |
10463 | 123 /** |
124 * Sets the connect callback. | |
125 * | |
126 * @param servconn The servconn. | |
127 * @param connect_cb The connect callback. | |
128 */ | |
5309 | 129 void msn_servconn_set_connect_cb(MsnServConn *servconn, |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
130 void (*connect_cb)(MsnServConn *)); |
10463 | 131 /** |
132 * Sets the disconnect callback. | |
133 * | |
134 * @param servconn The servconn. | |
135 * @param disconnect_cb The disconnect callback. | |
136 */ | |
8583
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
137 void msn_servconn_set_disconnect_cb(MsnServConn *servconn, |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
138 void (*disconnect_cb)(MsnServConn *)); |
10463 | 139 /** |
140 * Sets the destroy callback. | |
141 * | |
142 * @param servconn The servconn that's being destroyed. | |
143 * @param destroy_cb The destroy callback. | |
144 */ | |
145 void msn_servconn_set_destroy_cb(MsnServConn *servconn, | |
146 void (*destroy_cb)(MsnServConn *)); | |
147 | |
148 /** | |
149 * Writes a chunck of data to the servconn. | |
150 * | |
151 * @param servconn The servconn. | |
152 * @param buf The data to write. | |
153 * @param size The size of the data. | |
154 */ | |
155 size_t msn_servconn_write(MsnServConn *servconn, const char *buf, | |
156 size_t size); | |
5309 | 157 |
10481 | 158 /** |
159 * Function to call whenever an error related to a switchboard occurs. | |
160 * | |
161 * @param servconn The servconn. | |
162 * @param error The error that happened. | |
163 */ | |
164 void msn_servconn_got_error(MsnServConn *servconn, MsnServConnError error); | |
165 | |
5309 | 166 #endif /* _MSN_SERVCONN_H_ */ |