Sun, 15 Apr 2007 03:56:08 +0000
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4-rlaager-whitespace' (head df9df972434fafda3e8030977ab3c18d480d8fa8)
to branch 'im.pidgin.rlaager.merging.msnp13-and-pidgin' (head 46933dc6288036763e484bfb1906f1149ada01cf)
| 8273 | 1 | /** |
| 15884 | 2 | * @file eventloop.h Purple Event Loop API |
| 8273 | 3 | * @ingroup core |
| 4 | * | |
| 15884 | 5 | * purple |
| 8273 | 6 | * |
| 15884 | 7 | * Purple is the legal property of its developers, whose names are too numerous |
| 8273 | 8 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 9 | * source distribution. | |
| 10 | * | |
| 11 | * This program is free software; you can redistribute it and/or modify | |
| 12 | * it under the terms of the GNU General Public License as published by | |
| 13 | * the Free Software Foundation; either version 2 of the License, or | |
| 14 | * (at your option) any later version. | |
| 15 | * | |
| 16 | * This program is distributed in the hope that it will be useful, | |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 | * GNU General Public License for more details. | |
| 20 | * | |
| 21 | * You should have received a copy of the GNU General Public License | |
| 22 | * along with this program; if not, write to the Free Software | |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 24 | */ | |
| 15884 | 25 | #ifndef _PURPLE_EVENTLOOP_H_ |
| 26 | #define _PURPLE_EVENTLOOP_H_ | |
| 8273 | 27 | |
|
10023
6b0014040323
[gaim-migrate @ 10955]
Mark Doliner <markdoliner@pidgin.im>
parents:
10008
diff
changeset
|
28 | #include <glib.h> |
| 8273 | 29 | |
| 30 | #ifdef __cplusplus | |
| 31 | extern "C" { | |
| 32 | #endif | |
| 33 | ||
| 34 | /** | |
| 35 | * An input condition. | |
| 36 | */ | |
| 37 | typedef enum | |
| 38 | { | |
| 15884 | 39 | PURPLE_INPUT_READ = 1 << 0, /**< A read condition. */ |
| 40 | PURPLE_INPUT_WRITE = 1 << 1 /**< A write condition. */ | |
| 8273 | 41 | |
| 15884 | 42 | } PurpleInputCondition; |
| 8273 | 43 | |
| 15884 | 44 | typedef void (*PurpleInputFunction)(gpointer, gint, PurpleInputCondition); |
| 8273 | 45 | |
| 15884 | 46 | typedef struct _PurpleEventLoopUiOps PurpleEventLoopUiOps; |
| 8273 | 47 | |
| 15884 | 48 | struct _PurpleEventLoopUiOps |
| 8273 | 49 | { |
| 50 | /** | |
| 51 | * Creates a callback timer. | |
| 15884 | 52 | * @see g_timeout_add, purple_timeout_add |
| 8273 | 53 | **/ |
| 54 | guint (*timeout_add)(guint interval, GSourceFunc function, gpointer data); | |
| 55 | ||
| 56 | /** | |
| 8287 | 57 | * Removes a callback timer. |
| 15884 | 58 | * @see purple_timeout_remove, g_source_remove |
| 8287 | 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 | 61 | |
| 62 | /** | |
| 8273 | 63 | * Adds an input handler. |
| 15884 | 64 | * @see purple_input_add, g_io_add_watch_full |
| 8273 | 65 | */ |
| 15884 | 66 | guint (*input_add)(int fd, PurpleInputCondition cond, |
| 67 | PurpleInputFunction func, gpointer user_data); | |
| 8273 | 68 | |
| 69 | /** | |
| 70 | * Removes an input handler. | |
| 15884 | 71 | * @see purple_input_remove, g_source_remove |
| 8273 | 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 | 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 | |
| 8273 | 84 | }; |
| 85 | ||
| 86 | /**************************************************************************/ | |
| 87 | /** @name Event Loop API */ | |
| 88 | /**************************************************************************/ | |
| 89 | /*@{*/ | |
| 90 | /** | |
| 91 | * Creates a callback timer. | |
|
10071
d2ba11541693
[gaim-migrate @ 11047]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
10023
diff
changeset
|
92 | * The timer will repeat until the function returns @c FALSE. The |
| 8273 | 93 | * first call will be at the end of the first interval. |
| 94 | * @param interval The time between calls of the function, in | |
| 95 | * milliseconds. | |
| 96 | * @param function The function to call. | |
|
10071
d2ba11541693
[gaim-migrate @ 11047]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
10023
diff
changeset
|
97 | * @param data data to pass to @a function. |
|
d2ba11541693
[gaim-migrate @ 11047]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
10023
diff
changeset
|
98 | * @return A handle to the timer which can be passed to |
| 15884 | 99 | * purple_timeout_remove to remove the timer. |
|
10071
d2ba11541693
[gaim-migrate @ 11047]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
10023
diff
changeset
|
100 | */ |
| 15884 | 101 | guint purple_timeout_add(guint interval, GSourceFunc function, gpointer data); |
| 8273 | 102 | |
| 103 | /** | |
| 8287 | 104 | * Removes a timeout handler. |
| 105 | * | |
| 15884 | 106 | * @param handle The handle, as returned by purple_timeout_add. |
|
8387
381fc8b4f8f7
[gaim-migrate @ 9115]
Christian Hammond <chipx86@chipx86.com>
parents:
8287
diff
changeset
|
107 | * |
|
381fc8b4f8f7
[gaim-migrate @ 9115]
Christian Hammond <chipx86@chipx86.com>
parents:
8287
diff
changeset
|
108 | * @return Something. |
| 8287 | 109 | */ |
| 15884 | 110 | gboolean purple_timeout_remove(guint handle); |
| 8287 | 111 | |
| 112 | /** | |
| 8273 | 113 | * Adds an input handler. |
| 114 | * | |
| 8280 | 115 | * @param fd The input file descriptor. |
| 8273 | 116 | * @param cond The condition type. |
| 117 | * @param func The callback function for data. | |
| 118 | * @param user_data User-specified data. | |
| 119 | * | |
|
13747
26ce2a14d553
[gaim-migrate @ 16156]
Mark Doliner <markdoliner@pidgin.im>
parents:
10071
diff
changeset
|
120 | * @return The resulting handle (will be greater than 0). |
| 8273 | 121 | * @see g_io_add_watch_full |
| 122 | */ | |
| 15884 | 123 | guint purple_input_add(int fd, PurpleInputCondition cond, |
| 124 | PurpleInputFunction func, gpointer user_data); | |
| 8273 | 125 | |
| 126 | /** | |
| 127 | * Removes an input handler. | |
| 128 | * | |
| 8280 | 129 | * @param handle The handle of the input handler. Note that this is the return |
| 15884 | 130 | * value from purple_input_add, <i>not</i> the file descriptor. |
| 8273 | 131 | */ |
| 15884 | 132 | 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
|
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 | /** |
|
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 | * 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
|
136 | * 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
|
137 | * 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
|
138 | * 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
|
139 | * |
|
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
|
140 | * @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
|
141 | * @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
|
142 | * |
|
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
|
143 | * @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
|
144 | */ |
|
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
|
145 | int |
| 15884 | 146 | 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
|
147 | |
| 8273 | 148 | |
| 149 | /*@}*/ | |
| 150 | ||
| 151 | ||
| 152 | /**************************************************************************/ | |
| 153 | /** @name UI Registration Functions */ | |
| 154 | /**************************************************************************/ | |
| 155 | /*@{*/ | |
| 156 | /** | |
| 157 | * Sets the UI operations structure to be used for accounts. | |
| 158 | * | |
| 159 | * @param ops The UI operations structure. | |
| 160 | */ | |
| 15884 | 161 | void purple_eventloop_set_ui_ops(PurpleEventLoopUiOps *ops); |
| 8273 | 162 | |
| 163 | /** | |
| 164 | * Returns the UI operations structure used for accounts. | |
| 165 | * | |
| 166 | * @return The UI operations structure in use. | |
| 167 | */ | |
| 15884 | 168 | PurpleEventLoopUiOps *purple_eventloop_get_ui_ops(void); |
| 8273 | 169 | |
| 170 | /*@}*/ | |
| 171 | ||
| 172 | #ifdef __cplusplus | |
| 173 | } | |
| 174 | #endif | |
| 175 | ||
| 15884 | 176 | #endif /* _PURPLE_EVENTLOOP_H_ */ |