libpurple/purpleconnectionerrorinfo.c

Thu, 22 Feb 2024 06:03:16 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 22 Feb 2024 06:03:16 -0600
changeset 42596
b64b96f3b781
parent 42594
eddde70cedd8
permissions
-rw-r--r--

Add a favorite property to PurpleContactInfo

This will be used in the future for toggling whether or not contacts are
favorited or starred.

Testing Done:
Ran the unit tests under valgrind.

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

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 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41714
diff changeset
5 * Purple is the legal property of its developers, whose names are too numerous
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41714
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41714
diff changeset
7 * source distribution.
41714
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41714
diff changeset
9 * This library is free software; you can redistribute it and/or modify it
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41714
diff changeset
10 * under the terms of the GNU General Public License as published by the Free
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41714
diff changeset
11 * Software Foundation; either version 2 of the License, or (at your option)
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41714
diff changeset
12 * any later version.
41714
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41714
diff changeset
14 * This library is distributed in the hope that it will be useful, but WITHOUT
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41714
diff changeset
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41714
diff changeset
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41714
diff changeset
17 * more details.
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41714
diff changeset
18 *
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41714
diff changeset
19 * You should have received a copy of the GNU General Public License along with
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 41714
diff changeset
20 * this library; if not, see <https://www.gnu.org/licenses/>.
41714
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include "purpleconnectionerrorinfo.h"
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 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
26 purple_connection_error_info_copy,
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 purple_connection_error_info_free)
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 /******************************************************************************
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 * Public API
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 *
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 purple_connection_error_info_new(PurpleConnectionError type,
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 const gchar *description)
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 PurpleConnectionErrorInfo *info;
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 g_return_val_if_fail(description != NULL, NULL);
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 info = g_new(PurpleConnectionErrorInfo, 1);
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 info->type = type;
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 info->description = g_strdup(description);
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 return 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
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 PurpleConnectionErrorInfo *
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 purple_connection_error_info_copy(PurpleConnectionErrorInfo *info)
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 g_return_val_if_fail(info != NULL, NULL);
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 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
54 }
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 void
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 purple_connection_error_info_free(PurpleConnectionErrorInfo *info) {
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 g_return_if_fail(info != NULL);
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 g_free(info->description);
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 g_free(info);
318204db6284 Split PurpleConnectionErrorInfo out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 }

mercurial