Wed, 13 May 2009 20:29:03 +0000
Support custom smileys in MUCs (when all participants support BoB and a maximum
of 10 participants are in the chat).
Always announce support for BoB, since disable custom smileys will still turn
off fetching them, and BoB can be used for other purposes further on.
| 8273 | 1 | /** |
| 15884 | 2 | * @file eventloop.h Purple Event Loop API |
| 8273 | 3 | * @ingroup core |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
4 | */ |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
5 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
6 | /* purple |
| 8273 | 7 | * |
| 15884 | 8 | * Purple is the legal property of its developers, whose names are too numerous |
| 8273 | 9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 10 | * source distribution. | |
| 11 | * | |
| 12 | * This program is free software; you can redistribute it and/or modify | |
| 13 | * it under the terms of the GNU General Public License as published by | |
| 14 | * the Free Software Foundation; either version 2 of the License, or | |
| 15 | * (at your option) any later version. | |
| 16 | * | |
| 17 | * This program is distributed in the hope that it will be useful, | |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 | * GNU General Public License for more details. | |
| 21 | * | |
| 22 | * You should have received a copy of the GNU General Public License | |
| 23 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18075
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 8273 | 25 | */ |
| 15884 | 26 | #ifndef _PURPLE_EVENTLOOP_H_ |
| 27 | #define _PURPLE_EVENTLOOP_H_ | |
| 8273 | 28 | |
|
10023
6b0014040323
[gaim-migrate @ 10955]
Mark Doliner <markdoliner@pidgin.im>
parents:
10008
diff
changeset
|
29 | #include <glib.h> |
| 8273 | 30 | |
| 31 | #ifdef __cplusplus | |
| 32 | extern "C" { | |
| 33 | #endif | |
| 34 | ||
| 35 | /** | |
| 36 | * An input condition. | |
| 37 | */ | |
| 38 | typedef enum | |
| 39 | { | |
| 15884 | 40 | PURPLE_INPUT_READ = 1 << 0, /**< A read condition. */ |
| 41 | PURPLE_INPUT_WRITE = 1 << 1 /**< A write condition. */ | |
| 8273 | 42 | |
| 15884 | 43 | } PurpleInputCondition; |
| 8273 | 44 | |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
45 | /** The type of callbacks to handle events on file descriptors, as passed to |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
46 | * purple_input_add(). The callback will receive the @c user_data passed to |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
47 | * purple_input_add(), the file descriptor on which the event occurred, and the |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
48 | * condition that was satisfied to cause the callback to be invoked. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
49 | */ |
| 15884 | 50 | typedef void (*PurpleInputFunction)(gpointer, gint, PurpleInputCondition); |
| 8273 | 51 | |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
52 | /** @copydoc _PurpleEventLoopUiOps */ |
| 15884 | 53 | typedef struct _PurpleEventLoopUiOps PurpleEventLoopUiOps; |
| 8273 | 54 | |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
55 | /** An abstraction of an application's mainloop; libpurple will use this to |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
56 | * watch file descriptors and schedule timed callbacks. If your application |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
57 | * uses the glib mainloop, there is an implementation of this struct in |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
58 | * <tt>libpurple/example/nullclient.c</tt> which you can use verbatim. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
59 | */ |
| 15884 | 60 | struct _PurpleEventLoopUiOps |
| 8273 | 61 | { |
| 62 | /** | |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
63 | * Should create a callback timer with an interval measured in |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
64 | * milliseconds. The supplied @a function should be called every @a |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
65 | * interval seconds until it returns @c FALSE, after which it should not |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
66 | * be called again. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
67 | * |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
68 | * Analogous to g_timeout_add in glib. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
69 | * |
|
24050
583a6a2f13eb
Add a note about the timeout_add uiop being used to synchronize threads on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23063
diff
changeset
|
70 | * Note: On Win32, this function may be called from a thread other than |
|
583a6a2f13eb
Add a note about the timeout_add uiop being used to synchronize threads on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23063
diff
changeset
|
71 | * the libpurple thread. You should make sure to detect this situation |
|
583a6a2f13eb
Add a note about the timeout_add uiop being used to synchronize threads on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23063
diff
changeset
|
72 | * and to only call "function" from the libpurple thread. |
|
583a6a2f13eb
Add a note about the timeout_add uiop being used to synchronize threads on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23063
diff
changeset
|
73 | * |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
74 | * @param interval the interval in <em>milliseconds</em> between calls |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
75 | * to @a function. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
76 | * @param data arbitrary data to be passed to @a function at each |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
77 | * call. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
78 | * @todo Who is responsible for freeing @a data? |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
79 | * |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
80 | * @return a handle for the timeout, which can be passed to |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
81 | * #timeout_remove. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
82 | * |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
83 | * @see purple_timeout_add |
| 8273 | 84 | **/ |
| 85 | guint (*timeout_add)(guint interval, GSourceFunc function, gpointer data); | |
| 86 | ||
| 87 | /** | |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
88 | * Should remove a callback timer. Analogous to g_source_remove in glib. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
89 | * @param handle an identifier for a timeout, as returned by |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
90 | * #timeout_add. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
91 | * @return @c TRUE if the timeout identified by @a handle was |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
92 | * found and removed. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
93 | * @see purple_timeout_remove |
| 8287 | 94 | */ |
|
15729
6932ac4e5b3d
Change out source_remove and input_remove eventloop functions to return
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
95 | gboolean (*timeout_remove)(guint handle); |
| 8287 | 96 | |
| 97 | /** | |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
98 | * Should add an input handler. Analogous to g_io_add_watch_full in |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
99 | * glib. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
100 | * |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
101 | * @param fd a file descriptor to watch for events |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
102 | * @param cond a bitwise OR of events on @a fd for which @a func |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
103 | * should be called. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
104 | * @param func a callback to fire whenever a relevant event on @a |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
105 | * fd occurs. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
106 | * @param user_data arbitrary data to pass to @a fd. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
107 | * @return an identifier for this input handler, which can be |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
108 | * passed to #input_remove. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
109 | * |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
110 | * @see purple_input_add |
| 8273 | 111 | */ |
| 15884 | 112 | guint (*input_add)(int fd, PurpleInputCondition cond, |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
113 | PurpleInputFunction func, gpointer user_data); |
| 8273 | 114 | |
| 115 | /** | |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
116 | * Should remove an input handler. Analogous to g_source_remove in glib. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
117 | * @param handle an identifier, as returned by #input_add. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
118 | * @return @c TRUE if the input handler was found and removed. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
119 | * @see purple_input_remove |
| 8273 | 120 | */ |
|
15729
6932ac4e5b3d
Change out source_remove and input_remove eventloop functions to return
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
121 | gboolean (*input_remove)(guint handle); |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
24050
diff
changeset
|
122 | |
|
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
24050
diff
changeset
|
123 | |
|
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
|
124 | /** |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
125 | * If implemented, should get the current error status for an input. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
126 | * |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
127 | * Implementation of this UI op is optional. Implement it if the UI's |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
128 | * sockets or event loop needs to customize determination of socket |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
129 | * error status. If unimplemented, <tt>getsockopt(2)</tt> will be used |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
130 | * instead. |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
131 | * |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
132 | * @see purple_input_get_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
|
133 | */ |
|
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
|
134 | 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
|
135 | |
|
18070
79c7fe0d8e4b
Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents:
18068
diff
changeset
|
136 | /** |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
137 | * If implemented, should create a callback timer with an interval |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
138 | * measured in seconds. Analogous to g_timeout_add_seconds in glib. |
|
18070
79c7fe0d8e4b
Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents:
18068
diff
changeset
|
139 | * |
|
79c7fe0d8e4b
Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents:
18068
diff
changeset
|
140 | * 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
|
141 | * 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
|
142 | * |
|
79c7fe0d8e4b
Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents:
18068
diff
changeset
|
143 | * Implementation of this UI op is optional. If it's not implemented, |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
144 | * calls to purple_timeout_add_seconds() will be serviced by |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
145 | * #timeout_add. |
|
18070
79c7fe0d8e4b
Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents:
18068
diff
changeset
|
146 | * |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
147 | * @see purple_timeout_add_seconds() |
|
23063
9458eafda32c
Assorted cleanups, mostly to the Doxygen comments. I added a few missing
Richard Laager <rlaager@pidgin.im>
parents:
22526
diff
changeset
|
148 | * @since 2.1.0 |
|
18070
79c7fe0d8e4b
Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents:
18068
diff
changeset
|
149 | **/ |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
150 | guint (*timeout_add_seconds)(guint interval, GSourceFunc function, |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
151 | gpointer data); |
|
18070
79c7fe0d8e4b
Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents:
18068
diff
changeset
|
152 | |
|
16743
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
15997
diff
changeset
|
153 | 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
|
154 | 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
|
155 | void (*_purple_reserved4)(void); |
| 8273 | 156 | }; |
| 157 | ||
| 158 | /**************************************************************************/ | |
| 159 | /** @name Event Loop API */ | |
| 160 | /**************************************************************************/ | |
| 161 | /*@{*/ | |
| 162 | /** | |
| 163 | * Creates a callback timer. | |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
24050
diff
changeset
|
164 | * |
|
10071
d2ba11541693
[gaim-migrate @ 11047]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
10023
diff
changeset
|
165 | * The timer will repeat until the function returns @c FALSE. The |
| 8273 | 166 | * 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
|
167 | * |
|
79c7fe0d8e4b
Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents:
18068
diff
changeset
|
168 | * 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
|
169 | * 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
|
170 | * |
| 8273 | 171 | * @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
|
172 | * milliseconds. |
|
79c7fe0d8e4b
Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents:
18068
diff
changeset
|
173 | * @param function The function to call. |
|
79c7fe0d8e4b
Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents:
18068
diff
changeset
|
174 | * @param data data to pass to @a function. |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
175 | * @return A handle to the timer which can be passed to |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
176 | * purple_timeout_remove() to remove the timer. |
|
18070
79c7fe0d8e4b
Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents:
18068
diff
changeset
|
177 | */ |
|
79c7fe0d8e4b
Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents:
18068
diff
changeset
|
178 | 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
|
179 | |
|
79c7fe0d8e4b
Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents:
18068
diff
changeset
|
180 | /** |
|
79c7fe0d8e4b
Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents:
18068
diff
changeset
|
181 | * Creates a callback timer. |
|
79c7fe0d8e4b
Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents:
18068
diff
changeset
|
182 | * |
|
79c7fe0d8e4b
Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents:
18068
diff
changeset
|
183 | * 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
|
184 | * 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
|
185 | * |
|
79c7fe0d8e4b
Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents:
18068
diff
changeset
|
186 | * 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
|
187 | * this reason, @a interval may be rounded by up to a second. |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
24050
diff
changeset
|
188 | * |
|
18070
79c7fe0d8e4b
Wire everything up and document it.
Richard Laager <rlaager@pidgin.im>
parents:
18068
diff
changeset
|
189 | * @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
|
190 | * seconds. |
| 8273 | 191 | * @param function The function to call. |
|
10071
d2ba11541693
[gaim-migrate @ 11047]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
10023
diff
changeset
|
192 | * @param data data to pass to @a function. |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
24050
diff
changeset
|
193 | * @return A handle to the timer which can be passed to |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
194 | * purple_timeout_remove() to remove the timer. |
|
20940
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
195 | * |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
196 | * @since 2.1.0 |
|
10071
d2ba11541693
[gaim-migrate @ 11047]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
10023
diff
changeset
|
197 | */ |
|
18075
1e4bb0043a98
It's GLIB_CHECK_VERSION, not GLIB_VERSION_CHECK.
Richard Laager <rlaager@pidgin.im>
parents:
18070
diff
changeset
|
198 | guint purple_timeout_add_seconds(guint interval, GSourceFunc function, gpointer data); |
| 8273 | 199 | |
| 200 | /** | |
| 8287 | 201 | * Removes a timeout handler. |
| 202 | * | |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
203 | * @param handle The handle, as returned by purple_timeout_add(). |
|
8387
381fc8b4f8f7
[gaim-migrate @ 9115]
Christian Hammond <chipx86@chipx86.com>
parents:
8287
diff
changeset
|
204 | * |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
205 | * @return @c TRUE if the handler was successfully removed. |
| 8287 | 206 | */ |
| 15884 | 207 | gboolean purple_timeout_remove(guint handle); |
| 8287 | 208 | |
| 209 | /** | |
| 8273 | 210 | * Adds an input handler. |
| 211 | * | |
| 8280 | 212 | * @param fd The input file descriptor. |
| 8273 | 213 | * @param cond The condition type. |
| 214 | * @param func The callback function for data. | |
| 215 | * @param user_data User-specified data. | |
| 216 | * | |
|
13747
26ce2a14d553
[gaim-migrate @ 16156]
Mark Doliner <markdoliner@pidgin.im>
parents:
10071
diff
changeset
|
217 | * @return The resulting handle (will be greater than 0). |
| 8273 | 218 | * @see g_io_add_watch_full |
| 219 | */ | |
| 15884 | 220 | guint purple_input_add(int fd, PurpleInputCondition cond, |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
221 | PurpleInputFunction func, gpointer user_data); |
| 8273 | 222 | |
| 223 | /** | |
| 224 | * Removes an input handler. | |
| 225 | * | |
| 8280 | 226 | * @param handle The handle of the input handler. Note that this is the return |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
227 | * value from purple_input_add(), <i>not</i> the file descriptor. |
| 8273 | 228 | */ |
| 15884 | 229 | 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
|
230 | |
|
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
|
231 | /** |
|
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
|
232 | * Get the current error status for an input. |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
233 | * |
|
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
|
234 | * 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
|
235 | * 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
|
236 | * 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
|
237 | * |
|
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
|
238 | * @param fd The input file descriptor. |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
239 | * @param error A pointer to an @c int which on return will have the error, or |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
240 | * @c 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
|
241 | * |
|
22526
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
242 | * @return @c 0 if there is no error; @c -1 if there is an error, in which case |
|
4223bc1ce147
Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents:
20940
diff
changeset
|
243 | * @a errno will be set. |
|
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
|
244 | */ |
|
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
|
245 | int |
| 15884 | 246 | 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
|
247 | |
| 8273 | 248 | |
| 249 | /*@}*/ | |
| 250 | ||
| 251 | ||
| 252 | /**************************************************************************/ | |
| 253 | /** @name UI Registration Functions */ | |
| 254 | /**************************************************************************/ | |
| 255 | /*@{*/ | |
| 256 | /** | |
| 257 | * Sets the UI operations structure to be used for accounts. | |
| 258 | * | |
| 259 | * @param ops The UI operations structure. | |
| 260 | */ | |
| 15884 | 261 | void purple_eventloop_set_ui_ops(PurpleEventLoopUiOps *ops); |
| 8273 | 262 | |
| 263 | /** | |
| 264 | * Returns the UI operations structure used for accounts. | |
| 265 | * | |
| 266 | * @return The UI operations structure in use. | |
| 267 | */ | |
| 15884 | 268 | PurpleEventLoopUiOps *purple_eventloop_get_ui_ops(void); |
| 8273 | 269 | |
| 270 | /*@}*/ | |
| 271 | ||
| 272 | #ifdef __cplusplus | |
| 273 | } | |
| 274 | #endif | |
| 275 | ||
| 15884 | 276 | #endif /* _PURPLE_EVENTLOOP_H_ */ |