libpurple/purpleconnectionerrorinfo.c

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 41714
318204db6284
child 42594
eddde70cedd8
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/

41714
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Purple - Internet Messaging Library
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 *
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * Lesser General Public License for more details.
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 *
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 */
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 #include "purpleconnectionerrorinfo.h"
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 G_DEFINE_BOXED_TYPE(PurpleConnectionErrorInfo, purple_connection_error_info,
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22 purple_connection_error_info_copy,
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 purple_connection_error_info_free)
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 /******************************************************************************
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 * Public API
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 *****************************************************************************/
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 PurpleConnectionErrorInfo *
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 purple_connection_error_info_new(PurpleConnectionError type,
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 const gchar *description)
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 {
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 PurpleConnectionErrorInfo *info;
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 g_return_val_if_fail(description != NULL, NULL);
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 info = g_new(PurpleConnectionErrorInfo, 1);
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 info->type = type;
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 info->description = g_strdup(description);
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 return info;
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 }
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 PurpleConnectionErrorInfo *
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 purple_connection_error_info_copy(PurpleConnectionErrorInfo *info)
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 {
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 g_return_val_if_fail(info != NULL, NULL);
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 return purple_connection_error_info_new(info->type, info->description);
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 }
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 void
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 purple_connection_error_info_free(PurpleConnectionErrorInfo *info) {
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 g_return_if_fail(info != NULL);
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 g_free(info->description);
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 g_free(info);
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 }

mercurial