libpurple/eventloop.h

Fri, 20 Oct 2023 01:09:45 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 20 Oct 2023 01:09:45 -0500
changeset 42375
8e61249e9b10
parent 41762
5c21747ff7dc
child 42391
090b03385984
permissions
-rw-r--r--

Implement ProtocolFileTransfer

Testing Done:
Ran the unit tests under valgrind.

Bugs closed: PIDGIN-17833

Reviewed at https://reviews.imfreedom.org/r/2643/

20147
66f05a854eee applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents: 19859
diff changeset
1 /* purple
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
2 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
3 * Purple is the legal property of its developers, whose names are too numerous
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
5 * source distribution.
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
6 *
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
10 * (at your option) any later version.
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
11 *
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
15 * GNU General Public License for more details.
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
16 *
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
18 * 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
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
20 */
35487
494f09f7f331 Move section blocks inside inclusion guards -- otherwise g-ir-scanner yells
Ankit Vani <a@nevitus.org>
parents: 35486
diff changeset
21
40474
1341be8e3402 Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents: 39659
diff changeset
22 #if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
1341be8e3402 Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents: 39659
diff changeset
23 # error "only <purple.h> may be included directly"
1341be8e3402 Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents: 39659
diff changeset
24 #endif
1341be8e3402 Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents: 39659
diff changeset
25
39659
e4dfb99b0cef Fix libpurple header guards using reserved names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38745
diff changeset
26 #ifndef PURPLE_EVENTLOOP_H
e4dfb99b0cef Fix libpurple header guards using reserved names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38745
diff changeset
27 #define PURPLE_EVENTLOOP_H
35440
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35420
diff changeset
28
10023
6b0014040323 [gaim-migrate @ 10955]
Mark Doliner <markdoliner@pidgin.im>
parents: 10008
diff changeset
29 #include <glib.h>
35572
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
30 #include <glib-object.h>
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
31
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
32 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
33 * PurpleInputCondition:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
34 * @PURPLE_INPUT_READ: A read condition.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
35 * @PURPLE_INPUT_WRITE: A write condition.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
36 *
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
37 * An input condition.
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
38 */
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
39 typedef enum
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
40 {
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
41 PURPLE_INPUT_READ = 1 << 0,
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
42 PURPLE_INPUT_WRITE = 1 << 1
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 } PurpleInputCondition;
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
45
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
46 /**
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
47 * PurpleInputFunction:
40827
ea25e596b1d4 Clean up some random gtk-doc warnings in libpurple's documentation
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
48 * @data: User specified data.
ea25e596b1d4 Clean up some random gtk-doc warnings in libpurple's documentation
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
49 * @fd: The input file descriptor.
ea25e596b1d4 Clean up some random gtk-doc warnings in libpurple's documentation
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
50 * @cond: The condition type.
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
51 *
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
52 * The type of callbacks to handle events on file descriptors, as passed to
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
53 * purple_input_add(). The callback will receive the @user_data passed to
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
54 * purple_input_add(), the file descriptor on which the event occurred, and the
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
55 * condition that was satisfied to cause the callback to be invoked.
22526
4223bc1ce147 Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents: 20940
diff changeset
56 */
38745
f4376b1f4682 A ton more of introspection cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 38434
diff changeset
57 typedef void (*PurpleInputFunction)(gpointer data, gint fd, PurpleInputCondition cond);
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
58
32787
7072f190d6ad Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
59 G_BEGIN_DECLS
7072f190d6ad Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
60
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
61 /**************************************************************************/
35472
474e26199560 Removed @name
Ankit Vani <a@nevitus.org>
parents: 35471
diff changeset
62 /* Event Loop API */
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
63 /**************************************************************************/
35486
fe9a7f6143c1 Remove /*@{*/ and /*@}*/
Ankit Vani <a@nevitus.org>
parents: 35472
diff changeset
64
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
65 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
66 * purple_input_add:
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 35024
diff changeset
67 * @fd: The input file descriptor.
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 35024
diff changeset
68 * @cond: The condition type.
35682
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35572
diff changeset
69 * @func: (scope call): The callback function for data.
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 35024
diff changeset
70 * @user_data: User-specified data.
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
71 *
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
72 * Adds an input handler.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
73 *
35471
a23769351b31 Remove @see
Ankit Vani <a@nevitus.org>
parents: 35468
diff changeset
74 * See g_io_add_watch_full().
a23769351b31 Remove @see
Ankit Vani <a@nevitus.org>
parents: 35468
diff changeset
75 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 35024
diff changeset
76 * Returns: The resulting handle (will be greater than 0).
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
77 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15756
diff changeset
78 guint purple_input_add(int fd, PurpleInputCondition cond,
22526
4223bc1ce147 Document PurpleEventLoopUiOps and associated misc.
Will Thompson <resiak@pidgin.im>
parents: 20940
diff changeset
79 PurpleInputFunction func, gpointer user_data);
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
80
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
81 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
82 * purple_input_pipe:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
83 * @pipefd: Array used to return file descriptors for both ends of pipe.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
84 *
33291
b70ab10887a7 New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32787
diff changeset
85 * Creates a pipe - an unidirectional data channel that can be used for
b70ab10887a7 New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32787
diff changeset
86 * interprocess communication.
b70ab10887a7 New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32787
diff changeset
87 *
b70ab10887a7 New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32787
diff changeset
88 * File descriptors for both ends of pipe will be written into provided array.
b70ab10887a7 New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32787
diff changeset
89 * The first one (pipefd[0]) can be used for reading, the second one (pipefd[1])
b70ab10887a7 New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32787
diff changeset
90 * for writing.
b70ab10887a7 New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32787
diff changeset
91 *
b70ab10887a7 New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32787
diff changeset
92 * On Windows it's simulated by creating a pair of connected sockets, on other
b70ab10887a7 New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32787
diff changeset
93 * systems pipe() is used.
b70ab10887a7 New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32787
diff changeset
94 *
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
95 * Returns: 0 on success, -1 on error.
33291
b70ab10887a7 New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32787
diff changeset
96 */
b70ab10887a7 New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32787
diff changeset
97 int
b70ab10887a7 New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32787
diff changeset
98 purple_input_pipe(int pipefd[2]);
b70ab10887a7 New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32787
diff changeset
99
32787
7072f190d6ad Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
100 G_END_DECLS
8273
7882af5843e9 [gaim-migrate @ 8997]
Scott Lamb
parents:
diff changeset
101
39659
e4dfb99b0cef Fix libpurple header guards using reserved names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38745
diff changeset
102 #endif /* PURPLE_EVENTLOOP_H */

mercurial