libpurple/purplechanneljoindetails.c

Mon, 13 May 2024 23:28:20 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Mon, 13 May 2024 23:28:20 -0500
changeset 42767
8cf1d11b59c1
parent 42613
780d7efe37c2
child 42799
8b06291db25c
permissions
-rw-r--r--

Use g_set_str everywhere

This simplifies many setters.

Testing Done:
Ran `ninja turtles`

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

42326
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Purple - Internet Messaging Library
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
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: 42576
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: 42576
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: 42576
diff changeset
7 * source distribution.
42326
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
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: 42576
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: 42576
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: 42576
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: 42576
diff changeset
12 * any later version.
42326
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
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: 42576
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: 42576
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: 42576
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: 42576
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: 42576
diff changeset
18 *
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42576
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: 42576
diff changeset
20 * this library; if not, see <https://www.gnu.org/licenses/>.
42326
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include "purplechanneljoindetails.h"
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 #include "util.h"
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 enum {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 PROP_0,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 PROP_NAME,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 PROP_NICKNAME,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 PROP_NICKNAME_SUPPORTED,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 PROP_PASSWORD,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 PROP_PASSWORD_SUPPORTED,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 N_PROPERTIES,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 };
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 struct _PurpleChannelJoinDetails {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 GObject parent;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 char *name;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 char *nickname;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 gboolean nickname_supported;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 char *password;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 gboolean password_supported;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 };
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 /******************************************************************************
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 * Helpers
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 *****************************************************************************/
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 static void
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 purple_channel_join_details_set_nickname_supported(PurpleChannelJoinDetails *details,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 gboolean nickname_supported)
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 g_return_if_fail(PURPLE_IS_CHANNEL_JOIN_DETAILS(details));
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 if(details->nickname_supported != nickname_supported) {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 details->nickname_supported = nickname_supported;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 g_object_notify_by_pspec(G_OBJECT(details),
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 properties[PROP_NICKNAME_SUPPORTED]);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 static void
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 purple_channel_join_details_set_password_supported(PurpleChannelJoinDetails *details,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 gboolean password_supported)
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 g_return_if_fail(PURPLE_IS_CHANNEL_JOIN_DETAILS(details));
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 if(details->password_supported != password_supported) {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 details->password_supported = password_supported;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 g_object_notify_by_pspec(G_OBJECT(details),
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 properties[PROP_PASSWORD_SUPPORTED]);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 /******************************************************************************
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 * GObject Implementation
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 *****************************************************************************/
42576
ab1ca778ddb2 Make sure all of the final types in libpurple are defined as such
Gary Kramlich <grim@reaperworld.com>
parents: 42364
diff changeset
81 G_DEFINE_FINAL_TYPE(PurpleChannelJoinDetails, purple_channel_join_details,
ab1ca778ddb2 Make sure all of the final types in libpurple are defined as such
Gary Kramlich <grim@reaperworld.com>
parents: 42364
diff changeset
82 G_TYPE_OBJECT)
42326
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 static void
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 purple_channel_join_details_finalize(GObject *obj) {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 PurpleChannelJoinDetails *details = PURPLE_CHANNEL_JOIN_DETAILS(obj);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 g_clear_pointer(&details->name, g_free);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 g_clear_pointer(&details->nickname, g_free);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 g_clear_pointer(&details->password, g_free);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 G_OBJECT_CLASS(purple_channel_join_details_parent_class)->finalize(obj);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 static void
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 purple_channel_join_details_get_property(GObject *obj, guint param_id,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 GValue *value, GParamSpec *pspec)
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 PurpleChannelJoinDetails *details = PURPLE_CHANNEL_JOIN_DETAILS(obj);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 switch(param_id) {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 case PROP_NAME:
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 g_value_set_string(value,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 purple_channel_join_details_get_name(details));
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 break;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 case PROP_NICKNAME:
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 g_value_set_string(value,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 purple_channel_join_details_get_nickname(details));
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 break;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 case PROP_NICKNAME_SUPPORTED:
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 g_value_set_boolean(value,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 purple_channel_join_details_get_nickname_supported(details));
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 break;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 case PROP_PASSWORD:
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 g_value_set_string(value,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 purple_channel_join_details_get_password(details));
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 break;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 case PROP_PASSWORD_SUPPORTED:
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 g_value_set_boolean(value,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 purple_channel_join_details_get_password_supported(details));
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 break;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 default:
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 break;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 static void
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 purple_channel_join_details_set_property(GObject *obj, guint param_id,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 const GValue *value,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 GParamSpec *pspec)
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133 PurpleChannelJoinDetails *details = PURPLE_CHANNEL_JOIN_DETAILS(obj);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 switch(param_id) {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 case PROP_NAME:
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 purple_channel_join_details_set_name(details,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 g_value_get_string(value));
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 break;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 case PROP_NICKNAME:
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 purple_channel_join_details_set_nickname(details,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 g_value_get_string(value));
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 break;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 case PROP_NICKNAME_SUPPORTED:
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 purple_channel_join_details_set_nickname_supported(details,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 g_value_get_boolean(value));
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 break;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 case PROP_PASSWORD:
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 purple_channel_join_details_set_password(details,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 g_value_get_string(value));
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151 break;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152 case PROP_PASSWORD_SUPPORTED:
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 purple_channel_join_details_set_password_supported(details,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 g_value_get_boolean(value));
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 break;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 default:
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 break;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162 static void
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 purple_channel_join_details_init(G_GNUC_UNUSED PurpleChannelJoinDetails *details)
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164 {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 static void
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 purple_channel_join_details_class_init(PurpleChannelJoinDetailsClass *klass) {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171 obj_class->finalize = purple_channel_join_details_finalize;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 obj_class->get_property = purple_channel_join_details_get_property;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 obj_class->set_property = purple_channel_join_details_set_property;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 /**
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176 * PurpleChannelJoinDetails:name:
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 *
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 * The name of the channel to join.
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
180 * Since: 3.0
42326
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181 */
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 properties[PROP_NAME] = g_param_spec_string(
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 "name", "name",
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
184 "The name of the channel to join.",
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185 NULL,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 /**
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 * PurpleChannelJoinDetails:nickname:
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 *
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 * The nickname of the user in the channel.
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 *
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 * Not all protocols support a channel-specific username, so user
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194 * interfaces should check [property@ChannelJoinDetails:nickname-supported]
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 * before displaying this option to the user.
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
197 * Since: 3.0
42326
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 */
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 properties[PROP_NICKNAME] = g_param_spec_string(
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200 "nickname", "nickname",
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201 "The channel-specific nickname for the user.",
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 NULL,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205 /**
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 * PurpleChannelJoinDetails:nickname-supported:
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 *
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208 * Whether or not the protocol supports channel-specific nicknames.
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
210 * Since: 3.0
42326
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
211 */
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212 properties[PROP_NICKNAME_SUPPORTED] = g_param_spec_boolean(
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213 "nickname-supported", "nickname-supported",
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 "Whether or not the protocol supports channel-specific nicknames.",
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
215 FALSE,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218 /**
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
219 * PurpleChannelJoinDetails:password:
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
220 *
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
221 * The password to use to join the channel.
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
222 *
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
223 * This is protocol specific so be sure to check
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
224 * [property@PurpleChannelJoinDetails:password-supported] before displaying
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
225 * this option to the user.
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
227 * Since: 3.0
42326
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
228 */
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229 properties[PROP_PASSWORD] = g_param_spec_string(
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
230 "password", "password",
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
231 "The password to join this channel.",
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232 NULL,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235 /**
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
236 * PurpleChannelJoinDetails:password-supported:
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237 *
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
238 * Whether or not the protocol supports channel passwords.
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
239 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
240 * Since: 3.0
42326
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
241 */
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242 properties[PROP_PASSWORD_SUPPORTED] = g_param_spec_boolean(
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
243 "password-supported", "password-supported",
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
244 "Whether or not the protocol supports channel passwords.",
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
245 FALSE,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
246 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
247
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
248 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
249 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
250
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251 /******************************************************************************
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
252 * Public API
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
253 *****************************************************************************/
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
254 PurpleChannelJoinDetails *
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
255 purple_channel_join_details_new(gboolean nickname_supported,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
256 gboolean password_supported)
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
257 {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
258 return g_object_new(
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
259 PURPLE_TYPE_CHANNEL_JOIN_DETAILS,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
260 "nickname-supported", nickname_supported,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
261 "password-supported", password_supported,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
262 NULL);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
263 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
264
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
265 const char *
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
266 purple_channel_join_details_get_name(PurpleChannelJoinDetails *details) {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
267 g_return_val_if_fail(PURPLE_IS_CHANNEL_JOIN_DETAILS(details), NULL);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
268
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
269 return details->name;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
270 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
271
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
272 void
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
273 purple_channel_join_details_set_name(PurpleChannelJoinDetails *details,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
274 const char *name)
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
275 {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
276 g_return_if_fail(PURPLE_IS_CHANNEL_JOIN_DETAILS(details));
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42613
diff changeset
278 if(g_set_str(&details->name, name)) {
42326
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279 g_object_notify_by_pspec(G_OBJECT(details), properties[PROP_NAME]);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
280 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
281 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
282
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
283 const char *
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
284 purple_channel_join_details_get_nickname(PurpleChannelJoinDetails *details) {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285 g_return_val_if_fail(PURPLE_IS_CHANNEL_JOIN_DETAILS(details), NULL);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287 return details->nickname;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
288 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
289
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 void
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
291 purple_channel_join_details_set_nickname(PurpleChannelJoinDetails *details,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
292 const char *nickname)
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
293 {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294 g_return_if_fail(PURPLE_IS_CHANNEL_JOIN_DETAILS(details));
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
295
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42613
diff changeset
296 if(g_set_str(&details->nickname, nickname)) {
42326
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
297 g_object_notify_by_pspec(G_OBJECT(details), properties[PROP_NICKNAME]);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
298 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
299 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
300
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
301 gboolean
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
302 purple_channel_join_details_get_nickname_supported(PurpleChannelJoinDetails *details) {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
303 g_return_val_if_fail(PURPLE_IS_CHANNEL_JOIN_DETAILS(details), FALSE);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
304
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
305 return details->nickname_supported;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
306 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
307
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
308 const char *
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
309 purple_channel_join_details_get_password(PurpleChannelJoinDetails *details) {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
310 g_return_val_if_fail(PURPLE_IS_CHANNEL_JOIN_DETAILS(details), NULL);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
311
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
312 return details->password;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
313 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
314
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
315 void
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
316 purple_channel_join_details_set_password(PurpleChannelJoinDetails *details,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
317 const char *password)
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
318 {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
319 g_return_if_fail(PURPLE_IS_CHANNEL_JOIN_DETAILS(details));
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
320
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42613
diff changeset
321 if(g_set_str(&details->password, password)) {
42326
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
322 g_object_notify_by_pspec(G_OBJECT(details), properties[PROP_PASSWORD]);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
323 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
324 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
325
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
326 gboolean
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
327 purple_channel_join_details_get_password_supported(PurpleChannelJoinDetails *details)
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
328 {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
329 g_return_val_if_fail(PURPLE_IS_CHANNEL_JOIN_DETAILS(details), FALSE);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
330
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
331 return details->password_supported;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
332 }
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
333
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
334 void
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
335 purple_channel_join_details_merge(PurpleChannelJoinDetails *source,
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
336 PurpleChannelJoinDetails *destination)
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
337 {
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
338 GObject *obj = NULL;
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
339 const char *value = NULL;
42364
b739bb0811f7 Merge whether nickname and password are supported when merging ChannelJoinDetails
Gary Kramlich <grim@reaperworld.com>
parents: 42326
diff changeset
340 gboolean supported = FALSE;
42326
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
341
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
342 g_return_if_fail(PURPLE_IS_CHANNEL_JOIN_DETAILS(source));
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
343 g_return_if_fail(PURPLE_IS_CHANNEL_JOIN_DETAILS(destination));
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
344
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
345 obj = G_OBJECT(destination);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
346 g_object_freeze_notify(obj);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
347
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
348 value = purple_channel_join_details_get_name(source);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
349 purple_channel_join_details_set_name(destination, value);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
350
42364
b739bb0811f7 Merge whether nickname and password are supported when merging ChannelJoinDetails
Gary Kramlich <grim@reaperworld.com>
parents: 42326
diff changeset
351 supported = purple_channel_join_details_get_nickname_supported(source);
b739bb0811f7 Merge whether nickname and password are supported when merging ChannelJoinDetails
Gary Kramlich <grim@reaperworld.com>
parents: 42326
diff changeset
352 purple_channel_join_details_set_nickname_supported(destination, supported);
b739bb0811f7 Merge whether nickname and password are supported when merging ChannelJoinDetails
Gary Kramlich <grim@reaperworld.com>
parents: 42326
diff changeset
353
42326
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
354 value = purple_channel_join_details_get_nickname(source);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
355 purple_channel_join_details_set_nickname(destination, value);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
356
42364
b739bb0811f7 Merge whether nickname and password are supported when merging ChannelJoinDetails
Gary Kramlich <grim@reaperworld.com>
parents: 42326
diff changeset
357 supported = purple_channel_join_details_get_password_supported(source);
b739bb0811f7 Merge whether nickname and password are supported when merging ChannelJoinDetails
Gary Kramlich <grim@reaperworld.com>
parents: 42326
diff changeset
358 purple_channel_join_details_set_password_supported(destination, supported);
b739bb0811f7 Merge whether nickname and password are supported when merging ChannelJoinDetails
Gary Kramlich <grim@reaperworld.com>
parents: 42326
diff changeset
359
42326
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
360 value = purple_channel_join_details_get_password(source);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
361 purple_channel_join_details_set_password(destination, value);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
362
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
363 g_object_thaw_notify(obj);
3fc3dd614b4e Create PurpleChannelJoinDetails to replace the components for join chats
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
364 }

mercurial