Sat, 13 Apr 2024 23:08:29 -0500
Remove PurpleChat
This has been on the chopping block for awhile, and we're finally chopping it.
Testing Done:
Checked in with the turtles.
Reviewed at https://reviews.imfreedom.org/r/3120/
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Purple is the legal property of its developers, whose names are too numerous |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
9 | * This library is free software; you can redistribute it and/or modify it |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
10 | * under the terms of the GNU General Public License as published by the Free |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
11 | * Software Foundation; either version 2 of the License, or (at your option) |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
12 | * any later version. |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
14 | * This library is distributed in the hope that it will be useful, but WITHOUT |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
17 | * more details. |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License along with |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
20 | * this library; if not, see <https://www.gnu.org/licenses/>. |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include "group.h" |
|
40870
e3397381fd35
Remove includes from protocol.h that weren't used there and deal with the fallout
Gary Kramlich <grim@reaperworld.com>
parents:
40765
diff
changeset
|
24 | |
|
e3397381fd35
Remove includes from protocol.h that weren't used there and deal with the fallout
Gary Kramlich <grim@reaperworld.com>
parents:
40765
diff
changeset
|
25 | #include "debug.h" |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40079
diff
changeset
|
26 | #include "purpleprivate.h" |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
27 | #include "purpleprotocolserver.h" |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | typedef struct _PurpleGroupPrivate PurpleGroupPrivate; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | /****************************************************************************** |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | * Private Data |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | *****************************************************************************/ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | struct _PurpleGroupPrivate { |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | char *name; /* The name of this group. */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | gboolean is_constructed; /* Indicates if the group has finished being |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | constructed. */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | }; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | /* Group property enums */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | enum |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | { |
|
42584
687260353985
Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41960
diff
changeset
|
43 | PROP_0, |
|
687260353985
Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41960
diff
changeset
|
44 | PROP_NAME, |
|
687260353985
Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41960
diff
changeset
|
45 | N_PROPERTIES, |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | }; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | /****************************************************************************** |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | * Globals |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | *****************************************************************************/ |
|
42584
687260353985
Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41960
diff
changeset
|
51 | static GParamSpec *properties[N_PROPERTIES] = {NULL, }; |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
52 | |
|
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
53 | G_DEFINE_TYPE_WITH_PRIVATE(PurpleGroup, purple_group, |
|
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
54 | PURPLE_TYPE_COUNTING_NODE); |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | /****************************************************************************** |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | * Group API |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | *****************************************************************************/ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | GSList *purple_group_get_accounts(PurpleGroup *group) { |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | GSList *l = NULL; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | PurpleBlistNode *gnode, *cnode, *bnode; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | gnode = (PurpleBlistNode *)group; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | for (cnode = gnode->child; cnode; cnode = cnode->next) { |
| 42722 | 66 | if (PURPLE_IS_META_CONTACT(cnode)) { |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | for (bnode = cnode->child; bnode; bnode = bnode->next) { |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | if (PURPLE_IS_BUDDY(bnode)) { |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | if (!g_slist_find(l, purple_buddy_get_account(PURPLE_BUDDY(bnode)))) |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | l = g_slist_append(l, purple_buddy_get_account(PURPLE_BUDDY(bnode))); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | return l; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | gboolean purple_group_on_account(PurpleGroup *g, PurpleAccount *account) { |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | PurpleBlistNode *cnode; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | for (cnode = ((PurpleBlistNode *)g)->child; cnode; cnode = cnode->next) { |
|
41733
a9085b52de8b
Rename PurpleContact to PurpleMetaContact.
Gary Kramlich <grim@reaperworld.com>
parents:
41685
diff
changeset
|
82 | if (PURPLE_IS_META_CONTACT(cnode)) { |
|
a9085b52de8b
Rename PurpleContact to PurpleMetaContact.
Gary Kramlich <grim@reaperworld.com>
parents:
41685
diff
changeset
|
83 | if(purple_meta_contact_on_account((PurpleMetaContact *) cnode, account)) |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | return TRUE; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | return FALSE; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | /* |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | * TODO: If merging, prompt the user if they want to merge. |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | void purple_group_set_name(PurpleGroup *source, const char *name) { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
94 | PurpleGroupPrivate *priv = NULL; |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | PurpleGroup *dest; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | gchar *old_name; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | gchar *new_name; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | GList *moved_buddies = NULL; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | GSList *accts; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
101 | g_return_if_fail(PURPLE_IS_GROUP(source)); |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | g_return_if_fail(name != NULL); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
104 | priv = purple_group_get_instance_private(source); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
105 | |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | new_name = purple_utf8_strip_unprintables(name); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | if (*new_name == '\0' || purple_strequal(new_name, priv->name)) { |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | g_free(new_name); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | return; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | dest = purple_blist_find_group(new_name); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | if (dest != NULL && purple_utf8_strcasecmp(priv->name, |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
115 | purple_group_get_name(dest)) != 0) { |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | /* We're merging two groups */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | PurpleBlistNode *prev, *child, *next; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | prev = _purple_blist_get_last_child((PurpleBlistNode*)dest); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | child = PURPLE_BLIST_NODE(source)->child; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | /* |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | * TODO: This seems like a dumb way to do this... why not just |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | * append all children from the old group to the end of the new |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | * one? Protocols might be expecting to receive an add_buddy() for |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | * each moved buddy... |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | while (child) |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | { |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | next = child->next; |
|
41733
a9085b52de8b
Rename PurpleContact to PurpleMetaContact.
Gary Kramlich <grim@reaperworld.com>
parents:
41685
diff
changeset
|
131 | if (PURPLE_IS_META_CONTACT(child)) { |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | PurpleBlistNode *bnode; |
|
41733
a9085b52de8b
Rename PurpleContact to PurpleMetaContact.
Gary Kramlich <grim@reaperworld.com>
parents:
41685
diff
changeset
|
133 | purple_blist_add_contact((PurpleMetaContact *)child, dest, prev); |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | for (bnode = child->child; bnode != NULL; bnode = bnode->next) { |
|
41733
a9085b52de8b
Rename PurpleContact to PurpleMetaContact.
Gary Kramlich <grim@reaperworld.com>
parents:
41685
diff
changeset
|
135 | purple_blist_add_buddy((PurpleBuddy *)bnode, (PurpleMetaContact *)child, |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | NULL, bnode->prev); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | moved_buddies = g_list_append(moved_buddies, bnode); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | prev = child; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | } else { |
|
40765
a5381c20e802
Use specific purple_debug_* functions
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40708
diff
changeset
|
141 | purple_debug_error("blistnodetypes", "Unknown child type in group %s", priv->name); |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | child = next; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | /* Make a copy of the old group name and then delete the old group */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | old_name = g_strdup(priv->name); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | purple_blist_remove_group(source); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | source = dest; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | g_free(new_name); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | } else { |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | /* A simple rename */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | PurpleBlistNode *cnode, *bnode; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | /* Build a GList of all buddies in this group */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | for (cnode = PURPLE_BLIST_NODE(source)->child; cnode != NULL; cnode = cnode->next) { |
|
41733
a9085b52de8b
Rename PurpleContact to PurpleMetaContact.
Gary Kramlich <grim@reaperworld.com>
parents:
41685
diff
changeset
|
157 | if (PURPLE_IS_META_CONTACT(cnode)) |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | moved_buddies = g_list_append(moved_buddies, bnode); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | purple_blist_update_groups_cache(source, new_name); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | old_name = priv->name; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | priv->name = new_name; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | |
|
42584
687260353985
Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41960
diff
changeset
|
167 | g_object_notify_by_pspec(G_OBJECT(source), properties[PROP_NAME]); |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | /* Save our changes */ |
|
39676
1e8394d47205
Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39675
diff
changeset
|
171 | purple_blist_save_node(purple_blist_get_default(), |
|
1e8394d47205
Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39675
diff
changeset
|
172 | PURPLE_BLIST_NODE(source)); |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | /* Update the UI */ |
|
39675
583e2ba6e78e
Add wrapper functions for some PurpleBlistUiOps.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39665
diff
changeset
|
175 | purple_blist_update_node(purple_blist_get_default(), |
|
583e2ba6e78e
Add wrapper functions for some PurpleBlistUiOps.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39665
diff
changeset
|
176 | PURPLE_BLIST_NODE(source)); |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | /* Notify all protocols */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | /* TODO: Is this condition needed? Seems like it would always be TRUE */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | if(old_name && !purple_strequal(priv->name, old_name)) { |
|
40079
a37a1e349491
Replace g_[s]list_remove with g_[s]list_delete_link.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
181 | for (accts = purple_group_get_accounts(source); accts; |
|
a37a1e349491
Replace g_[s]list_remove with g_[s]list_delete_link.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
182 | accts = g_slist_delete_link(accts, accts)) { |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | PurpleAccount *account = accts->data; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | PurpleConnection *gc = NULL; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | PurpleProtocol *protocol = NULL; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | GList *l = NULL, *buddies = NULL; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | gc = purple_account_get_connection(account); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | if(gc) |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | protocol = purple_connection_get_protocol(gc); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | if(!protocol) |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | continue; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | for(l = moved_buddies; l; l = l->next) { |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | PurpleBuddy *buddy = PURPLE_BUDDY(l->data); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | if(buddy && purple_buddy_get_account(buddy) == account) |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | buddies = g_list_append(buddies, (PurpleBlistNode *)buddy); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | |
|
39759
ea1401483849
Rename *_GET_*_IFACE to more standard *_GET_IFACE.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39676
diff
changeset
|
203 | if(PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER, rename_group)) { |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
204 | purple_protocol_server_rename_group(PURPLE_PROTOCOL_SERVER(protocol), |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
205 | gc, old_name, source, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
206 | buddies); |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | } else { |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
208 | GList *cur, *groups = NULL; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | /* Make a list of what the groups each buddy is in */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | for(cur = buddies; cur; cur = cur->next) { |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | PurpleBlistNode *node = (PurpleBlistNode *)cur->data; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | groups = g_list_prepend(groups, node->parent->parent); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | purple_account_remove_buddies(account, buddies, groups); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | g_list_free(groups); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | purple_account_add_buddies(account, buddies, NULL); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | g_list_free(buddies); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | g_list_free(moved_buddies); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
225 | g_free(old_name); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | |
|
42584
687260353985
Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41960
diff
changeset
|
227 | g_object_notify_by_pspec(G_OBJECT(source), properties[PROP_NAME]); |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
228 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
229 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | const char *purple_group_get_name(PurpleGroup *group) { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
231 | PurpleGroupPrivate *priv = NULL; |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
232 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
233 | g_return_val_if_fail(PURPLE_IS_GROUP(group), NULL); |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
234 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
235 | priv = purple_group_get_instance_private(group); |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | return priv->name; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | /****************************************************************************** |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | * GObject Stuff |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | *****************************************************************************/ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | /* Set method for GObject properties */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | static void |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | purple_group_set_property(GObject *obj, guint param_id, const GValue *value, |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | GParamSpec *pspec) |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
246 | { |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
247 | PurpleGroup *group = PURPLE_GROUP(obj); |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
248 | PurpleGroupPrivate *priv = purple_group_get_instance_private(group); |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
249 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
250 | switch (param_id) { |
|
42584
687260353985
Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41960
diff
changeset
|
251 | case PROP_NAME: |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 | if (priv->is_constructed) |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
253 | purple_group_set_name(group, g_value_get_string(value)); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 | else |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
255 | priv->name = |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
256 | purple_utf8_strip_unprintables(g_value_get_string(value)); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
257 | break; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
258 | default: |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
259 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
260 | break; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
261 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
262 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
263 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
264 | /* Get method for GObject properties */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
265 | static void |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
266 | purple_group_get_property(GObject *obj, guint param_id, GValue *value, |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | GParamSpec *pspec) |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | { |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
269 | PurpleGroup *group = PURPLE_GROUP(obj); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
271 | switch (param_id) { |
|
42584
687260353985
Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41960
diff
changeset
|
272 | case PROP_NAME: |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
273 | g_value_set_string(value, purple_group_get_name(group)); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
274 | break; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
275 | default: |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
276 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
277 | break; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
278 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
279 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
280 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
281 | /* GObject initialization function */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
282 | static void |
|
41960
c8a4853205e3
Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41733
diff
changeset
|
283 | purple_group_init(G_GNUC_UNUSED PurpleGroup *group) { |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
284 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
285 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
286 | /* Called when done constructing */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
287 | static void |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
288 | purple_group_constructed(GObject *object) { |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
289 | PurpleGroup *group = PURPLE_GROUP(object); |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
290 | PurpleGroupPrivate *priv = purple_group_get_instance_private(group); |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
291 | |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
292 | G_OBJECT_CLASS(purple_group_parent_class)->constructed(object); |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
293 | |
|
39676
1e8394d47205
Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39675
diff
changeset
|
294 | purple_blist_new_node(purple_blist_get_default(), |
|
1e8394d47205
Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39675
diff
changeset
|
295 | PURPLE_BLIST_NODE(group)); |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
296 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
297 | priv->is_constructed = TRUE; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
298 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
299 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
300 | /* GObject finalize function */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
301 | static void |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
302 | purple_group_finalize(GObject *object) { |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
303 | PurpleGroupPrivate *priv = purple_group_get_instance_private( |
|
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
304 | PURPLE_GROUP(object)); |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
305 | |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
306 | g_free(priv->name); |
|
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
307 | |
|
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
308 | G_OBJECT_CLASS(purple_group_parent_class)->finalize(object); |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
309 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
310 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
311 | /* Class initializer function */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
312 | static void |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
313 | purple_group_class_init(PurpleGroupClass *klass) { |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
314 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
315 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
316 | obj_class->finalize = purple_group_finalize; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
317 | obj_class->constructed = purple_group_constructed; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
318 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
319 | /* Setup properties */ |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
320 | obj_class->get_property = purple_group_get_property; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
321 | obj_class->set_property = purple_group_set_property; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
322 | |
|
42656
df9aafbae930
Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
323 | /** |
|
df9aafbae930
Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
324 | * PurpleGroup:name: |
|
df9aafbae930
Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
325 | * |
|
df9aafbae930
Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
326 | * The name of the group. |
|
df9aafbae930
Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
327 | * |
|
df9aafbae930
Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
328 | * Since: 3.0 |
|
df9aafbae930
Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
329 | */ |
|
42584
687260353985
Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41960
diff
changeset
|
330 | properties[PROP_NAME] = g_param_spec_string( |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
331 | "name", |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
332 | "Name", |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
333 | "Name of the group.", |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
334 | NULL, |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
335 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
336 | ); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
337 | |
|
42584
687260353985
Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41960
diff
changeset
|
338 | g_object_class_install_properties(obj_class, N_PROPERTIES, properties); |
|
37944
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
339 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
340 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
341 | PurpleGroup * |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
342 | purple_group_new(const char *name) { |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
343 | PurpleGroup *group; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
344 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
345 | if (name == NULL || name[0] == '\0') |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
346 | name = PURPLE_BLIST_DEFAULT_GROUP_NAME; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
347 | if (g_strcmp0(name, "Buddies") == 0) |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
348 | name = PURPLE_BLIST_DEFAULT_GROUP_NAME; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
349 | if (g_strcmp0(name, _purple_blist_get_localized_default_group_name()) == 0) |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
350 | name = PURPLE_BLIST_DEFAULT_GROUP_NAME; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
351 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
352 | group = purple_blist_find_group(name); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
353 | if (group != NULL) |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
354 | return group; |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
355 | |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
356 | return g_object_new(PURPLE_TYPE_GROUP, "name", name, NULL); |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
357 | } |
|
e42e19eba593
Pull PurpleGroup out into it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
358 |