libpurple/eventloop.h

Sun, 20 May 2007 13:56:28 +0000

author
Richard Laager <rlaager@pidgin.im>
date
Sun, 20 May 2007 13:56:28 +0000
changeset 18070
79c7fe0d8e4b
parent 18068
b6554e3c8224
child 18075
1e4bb0043a98
permissions
-rw-r--r--

Wire everything up and document it.

8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
1 /**
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
2 * @file eventloop.h Purple Event Loop API
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
3 * @ingroup core
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
4 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
5 * purple
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
6 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
7 * Purple is the legal property of its developers, whose names are too numerous
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
9 * source distribution.
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
10 *
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
14 * (at your option) any later version.
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
15 *
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
19 * GNU General Public License for more details.
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
20 *
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
24 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
25 #ifndef _PURPLE_EVENTLOOP_H_
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
26 #define _PURPLE_EVENTLOOP_H_
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
27
10023
6b0014040323 [gaim-migrate @ 10955]
Mark Doliner <markdoliner@pidgin.im>
parents: 10008
diff changeset
28 #include <glib.h>
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
29
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
30 #ifdef __cplusplus
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
31 extern "C" {
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
32 #endif
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
33
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
34 /**
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
35 * An input condition.
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
36 */
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
37 typedef enum
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
38 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
39 PURPLE_INPUT_READ = 1 << 0, /**< A read condition. */
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
40 PURPLE_INPUT_WRITE = 1 << 1 /**< A write condition. */
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
41
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
42 } PurpleInputCondition;
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
43
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
44 typedef void (*PurpleInputFunction)(gpointer, gint, PurpleInputCondition);
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
45
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
46 typedef struct _PurpleEventLoopUiOps PurpleEventLoopUiOps;
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
47
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
48 struct _PurpleEventLoopUiOps
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
49 {
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
50 /**
18068
b6554e3c8224 merge of '1442df274a24edc9a31194327bd00dfbcf478720'
Richard Laager <rlaager@pidgin.im>
parents: 18067 16743
diff changeset
51 * Creates a callback timer with an interval measured in milliseconds.
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
52 * @see g_timeout_add, purple_timeout_add
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
53 **/
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
54 guint (*timeout_add)(guint interval, GSourceFunc function, gpointer data);
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
55
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
56 /**
8287
266eacc707ac [gaim-migrate @ 9011]
Scott Lamb
parents: 8280
diff changeset
57 * Removes a callback timer.
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
58 * @see purple_timeout_remove, g_source_remove
8287
266eacc707ac [gaim-migrate @ 9011]
Scott Lamb
parents: 8280
diff changeset
59 */
15729
6932ac4e5b3d Change out source_remove and input_remove eventloop functions to return
Mark Doliner <markdoliner@pidgin.im>
parents: 15435
diff changeset
60 gboolean (*timeout_remove)(guint handle);
8287
266eacc707ac [gaim-migrate @ 9011]
Scott Lamb
parents: 8280
diff changeset
61
266eacc707ac [gaim-migrate @ 9011]
Scott Lamb
parents: 8280
diff changeset
62 /**
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
63 * Adds an input handler.
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
64 * @see purple_input_add, g_io_add_watch_full
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
65 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
66 guint (*input_add)(int fd, PurpleInputCondition cond,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
67 PurpleInputFunction func, gpointer user_data);
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
68
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
69 /**
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
70 * Removes an input handler.
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
71 * @see purple_input_remove, g_source_remove
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
72 */
15729
6932ac4e5b3d Change out source_remove and input_remove eventloop functions to return
Mark Doliner <markdoliner@pidgin.im>
parents: 15435
diff changeset
73 gboolean (*input_remove)(guint handle);
15746
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
74
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
75
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
76 /**
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
77 * Get the current error status for an input.
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
78 * Implementation of this UI op is optional. Implement it if the UI's sockets
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
79 * or event loop needs to customize determination of socket error status.
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
80 * @see purple_input_get_error, getsockopt
15746
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
81 */
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
82 int (*input_get_error)(int fd, int *error);
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
83
18070
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
84 /**
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
85 * Creates a callback timer with an interval measured in seconds.
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
86 *
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
87 * This allows UIs to group timers for better power efficiency. For
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
88 * this reason, @a interval may be rounded by up to a second.
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
89 *
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
90 * Implementation of this UI op is optional. If it's not implemented,
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
91 * calls to purple_timeout_add_seconds() will be serviced by the
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
92 * timeout_add UI op.
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
93 *
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
94 * @see g_timeout_add_seconds, purple_timeout_add_seconds()
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
95 **/
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
96 guint (*timeout_add_seconds)(guint interval, GSourceFunc function, gpointer data);
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
97
16743
1ce5ffe12e2a Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents: 15997
diff changeset
98 void (*_purple_reserved2)(void);
1ce5ffe12e2a Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents: 15997
diff changeset
99 void (*_purple_reserved3)(void);
1ce5ffe12e2a Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents: 15997
diff changeset
100 void (*_purple_reserved4)(void);
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
101 };
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
102
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
103 /**************************************************************************/
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
104 /** @name Event Loop API */
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
105 /**************************************************************************/
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
106 /*@{*/
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
107 /**
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
108 * Creates a callback timer.
18070
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
109 *
10071
d2ba11541693 [gaim-migrate @ 11047]
Jonathan Champ <royanee@users.sourceforge.net>
parents: 10023
diff changeset
110 * The timer will repeat until the function returns @c FALSE. The
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
111 * first call will be at the end of the first interval.
18070
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
112 *
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
113 * If the timer is in a multiple of seconds, use purple_timeout_add_seconds()
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
114 * instead as it allows UIs to group timers for power efficiency.
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
115 *
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
116 * @param interval The time between calls of the function, in
18070
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
117 * milliseconds.
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
118 * @param function The function to call.
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
119 * @param data data to pass to @a function.
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
120 * @return A handle to the timer which can be passed to
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
121 * purple_timeout_remove to remove the timer.
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
122 */
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
123 guint purple_timeout_add(guint interval, GSourceFunc function, gpointer data);
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
124
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
125 /**
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
126 * Creates a callback timer.
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
127 *
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
128 * The timer will repeat until the function returns @c FALSE. The
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
129 * first call will be at the end of the first interval.
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
130 *
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
131 * This function allows UIs to group timers for better power efficiency. For
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
132 * this reason, @a interval may be rounded by up to a second.
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
133 *
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
134 * @param interval The time between calls of the function, in
79c7fe0d8e4b Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents: 18068
diff changeset
135 * seconds.
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
136 * @param function The function to call.
10071
d2ba11541693 [gaim-migrate @ 11047]
Jonathan Champ <royanee@users.sourceforge.net>
parents: 10023
diff changeset
137 * @param data data to pass to @a function.
d2ba11541693 [gaim-migrate @ 11047]
Jonathan Champ <royanee@users.sourceforge.net>
parents: 10023
diff changeset
138 * @return A handle to the timer which can be passed to
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
139 * purple_timeout_remove to remove the timer.
10071
d2ba11541693 [gaim-migrate @ 11047]
Jonathan Champ <royanee@users.sourceforge.net>
parents: 10023
diff changeset
140 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
141 guint purple_timeout_add(guint interval, GSourceFunc function, gpointer data);
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
142
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
143 /**
8287
266eacc707ac [gaim-migrate @ 9011]
Scott Lamb
parents: 8280
diff changeset
144 * Removes a timeout handler.
266eacc707ac [gaim-migrate @ 9011]
Scott Lamb
parents: 8280
diff changeset
145 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
146 * @param handle The handle, as returned by purple_timeout_add.
8387
381fc8b4f8f7 [gaim-migrate @ 9115]
Christian Hammond <chipx86@chipx86.com>
parents: 8287
diff changeset
147 *
381fc8b4f8f7 [gaim-migrate @ 9115]
Christian Hammond <chipx86@chipx86.com>
parents: 8287
diff changeset
148 * @return Something.
8287
266eacc707ac [gaim-migrate @ 9011]
Scott Lamb
parents: 8280
diff changeset
149 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
150 gboolean purple_timeout_remove(guint handle);
8287
266eacc707ac [gaim-migrate @ 9011]
Scott Lamb
parents: 8280
diff changeset
151
266eacc707ac [gaim-migrate @ 9011]
Scott Lamb
parents: 8280
diff changeset
152 /**
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
153 * Adds an input handler.
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
154 *
8280
f448633d3f3a [gaim-migrate @ 9004]
Scott Lamb
parents: 8273
diff changeset
155 * @param fd The input file descriptor.
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
156 * @param cond The condition type.
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
157 * @param func The callback function for data.
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
158 * @param user_data User-specified data.
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
159 *
13747
26ce2a14d553 [gaim-migrate @ 16156]
Mark Doliner <markdoliner@pidgin.im>
parents: 10071
diff changeset
160 * @return The resulting handle (will be greater than 0).
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
161 * @see g_io_add_watch_full
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
162 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
163 guint purple_input_add(int fd, PurpleInputCondition cond,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
164 PurpleInputFunction func, gpointer user_data);
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
165
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
166 /**
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
167 * Removes an input handler.
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
168 *
8280
f448633d3f3a [gaim-migrate @ 9004]
Scott Lamb
parents: 8273
diff changeset
169 * @param handle The handle of the input handler. Note that this is the return
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
170 * value from purple_input_add, <i>not</i> the file descriptor.
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
171 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
172 gboolean purple_input_remove(guint handle);
15746
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
173
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
174 /**
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
175 * Get the current error status for an input.
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
176 * The return value and error follow getsockopt() with a level of SOL_SOCKET and an
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
177 * option name of SO_ERROR, and this is how the error is determined if the UI does not
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
178 * implement the input_get_error UI op.
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
179 *
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
180 * @param fd The input file descriptor.
15997
ff97c5f69196 A little doxygen love and some tiny gaim->purpleisms
Mark Doliner <markdoliner@pidgin.im>
parents: 15884
diff changeset
181 * @param error A pointer to an int which on return will have the error, or 0 if no error.
15746
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
182 *
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
183 * @return 0 if there is no error; -1 if there is an error, in which case errno will be set.
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
184 */
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
185 int
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
186 purple_input_get_error(int fd, int *error);
15746
017e33725857 Added a new GaimEventLoopUiOps item, input_get_error(). This function allows the UI to return the current error status on a socket/input. If the UI does not implement it (as Pidgin and gntgaim do not, since glib's handling of sockets is sane), it is just a wrapper around getsockopt(). Implemented or not, its return values should match those of getsockopt() with a level of SOL_SOCKET and an option of SO_ERROR. For curious souls, Adium will be using this to provide a working version of getsockopt(); the CoreFoundation CFSocket class which is used for socket read/write calls getsockopt() with SO_ERROR itself, thereby clearing the error flag [as documented in getsockopt()'s behavior], so depending upon it for determining if an error occurred leads to significant misbehavior.
Evan Schoenberg <evands@pidgin.im>
parents: 15729
diff changeset
187
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
188
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
189 /*@}*/
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
190
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
191
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
192 /**************************************************************************/
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
193 /** @name UI Registration Functions */
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
194 /**************************************************************************/
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
195 /*@{*/
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
196 /**
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
197 * Sets the UI operations structure to be used for accounts.
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
198 *
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
199 * @param ops The UI operations structure.
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
200 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
201 void purple_eventloop_set_ui_ops(PurpleEventLoopUiOps *ops);
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
202
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
203 /**
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
204 * Returns the UI operations structure used for accounts.
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
205 *
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
206 * @return The UI operations structure in use.
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
207 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
208 PurpleEventLoopUiOps *purple_eventloop_get_ui_ops(void);
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
209
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
210 /*@}*/
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
211
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
212 #ifdef __cplusplus
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
213 }
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
214 #endif
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
215
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
216 #endif /* _PURPLE_EVENTLOOP_H_ */

mercurial