Tue, 02 Oct 2018 16:01:52 -0500
libpurple: Remove pointer registration for DBus API
|
37947
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * purple |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * Purple is the legal property of its developers, whose names are too numerous |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * source distribution. |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * This program is free software; you can redistribute it and/or modify |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * (at your option) any later version. |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * GNU General Public License for more details. |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * along with this program; if not, write to the Free Software |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | * |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include "internal.h" |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | #include "chat.h" |
|
37951
c80bc6ef5d20
Not sure how this go typoed and not found until now, but here's a fix
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
25 | #include "util.h" |
|
37947
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | #define PURPLE_CHAT_GET_PRIVATE(obj) \ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_CHAT, PurpleChatPrivate)) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | typedef struct _PurpleChatPrivate PurpleChatPrivate; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | /* Private data for a chat node */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | struct _PurpleChatPrivate { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | char *alias; /* The display name of this chat. */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | PurpleAccount *account; /* The account this chat is attached to */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | GHashTable *components; /* the stuff the protocol needs to know to |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | join the chat */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | gboolean is_constructed; /* Indicates if the chat has finished being |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | constructed. */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | }; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | /* Chat property enums */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | enum |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | PROP_0, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | PROP_ALIAS, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | PROP_ACCOUNT, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | PROP_COMPONENTS, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | PROP_LAST |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | }; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | /****************************************************************************** |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | * Globals |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | *****************************************************************************/ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | static PurpleBlistNode *blistnode_parent_class; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | static GParamSpec *properties[PROP_LAST]; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | /****************************************************************************** |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | * API |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | *****************************************************************************/ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | const char *purple_chat_get_name(PurpleChat *chat) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(chat); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | g_return_val_if_fail(priv != NULL, NULL); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | if ((priv->alias != NULL) && (*priv->alias != '\0')) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | return priv->alias; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | return purple_chat_get_name_only(chat); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | const char *purple_chat_get_name_only(PurpleChat *chat) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | char *ret = NULL; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | PurpleProtocol *protocol = NULL; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(chat); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | g_return_val_if_fail(priv != NULL, NULL); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | protocol = purple_protocols_find(purple_account_get_protocol_id(priv->account)); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT_IFACE, info)) { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | PurpleProtocolChatEntry *pce; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | GList *parts = purple_protocol_chat_iface_info(protocol, purple_account_get_connection(priv->account)); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | pce = parts->data; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | ret = g_hash_table_lookup(priv->components, pce->identifier); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | g_list_foreach(parts, (GFunc)g_free, NULL); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | g_list_free(parts); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | return ret; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | void |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | purple_chat_set_alias(PurpleChat *chat, const char *alias) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | char *old_alias; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | char *new_alias = NULL; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(chat); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | g_return_if_fail(priv != NULL); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | if ((alias != NULL) && (*alias != '\0')) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | new_alias = purple_utf8_strip_unprintables(alias); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | if (!purple_strequal(priv->alias, new_alias)) { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | g_free(new_alias); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | return; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | old_alias = priv->alias; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | if ((new_alias != NULL) && (*new_alias != '\0')) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | priv->alias = new_alias; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | else { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | priv->alias = NULL; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | g_free(new_alias); /* could be "\0" */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | g_object_notify_by_pspec(G_OBJECT(chat), properties[PROP_ALIAS]); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | if (ops) { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | if (ops->save_node) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | ops->save_node(PURPLE_BLIST_NODE(chat)); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | if (ops->update) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | ops->update(purple_blist_get_buddy_list(), PURPLE_BLIST_NODE(chat)); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | chat, old_alias); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | g_free(old_alias); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | PurpleGroup * |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | purple_chat_get_group(PurpleChat *chat) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | g_return_val_if_fail(PURPLE_IS_CHAT(chat), NULL); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | return PURPLE_GROUP(PURPLE_BLIST_NODE(chat)->parent); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | PurpleAccount * |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | purple_chat_get_account(PurpleChat *chat) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(chat); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | g_return_val_if_fail(priv != NULL, NULL); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | return priv->account; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | GHashTable * |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | purple_chat_get_components(PurpleChat *chat) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(chat); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | g_return_val_if_fail(priv != NULL, NULL); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | return priv->components; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | /****************************************************************************** |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | * GObject Stuff |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | *****************************************************************************/ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | static void |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | purple_chat_set_property(GObject *obj, guint param_id, const GValue *value, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | GParamSpec *pspec) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | PurpleChat *chat = PURPLE_CHAT(obj); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(chat); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | switch (param_id) { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | case PROP_ALIAS: |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | if (priv->is_constructed) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | purple_chat_set_alias(chat, g_value_get_string(value)); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | else |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | priv->alias = |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | purple_utf8_strip_unprintables(g_value_get_string(value)); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | break; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | case PROP_ACCOUNT: |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | priv->account = g_value_get_object(value); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | break; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | case PROP_COMPONENTS: |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | priv->components = g_value_get_pointer(value); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | break; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | default: |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 | break; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | static void |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | purple_chat_get_property(GObject *obj, guint param_id, GValue *value, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | GParamSpec *pspec) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | PurpleChat *chat = PURPLE_CHAT(obj); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(chat); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | switch (param_id) { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
204 | case PROP_ALIAS: |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
205 | g_value_set_string(value, priv->alias); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | break; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | case PROP_ACCOUNT: |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
208 | g_value_set_object(value, purple_chat_get_account(chat)); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | break; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | case PROP_COMPONENTS: |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | g_value_set_pointer(value, purple_chat_get_components(chat)); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | break; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | default: |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | break; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | /* GObject initialization function */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | static void |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | purple_chat_init(GTypeInstance *instance, gpointer klass) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
225 | /* Called when done constructing */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | static void |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | purple_chat_constructed(GObject *object) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
228 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
229 | PurpleChat *chat = PURPLE_CHAT(object); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(chat); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
232 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
233 | G_OBJECT_CLASS(blistnode_parent_class)->constructed(object); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
234 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | if (ops != NULL && ops->new_node != NULL) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | ops->new_node(PURPLE_BLIST_NODE(chat)); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | priv->is_constructed = TRUE; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | /* GObject finalize function */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | static void |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | purple_chat_finalize(GObject *object) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(object); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
246 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
247 | g_free(priv->alias); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
248 | g_hash_table_destroy(priv->components); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
249 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
250 | G_OBJECT_CLASS(blistnode_parent_class)->finalize(object); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
251 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
253 | /* Class initializer function */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 | static void purple_chat_class_init(PurpleChatClass *klass) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
255 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
256 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
257 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
258 | blistnode_parent_class = g_type_class_peek_parent(klass); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
259 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
260 | obj_class->finalize = purple_chat_finalize; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
261 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
262 | /* Setup properties */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
263 | obj_class->get_property = purple_chat_get_property; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
264 | obj_class->set_property = purple_chat_set_property; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
265 | obj_class->constructed = purple_chat_constructed; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
266 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | g_type_class_add_private(klass, sizeof(PurpleChatPrivate)); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
269 | properties[PROP_ALIAS] = g_param_spec_string( |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | "alias", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
271 | "Alias", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
272 | "The alias for the chat.", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
273 | NULL, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
274 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
275 | ); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
276 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
277 | properties[PROP_ACCOUNT] = g_param_spec_object( |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
278 | "account", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
279 | "Account", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
280 | "The account that the chat belongs to.", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
281 | PURPLE_TYPE_ACCOUNT, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
282 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
283 | ); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
284 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
285 | properties[PROP_COMPONENTS] = g_param_spec_pointer( |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
286 | "components", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
287 | "Components", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
288 | "The protocol components of the chat.", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
289 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
290 | ); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
291 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
292 | g_object_class_install_properties(obj_class, PROP_LAST, properties); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
293 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
294 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
295 | GType |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
296 | purple_chat_get_type(void) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
297 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
298 | static GType type = 0; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
299 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
300 | if(type == 0) { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
301 | static const GTypeInfo info = { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
302 | sizeof(PurpleChatClass), |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
303 | NULL, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
304 | NULL, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
305 | (GClassInitFunc)purple_chat_class_init, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
306 | NULL, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
307 | NULL, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
308 | sizeof(PurpleChat), |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
309 | 0, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
310 | (GInstanceInitFunc)purple_chat_init, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
311 | NULL, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
312 | }; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
313 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
314 | type = g_type_register_static(PURPLE_TYPE_BLIST_NODE, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
315 | "PurpleChat", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
316 | &info, 0); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
317 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
318 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
319 | return type; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
320 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
321 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
322 | PurpleChat * |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
323 | purple_chat_new(PurpleAccount *account, const char *alias, GHashTable *components) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
324 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
325 | g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
326 | g_return_val_if_fail(components != NULL, NULL); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
327 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
328 | return g_object_new(PURPLE_TYPE_CHAT, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
329 | "account", account, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
330 | "alias", alias, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
331 | "components", components, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
332 | NULL); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
333 | } |