Fri, 12 Aug 2016 18:53:31 -0500
Move PurpleChat to it's own file
|
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" |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | #include "dbus-maybe.h" |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | #include "utils.h" |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | #define PURPLE_CHAT_GET_PRIVATE(obj) \ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | (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
|
30 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | typedef struct _PurpleChatPrivate PurpleChatPrivate; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | /* Private data for a chat node */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | struct _PurpleChatPrivate { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | char *alias; /* The display name of this chat. */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | 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
|
37 | 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
|
38 | join the chat */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | 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
|
41 | constructed. */ |
|
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 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | /* Chat property enums */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | enum |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | PROP_0, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | PROP_ALIAS, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | PROP_ACCOUNT, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | PROP_COMPONENTS, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | PROP_LAST |
|
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 | /****************************************************************************** |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | * Globals |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | *****************************************************************************/ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | static PurpleBlistNode *blistnode_parent_class; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | static GParamSpec *properties[PROP_LAST]; |
|
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 | /****************************************************************************** |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | * API |
|
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 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | const char *purple_chat_get_name(PurpleChat *chat) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(chat); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | g_return_val_if_fail(priv != NULL, NULL); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | if ((priv->alias != NULL) && (*priv->alias != '\0')) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | return priv->alias; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | return purple_chat_get_name_only(chat); |
|
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 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | 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
|
77 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | char *ret = NULL; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | PurpleProtocol *protocol = NULL; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(chat); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | g_return_val_if_fail(priv != NULL, NULL); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | 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
|
85 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT_IFACE, info)) { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | PurpleProtocolChatEntry *pce; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | 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
|
89 | pce = parts->data; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | 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
|
91 | g_list_foreach(parts, (GFunc)g_free, NULL); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | g_list_free(parts); |
|
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 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | return ret; |
|
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 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | void |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | 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
|
100 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | char *old_alias; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | char *new_alias = NULL; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(chat); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | g_return_if_fail(priv != NULL); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | if ((alias != NULL) && (*alias != '\0')) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | new_alias = purple_utf8_strip_unprintables(alias); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | if (!purple_strequal(priv->alias, new_alias)) { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | g_free(new_alias); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | return; |
|
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 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | old_alias = priv->alias; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | if ((new_alias != NULL) && (*new_alias != '\0')) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | priv->alias = new_alias; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | else { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | priv->alias = NULL; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | g_free(new_alias); /* could be "\0" */ |
|
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 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | 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
|
126 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | if (ops) { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | if (ops->save_node) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | ops->save_node(PURPLE_BLIST_NODE(chat)); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | if (ops->update) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | 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
|
132 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | 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
|
135 | chat, old_alias); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | g_free(old_alias); |
|
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 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | PurpleGroup * |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | purple_chat_get_group(PurpleChat *chat) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | 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
|
143 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | return PURPLE_GROUP(PURPLE_BLIST_NODE(chat)->parent); |
|
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 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | PurpleAccount * |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | purple_chat_get_account(PurpleChat *chat) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(chat); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | g_return_val_if_fail(priv != NULL, NULL); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | return priv->account; |
|
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 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | GHashTable * |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | purple_chat_get_components(PurpleChat *chat) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(chat); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | g_return_val_if_fail(priv != NULL, NULL); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | return priv->components; |
|
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 | /****************************************************************************** |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | * GObject Stuff |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | *****************************************************************************/ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | static void |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | 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
|
172 | GParamSpec *pspec) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | PurpleChat *chat = PURPLE_CHAT(obj); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(chat); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | switch (param_id) { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | case PROP_ALIAS: |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | if (priv->is_constructed) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | 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
|
181 | else |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | priv->alias = |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | 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
|
184 | break; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | case PROP_ACCOUNT: |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | priv->account = g_value_get_object(value); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | break; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | case PROP_COMPONENTS: |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | priv->components = g_value_get_pointer(value); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | break; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | default: |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 | 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
|
193 | break; |
|
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 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | static void |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | 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
|
199 | GParamSpec *pspec) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | PurpleChat *chat = PURPLE_CHAT(obj); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(chat); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
204 | switch (param_id) { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
205 | case PROP_ALIAS: |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | g_value_set_string(value, priv->alias); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | break; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
208 | case PROP_ACCOUNT: |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | 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
|
210 | break; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | case PROP_COMPONENTS: |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | 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
|
213 | break; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | default: |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | 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
|
216 | break; |
|
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 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | /* GObject initialization function */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | static void |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | purple_chat_init(GTypeInstance *instance, gpointer klass) |
|
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 | PURPLE_DBUS_REGISTER_POINTER(PURPLE_CHAT(instance), PurpleChat); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
225 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | /* Called when done constructing */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
228 | static void |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
229 | purple_chat_constructed(GObject *object) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | PurpleChat *chat = PURPLE_CHAT(object); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
232 | PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(chat); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
233 | PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
|
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 | G_OBJECT_CLASS(blistnode_parent_class)->constructed(object); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | if (ops != NULL && ops->new_node != NULL) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | ops->new_node(PURPLE_BLIST_NODE(chat)); |
|
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 | priv->is_constructed = TRUE; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | /* GObject finalize function */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | static void |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | purple_chat_finalize(GObject *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 | PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(object); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
248 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
249 | g_free(priv->alias); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
250 | g_hash_table_destroy(priv->components); |
|
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 | PURPLE_DBUS_UNREGISTER_POINTER(object); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
253 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 | G_OBJECT_CLASS(blistnode_parent_class)->finalize(object); |
|
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 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
257 | /* Class initializer function */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
258 | static void purple_chat_class_init(PurpleChatClass *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 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
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 | 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
|
263 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
264 | obj_class->finalize = purple_chat_finalize; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
265 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
266 | /* Setup properties */ |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | obj_class->get_property = purple_chat_get_property; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | obj_class->set_property = purple_chat_set_property; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
269 | obj_class->constructed = purple_chat_constructed; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
271 | g_type_class_add_private(klass, sizeof(PurpleChatPrivate)); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
272 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
273 | properties[PROP_ALIAS] = g_param_spec_string( |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
274 | "alias", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
275 | "Alias", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
276 | "The alias for the chat.", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
277 | NULL, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
278 | 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
|
279 | ); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
280 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
281 | properties[PROP_ACCOUNT] = g_param_spec_object( |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
282 | "account", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
283 | "Account", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
284 | "The account that the chat belongs to.", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
285 | PURPLE_TYPE_ACCOUNT, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
286 | 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
|
287 | ); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
288 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
289 | properties[PROP_COMPONENTS] = g_param_spec_pointer( |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
290 | "components", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
291 | "Components", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
292 | "The protocol components of the chat.", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
293 | 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
|
294 | ); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
295 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
296 | 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
|
297 | } |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
298 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
299 | GType |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
300 | purple_chat_get_type(void) |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
301 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
302 | static GType type = 0; |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
303 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
304 | if(type == 0) { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
305 | static const GTypeInfo info = { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
306 | sizeof(PurpleChatClass), |
|
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 | NULL, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
309 | (GClassInitFunc)purple_chat_class_init, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
310 | NULL, |
|
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 | sizeof(PurpleChat), |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
313 | 0, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
314 | (GInstanceInitFunc)purple_chat_init, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
315 | NULL, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
316 | }; |
|
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 | 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
|
319 | "PurpleChat", |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
320 | &info, 0); |
|
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 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
323 | return type; |
|
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 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
326 | PurpleChat * |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
327 | 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
|
328 | { |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
329 | 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
|
330 | g_return_val_if_fail(components != NULL, NULL); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
331 | |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
332 | return g_object_new(PURPLE_TYPE_CHAT, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
333 | "account", account, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
334 | "alias", alias, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
335 | "components", components, |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
336 | NULL); |
|
12ce09a23094
Move PurpleChat to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
337 | } |