libpurple/purpleconversation.c

Sun, 10 Aug 2025 23:44:08 +0800

author
Gong Zhile <gongzl@stu.hebust.edu.cn>
date
Sun, 10 Aug 2025 23:44:08 +0800
branch
purple_conversation_find_message_by_id
changeset 43309
099e1dfb856b
parent 43303
cddf3066f1bc
permissions
-rw-r--r--

Add Purple.Conversation.find_message_by_id

The method was added so that a protocol or plugin could easily lookup
for the reference for a message. This will be especially useful when a
protocol received a quoted message but only with an id.

66
cf3be86d0b63 [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
2 * Purple - Internet Messaging Library
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
4 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
5 * Purple is the legal property of its developers, whose names are too numerous
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
7 * source distribution.
66
cf3be86d0b63 [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.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: 42592
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: 42592
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: 42592
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: 42592
diff changeset
12 * any later version.
66
cf3be86d0b63 [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.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: 42592
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: 42592
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: 42592
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: 42592
diff changeset
17 * more details.
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
18 *
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42592
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: 42592
diff changeset
20 * this library; if not, see <https://www.gnu.org/licenses/>.
66
cf3be86d0b63 [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21 */
40441
f23c7e772667 Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
22
f23c7e772667 Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
23 #include <glib/gi18n-lib.h>
f23c7e772667 Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
24
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
25 #include "purpleconversation.h"
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
26
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5860
diff changeset
27 #include "debug.h"
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40948
diff changeset
28 #include "purpleconversationmanager.h"
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
29 #include "purpleconversationmember.h"
41007
90d2dee9b3dc Fix the includes for the purpleenums rename
Gary Kramlich <grim@reaperworld.com>
parents: 40992
diff changeset
30 #include "purpleenums.h"
41090
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
31 #include "purplehistorymanager.h"
40564
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents: 40541
diff changeset
32 #include "purplemarkup.h"
42321
9c0a6010fbc5 Use PurpleProtocolConversation if it's available when sending a message.
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
33 #include "purpleprotocolconversation.h"
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
34 #include "purpletags.h"
42997
368deff13c21 Split purpleprivate.h up into individual files
Gary Kramlich <grim@reaperworld.com>
parents: 42981
diff changeset
35 #include "request.h"
42725
ceb13f1de2d2 Remove PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 42720
diff changeset
36 #include "util.h"
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5860
diff changeset
37
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
38 struct _PurpleConversation {
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
39 GObject parent;
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
40
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
41 char *id;
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
42 PurpleConversationType type;
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
43 PurpleAccount *account;
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
44
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
45 gboolean avatar_editable;
43301
0e43dc8462e8 Replace Purple.Avatar with Purple.Image
Gary Kramlich <grim@reaperworld.com>
parents: 43234
diff changeset
46 PurpleImage *avatar;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
47
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
48 char *alias;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
49
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
50 char *title;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
51 gboolean title_editable;
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
52 gboolean title_generated;
11581
5c7f44be5dfe [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11552
diff changeset
53
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
54 gboolean age_restricted;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
55 gboolean description_editable;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
56 char *description;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
57
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
58 gboolean topic_editable;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
59 char *topic;
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
60 PurpleContactInfo *topic_author;
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
61 GDateTime *topic_updated;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
62
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
63 char *user_nickname;
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
64 gboolean favorite;
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
65 GDateTime *created_on;
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
66 PurpleContactInfo *creator;
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
67 gboolean online;
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
68 gboolean federated;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
69 PurpleTags *tags;
42891
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
70
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
71 PurpleConversationMembers *members;
42299
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
72
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
73 GListStore *messages;
42848
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
74 gboolean needs_attention;
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
75
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
76 PurpleTypingState typing_state;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
77 guint typing_state_source;
42902
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
78 GDateTime *last_typing;
42908
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
79
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
80 gboolean logging;
42916
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
81 gboolean drafting;
43064
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
82
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
83 GError *error;
43234
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
84
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
85 char *url;
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
86 };
27967
01a64c630e35 More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents: 27954
diff changeset
87
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
88 enum {
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
89 PROP_0,
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
90 PROP_ID,
42800
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
91 PROP_GLOBAL_ID,
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
92 PROP_TYPE,
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
93 PROP_ACCOUNT,
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
94 PROP_AVATAR_EDITABLE,
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
95 PROP_AVATAR,
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
96 PROP_ALIAS,
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
97 PROP_TITLE_EDITABLE,
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
98 PROP_TITLE,
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
99 PROP_TITLE_FOR_DISPLAY,
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
100 PROP_TITLE_GENERATED,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
101 PROP_AGE_RESTRICTED,
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
102 PROP_DESCRIPTION_EDITABLE,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
103 PROP_DESCRIPTION,
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
104 PROP_TOPIC_EDITABLE,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
105 PROP_TOPIC,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
106 PROP_TOPIC_AUTHOR,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
107 PROP_TOPIC_UPDATED,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
108 PROP_USER_NICKNAME,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
109 PROP_FAVORITE,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
110 PROP_CREATED_ON,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
111 PROP_CREATOR,
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
112 PROP_ONLINE,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
113 PROP_FEDERATED,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
114 PROP_TAGS,
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
115 PROP_MEMBERS,
42299
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
116 PROP_MESSAGES,
42848
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
117 PROP_NEEDS_ATTENTION,
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
118 PROP_TYPING_STATE,
42908
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
119 PROP_LOGGING,
42916
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
120 PROP_DRAFTING,
43064
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
121 PROP_ERROR,
43234
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
122 PROP_URL,
42584
687260353985 Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42557
diff changeset
123 N_PROPERTIES,
27967
01a64c630e35 More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents: 27954
diff changeset
124 };
42584
687260353985 Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42557
diff changeset
125 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
66
cf3be86d0b63 [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
126
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
127 enum {
42736
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
128 SIG_PRESENT,
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
129 N_SIGNALS,
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
130 };
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
131 static guint signals[N_SIGNALS] = {0, };
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
132
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
133 G_DEFINE_FINAL_TYPE(PurpleConversation, purple_conversation, G_TYPE_OBJECT)
39380
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39352
diff changeset
134
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
135 static void purple_conversation_account_connected_cb(GObject *obj,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
136 GParamSpec *pspec,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
137 gpointer data);
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
138
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
139 /**************************************************************************
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
140 * Helpers
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
141 **************************************************************************/
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
142 static void
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
143 purple_conversation_set_title_generated(PurpleConversation *conversation,
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
144 gboolean title_generated)
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
145 {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
146 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
147
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
148 /* If conversation isn't a dm or group dm, and title_generated is being set
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
149 * to %TRUE exit immediately because generating the title is only allowed
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
150 * on DMs and GroupDMs.
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
151 */
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
152 if(conversation->type != PURPLE_CONVERSATION_TYPE_DM &&
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
153 conversation->type != PURPLE_CONVERSATION_TYPE_GROUP_DM &&
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
154 title_generated)
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
155 {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
156 return;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
157 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
158
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
159 if(conversation->title_generated != title_generated) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
160 GObject *obj = G_OBJECT(conversation);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
161
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
162 conversation->title_generated = title_generated;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
163
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
164 g_object_freeze_notify(obj);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
165
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
166 if(conversation->title_generated) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
167 purple_conversation_generate_title(conversation);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
168 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
169
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
170 g_object_notify_by_pspec(G_OBJECT(conversation),
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
171 properties[PROP_TITLE_GENERATED]);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
172
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
173 g_object_thaw_notify(obj);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
174 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
175 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
176
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
177 static void
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
178 purple_conversation_set_id(PurpleConversation *conversation, const char *id) {
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
179 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
180
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42760
diff changeset
181 if(g_set_str(&conversation->id, id)) {
42800
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
182 GObject *obj = G_OBJECT(conversation);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
183
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
184 g_object_freeze_notify(obj);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
185 g_object_notify_by_pspec(obj, properties[PROP_ID]);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
186 g_object_notify_by_pspec(obj, properties[PROP_GLOBAL_ID]);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
187 g_object_thaw_notify(obj);
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
188 }
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
189 }
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
190
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
191 static void
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
192 purple_conversation_set_account(PurpleConversation *conversation,
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
193 PurpleAccount *account)
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
194 {
42514
461893f76c54 Automatically add accounts as a member when creating conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42486
diff changeset
195 PurpleConversationMember *member = NULL;
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
196
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
197 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
198
42514
461893f76c54 Automatically add accounts as a member when creating conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42486
diff changeset
199 /* Remove the account from the conversation if it's a member. */
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
200 if(PURPLE_IS_ACCOUNT(conversation->account)) {
42514
461893f76c54 Automatically add accounts as a member when creating conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42486
diff changeset
201 if(PURPLE_IS_CONVERSATION_MEMBER(member)) {
42805
3e77e81168a5 Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42800
diff changeset
202 PurpleContactInfo *info = NULL;
3e77e81168a5 Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42800
diff changeset
203
3e77e81168a5 Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42800
diff changeset
204 info = purple_account_get_contact_info(conversation->account);
42891
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
205 purple_conversation_members_remove_member(conversation->members,
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
206 info, FALSE, NULL);
42514
461893f76c54 Automatically add accounts as a member when creating conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42486
diff changeset
207 }
461893f76c54 Automatically add accounts as a member when creating conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42486
diff changeset
208 }
461893f76c54 Automatically add accounts as a member when creating conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42486
diff changeset
209
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
210 if(g_set_object(&conversation->account, account)) {
42800
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
211 GObject *obj = NULL;
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
212
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
213 if(PURPLE_IS_ACCOUNT(conversation->account)) {
42805
3e77e81168a5 Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42800
diff changeset
214 PurpleContactInfo *info = NULL;
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
215 PurpleConversationMember *member = NULL;
42968
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
216 const char *tag_value = NULL;
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
217
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
218 tag_value = purple_account_get_id(conversation->account);
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
219 purple_tags_add_with_value(conversation->tags, "account-id",
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
220 tag_value);
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
221
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
222 tag_value = purple_account_get_protocol_id(conversation->account);
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
223 purple_tags_add_with_value(conversation->tags, "protocol-id",
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
224 tag_value);
42805
3e77e81168a5 Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42800
diff changeset
225
3e77e81168a5 Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42800
diff changeset
226 info = purple_account_get_contact_info(account);
42891
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
227 member = purple_conversation_members_add_member(conversation->members,
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
228 info, FALSE, NULL);
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
229
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
230 g_object_bind_property(conversation, "typing-state",
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
231 member, "typing-state",
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
232 G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
42514
461893f76c54 Automatically add accounts as a member when creating conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42486
diff changeset
233
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
234 g_signal_connect_object(account, "notify::connected",
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
235 G_CALLBACK(purple_conversation_account_connected_cb),
42939
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
236 conversation, G_CONNECT_DEFAULT);
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
237 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
238
42800
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
239 obj = G_OBJECT(conversation);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
240 g_object_freeze_notify(obj);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
241 g_object_notify_by_pspec(obj, properties[PROP_ACCOUNT]);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
242 g_object_notify_by_pspec(obj, properties[PROP_GLOBAL_ID]);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
243 g_object_thaw_notify(obj);
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
244 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
245 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
246
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
247 static void
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
248 purple_conversation_set_conversation_type(PurpleConversation *conversation,
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
249 PurpleConversationType type)
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
250 {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
251 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
252
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
253 if(type != conversation->type) {
42968
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
254 const char *tag_value = NULL;
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
255
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
256 conversation->type = type;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
257
42968
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
258 switch(conversation->type) {
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
259 case PURPLE_CONVERSATION_TYPE_DM:
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
260 tag_value = "dm";
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
261 break;
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
262 case PURPLE_CONVERSATION_TYPE_GROUP_DM:
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
263 tag_value = "group-dm";
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
264 break;
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
265 case PURPLE_CONVERSATION_TYPE_CHANNEL:
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
266 tag_value = "channel";
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
267 break;
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
268 case PURPLE_CONVERSATION_TYPE_THREAD:
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
269 tag_value = "thread";
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
270 break;
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
271 case PURPLE_CONVERSATION_TYPE_UNSET:
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
272 default:
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
273 tag_value = NULL;
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
274 }
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
275
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
276 purple_tags_add_with_value(conversation->tags, "type", tag_value);
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
277
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
278 g_object_notify_by_pspec(G_OBJECT(conversation),
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
279 properties[PROP_TYPE]);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
280 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
281 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
282
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
283 static void
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
284 purple_conversation_set_federated(PurpleConversation *conversation,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
285 gboolean federated)
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
286 {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
287 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
288
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
289 if(conversation->federated != federated) {
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
290 conversation->federated = federated;
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
291
42968
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
292 if(federated) {
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
293 purple_tags_add(conversation->tags, "federated");
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
294 }
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
295
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
296 g_object_notify_by_pspec(G_OBJECT(conversation),
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
297 properties[PROP_FEDERATED]);
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
298 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
299 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
300
4359
cf899ee07d1d [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
301 static void
42743
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
302 purple_conversation_send_message_async_cb(GObject *source,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
303 GAsyncResult *result,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
304 gpointer data)
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
305 {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
306 PurpleMessage *message = NULL;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
307 PurpleProtocolConversation *protocol = NULL;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
308 GError *error = NULL;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
309 GTask *task = data;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
310 gboolean success = FALSE;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
311
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
312 /* task and result share a cancellable, so we just need to clear task to
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
313 * make sure its callback gets called.
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
314 */
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
315 if(g_task_return_error_if_cancelled(G_TASK(task))) {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
316 g_clear_object(&task);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
317
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
318 return;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
319 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
320
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
321 protocol = PURPLE_PROTOCOL_CONVERSATION(source);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
322 message = g_task_get_task_data(G_TASK(task));
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
323
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
324 success = purple_protocol_conversation_send_message_finish(protocol,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
325 result, &error);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
326
43303
cddf3066f1bc Fix some broken logic in Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents: 43301
diff changeset
327 if(error != NULL) {
42743
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
328 purple_message_set_error(message, error);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
329 g_task_return_error(task, error);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
330 } else {
43303
cddf3066f1bc Fix some broken logic in Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents: 43301
diff changeset
331 if(success) {
cddf3066f1bc Fix some broken logic in Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents: 43301
diff changeset
332 /* If the protocol didn't set delivered, set it now. */
cddf3066f1bc Fix some broken logic in Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents: 43301
diff changeset
333 if(!purple_message_get_delivered(message)) {
cddf3066f1bc Fix some broken logic in Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents: 43301
diff changeset
334 purple_message_set_delivered(message, TRUE);
cddf3066f1bc Fix some broken logic in Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents: 43301
diff changeset
335 }
42743
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
336 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
337
43303
cddf3066f1bc Fix some broken logic in Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents: 43301
diff changeset
338 g_task_return_boolean(task, success);
42743
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
339 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
340
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
341 g_clear_object(&task);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
342 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
343
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
344 /**************************************************************************
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
345 * Callbacks
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
346 **************************************************************************/
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
347 static void
42891
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
348 purple_conversation_members_item_changed_cb(G_GNUC_UNUSED GListModel *model,
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
349 G_GNUC_UNUSED guint position,
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
350 G_GNUC_UNUSED guint removed,
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
351 G_GNUC_UNUSED guint added,
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
352 gpointer data)
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
353 {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
354 PurpleConversation *conversation = data;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
355
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
356 if(purple_conversation_get_title_generated(conversation)) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
357 purple_conversation_generate_title(conversation);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
358 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
359 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
360
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
361 static void
42981
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
362 purple_conversation_members_member_added_cb(G_GNUC_UNUSED PurpleConversationMembers *members,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
363 PurpleConversationMember *member,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
364 gboolean announce,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
365 const char *join_message,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
366 gpointer data)
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
367 {
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
368 PurpleConversation *conversation = data;
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
369 PurpleMessage *message = NULL;
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
370 char *contents = NULL;
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
371
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
372 if(!announce) {
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
373 return;
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
374 }
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
375
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
376 if(purple_strempty(join_message)) {
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
377 contents = g_strdup_printf(_("%s has joined the conversation"),
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
378 purple_conversation_member_get_name_for_display(member));
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
379 } else {
43018
78cd7c6e8c40 If a message as given when a user join/parts a conversation use it explicitly
Gary Kramlich <grim@reaperworld.com>
parents: 43017
diff changeset
380 contents = g_strdup(join_message);
42981
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
381 }
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
382
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
383 message = g_object_new(
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
384 PURPLE_TYPE_MESSAGE,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
385 "contents", contents,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
386 "event", TRUE,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
387 NULL);
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
388
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
389 g_free(contents);
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
390
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
391 purple_conversation_write_message(conversation, message);
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
392 }
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
393
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
394 static void
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
395 purple_conversation_members_member_removed_cb(G_GNUC_UNUSED PurpleConversationMembers *members,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
396 PurpleConversationMember *member,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
397 gboolean announce,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
398 const char *part_message,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
399 gpointer data)
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
400 {
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
401 PurpleConversation *conversation = data;
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
402 PurpleMessage *message = NULL;
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
403 char *contents = NULL;
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
404
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
405 if(!announce) {
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
406 return;
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
407 }
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
408
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
409 if(purple_strempty(part_message)) {
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
410 contents = g_strdup_printf(_("%s has left the conversation"),
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
411 purple_conversation_member_get_name_for_display(member));
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
412 } else {
43018
78cd7c6e8c40 If a message as given when a user join/parts a conversation use it explicitly
Gary Kramlich <grim@reaperworld.com>
parents: 43017
diff changeset
413 contents = g_strdup(part_message);
42981
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
414 }
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
415
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
416 message = g_object_new(
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
417 PURPLE_TYPE_MESSAGE,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
418 "contents", contents,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
419 "event", TRUE,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
420 NULL);
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
421
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
422 g_free(contents);
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
423
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
424 purple_conversation_write_message(conversation, message);
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
425 }
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
426
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
427 static void
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
428 purple_conversation_account_connected_cb(GObject *obj,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
429 G_GNUC_UNUSED GParamSpec *pspec,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
430 gpointer data)
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
431 {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
432 PurpleConversation *conversation = data;
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
433 gboolean connected = purple_account_is_connected(PURPLE_ACCOUNT(obj));
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
434
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
435 if(conversation->federated) {
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
436 /* If the account changed to connected and the conversation is
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
437 * federated we do nothing. But if the account went offline, we can
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
438 * safely set the conversation to offline.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
439 */
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
440 if(!connected) {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
441 purple_conversation_set_online(conversation, FALSE);
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
442 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
443 } else {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
444 purple_conversation_set_online(conversation, connected);
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
445 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
446 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
447
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
448 /*
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
449 * purple_conversation_typing_state_typing_cb: (skip)
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
450 * @data: The conversation instance.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
451 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
452 * If this callback manages to get called, it means the user has stopped typing
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
453 * and we need to change the typing state of the conversation to paused.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
454 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
455 * There's some specific ordering we have to worry about because
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
456 * purple_conversation_set_typing_state will attempt to remove the source that
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
457 * called us even though we're going to exit cleanly after we call that
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
458 * function.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
459 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
460 * To avoid this, we just set the typing_state_source to 0 which will make
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
461 * purple_conversation_set_typing_state not try to cancel the source.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
462 */
42939
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
463 static void
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
464 purple_conversation_typing_state_typing_cb(gpointer data) {
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
465 PurpleConversation *conversation = data;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
466
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
467 conversation->typing_state_source = 0;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
468
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
469 purple_conversation_set_typing_state(conversation,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
470 PURPLE_TYPING_STATE_PAUSED);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
471 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
472
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
473 /*
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
474 * purple_conversation_typing_state_paused_cb: (skip)
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
475 * @data: The conversation instance.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
476 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
477 * If this callback manages to get called, it means the user has stopped typing
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
478 * some time ago, and we need to set the state to NONE.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
479 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
480 * There's some specific ordering we have to worry about because
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
481 * purple_conversation_set_typing_state will attempt to remove the source that
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
482 * called us even though we're going to exit cleanly after we call that
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
483 * function.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
484 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
485 * To avoid this, we just set the typing_state_source to 0 which will make
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
486 * purple_conversation_set_typing_state not try to cancel the source.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
487 */
42939
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
488 static void
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
489 purple_conversation_typing_state_paused_cb(gpointer data) {
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
490 PurpleConversation *conversation = data;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
491
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
492 conversation->typing_state_source = 0;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
493
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
494 purple_conversation_set_typing_state(conversation,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
495 PURPLE_TYPING_STATE_NONE);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
496 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
497
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
498 /**************************************************************************
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
499 * GObject Implementation
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
500 **************************************************************************/
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
501 static void
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
502 purple_conversation_set_property(GObject *obj, guint param_id,
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
503 const GValue *value, GParamSpec *pspec)
14582
ae974395b9da [gaim-migrate @ 17240]
Lars T. Mikkelsen
parents: 14254
diff changeset
504 {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
505 PurpleConversation *conversation = PURPLE_CONVERSATION(obj);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
506
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
507 switch (param_id) {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
508 case PROP_ID:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
509 purple_conversation_set_id(conversation, g_value_get_string(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
510 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
511 case PROP_TYPE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
512 purple_conversation_set_conversation_type(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
513 g_value_get_enum(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
514 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
515 case PROP_ACCOUNT:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
516 purple_conversation_set_account(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
517 g_value_get_object(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
518 break;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
519 case PROP_AVATAR_EDITABLE:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
520 purple_conversation_set_avatar_editable(conversation,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
521 g_value_get_boolean(value));
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
522 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
523 case PROP_AVATAR:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
524 purple_conversation_set_avatar(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
525 g_value_get_object(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
526 break;
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
527 case PROP_ALIAS:
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
528 purple_conversation_set_alias(conversation, g_value_get_string(value));
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
529 break;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
530 case PROP_TITLE_EDITABLE:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
531 purple_conversation_set_title_editable(conversation,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
532 g_value_get_boolean(value));
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
533 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
534 case PROP_TITLE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
535 purple_conversation_set_title(conversation, g_value_get_string(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
536 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
537 case PROP_AGE_RESTRICTED:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
538 purple_conversation_set_age_restricted(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
539 g_value_get_boolean(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
540 break;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
541 case PROP_DESCRIPTION_EDITABLE:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
542 purple_conversation_set_description_editable(conversation,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
543 g_value_get_boolean(value));
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
544 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
545 case PROP_DESCRIPTION:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
546 purple_conversation_set_description(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
547 g_value_get_string(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
548 break;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
549 case PROP_TOPIC_EDITABLE:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
550 purple_conversation_set_topic_editable(conversation,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
551 g_value_get_boolean(value));
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
552 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
553 case PROP_TOPIC:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
554 purple_conversation_set_topic(conversation, g_value_get_string(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
555 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
556 case PROP_TOPIC_AUTHOR:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
557 purple_conversation_set_topic_author(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
558 g_value_get_object(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
559 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
560 case PROP_TOPIC_UPDATED:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
561 purple_conversation_set_topic_updated(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
562 g_value_get_boxed(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
563 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
564 case PROP_USER_NICKNAME:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
565 purple_conversation_set_user_nickname(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
566 g_value_get_string(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
567 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
568 case PROP_FAVORITE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
569 purple_conversation_set_favorite(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
570 g_value_get_boolean(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
571 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
572 case PROP_CREATED_ON:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
573 purple_conversation_set_created_on(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
574 g_value_get_boxed(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
575 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
576 case PROP_CREATOR:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
577 purple_conversation_set_creator(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
578 g_value_get_object(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
579 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
580 case PROP_ONLINE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
581 purple_conversation_set_online(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
582 g_value_get_boolean(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
583 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
584 case PROP_FEDERATED:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
585 purple_conversation_set_federated(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
586 g_value_get_boolean(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
587 break;
42848
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
588 case PROP_NEEDS_ATTENTION:
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
589 purple_conversation_set_needs_attention(conversation,
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
590 g_value_get_boolean(value));
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
591 break;
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
592 case PROP_TYPING_STATE:
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
593 purple_conversation_set_typing_state(conversation,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
594 g_value_get_enum(value));
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
595 break;
42908
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
596 case PROP_LOGGING:
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
597 purple_conversation_set_logging(conversation,
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
598 g_value_get_boolean(value));
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
599 break;
42916
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
600 case PROP_DRAFTING:
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
601 purple_conversation_set_drafting(conversation,
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
602 g_value_get_boolean(value));
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
603 break;
43234
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
604 case PROP_URL:
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
605 purple_conversation_set_url(conversation, g_value_get_string(value));
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
606 break;
43064
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
607 case PROP_ERROR:
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
608 purple_conversation_set_error(conversation, g_value_get_boxed(value));
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
609 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
610 default:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
611 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
612 break;
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
613 }
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
614 }
23312
0530decb56e4 Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23278
diff changeset
615
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
616 static void
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
617 purple_conversation_get_property(GObject *obj, guint param_id, GValue *value,
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
618 GParamSpec *pspec)
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
619 {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
620 PurpleConversation *conversation = PURPLE_CONVERSATION(obj);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
621
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
622 switch(param_id) {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
623 case PROP_ID:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
624 g_value_set_string(value, purple_conversation_get_id(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
625 break;
42800
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
626 case PROP_GLOBAL_ID:
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
627 g_value_take_string(value,
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
628 purple_conversation_get_global_id(conversation));
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
629 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
630 case PROP_TYPE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
631 g_value_set_enum(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
632 purple_conversation_get_conversation_type(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
633 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
634 case PROP_ACCOUNT:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
635 g_value_set_object(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
636 purple_conversation_get_account(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
637 break;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
638 case PROP_AVATAR_EDITABLE:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
639 g_value_set_boolean(value,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
640 purple_conversation_get_avatar_editable(conversation));
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
641 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
642 case PROP_AVATAR:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
643 g_value_set_object(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
644 purple_conversation_get_avatar(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
645 break;
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
646 case PROP_ALIAS:
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
647 g_value_set_string(value, purple_conversation_get_alias(conversation));
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
648 break;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
649 case PROP_TITLE_EDITABLE:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
650 g_value_set_boolean(value,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
651 purple_conversation_get_title_editable(conversation));
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
652 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
653 case PROP_TITLE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
654 g_value_set_string(value, purple_conversation_get_title(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
655 break;
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
656 case PROP_TITLE_FOR_DISPLAY:
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
657 g_value_set_string(value,
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
658 purple_conversation_get_title_for_display(conversation));
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
659 break;
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
660 case PROP_TITLE_GENERATED:
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
661 g_value_set_boolean(value,
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
662 purple_conversation_get_title_generated(conversation));
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
663 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
664 case PROP_AGE_RESTRICTED:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
665 g_value_set_boolean(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
666 purple_conversation_get_age_restricted(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
667 break;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
668 case PROP_DESCRIPTION_EDITABLE:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
669 g_value_set_boolean(value,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
670 purple_conversation_get_description_editable(conversation));
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
671 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
672 case PROP_DESCRIPTION:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
673 g_value_set_string(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
674 purple_conversation_get_description(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
675 break;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
676 case PROP_TOPIC_EDITABLE:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
677 g_value_set_boolean(value,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
678 purple_conversation_get_topic_editable(conversation));
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
679 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
680 case PROP_TOPIC:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
681 g_value_set_string(value, purple_conversation_get_topic(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
682 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
683 case PROP_TOPIC_AUTHOR:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
684 g_value_set_object(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
685 purple_conversation_get_topic_author(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
686 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
687 case PROP_TOPIC_UPDATED:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
688 g_value_set_boxed(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
689 purple_conversation_get_topic_updated(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
690 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
691 case PROP_USER_NICKNAME:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
692 g_value_set_string(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
693 purple_conversation_get_user_nickname(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
694 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
695 case PROP_FAVORITE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
696 g_value_set_boolean(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
697 purple_conversation_get_favorite(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
698 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
699 case PROP_CREATED_ON:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
700 g_value_set_boxed(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
701 purple_conversation_get_created_on(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
702 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
703 case PROP_CREATOR:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
704 g_value_set_object(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
705 purple_conversation_get_creator(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
706 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
707 case PROP_ONLINE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
708 g_value_set_boolean(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
709 purple_conversation_get_online(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
710 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
711 case PROP_FEDERATED:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
712 g_value_set_boolean(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
713 purple_conversation_get_federated(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
714 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
715 case PROP_TAGS:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
716 g_value_set_object(value, purple_conversation_get_tags(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
717 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
718 case PROP_MEMBERS:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
719 g_value_set_object(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
720 purple_conversation_get_members(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
721 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
722 case PROP_MESSAGES:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
723 g_value_set_object(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
724 purple_conversation_get_messages(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
725 break;
42848
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
726 case PROP_NEEDS_ATTENTION:
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
727 g_value_set_boolean(value,
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
728 purple_conversation_get_needs_attention(conversation));
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
729 break;
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
730 case PROP_TYPING_STATE:
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
731 g_value_set_enum(value,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
732 purple_conversation_get_typing_state(conversation));
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
733 break;
42908
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
734 case PROP_LOGGING:
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
735 g_value_set_boolean(value,
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
736 purple_conversation_get_logging(conversation));
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
737 break;
42916
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
738 case PROP_DRAFTING:
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
739 g_value_set_boolean(value,
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
740 purple_conversation_get_drafting(conversation));
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
741 break;
43064
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
742 case PROP_ERROR:
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
743 g_value_set_boxed(value, purple_conversation_get_error(conversation));
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
744 break;
43234
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
745 case PROP_URL:
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
746 g_value_set_string(value, purple_conversation_get_url(conversation));
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
747 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
748 default:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
749 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
750 break;
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
751 }
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
752 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
753
39380
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39352
diff changeset
754 static void
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
755 purple_conversation_init(PurpleConversation *conversation) {
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
756 conversation->tags = purple_tags_new();
42968
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
757
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
758 /* If type provided during construction, the type setter isn't called,
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
759 * which means this tag doesn't get created. To work around this, we set it
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
760 * here, which will be overridden by the type setter.
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
761 */
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
762 purple_tags_add(conversation->tags, "type");
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
763
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
764 conversation->messages = g_list_store_new(PURPLE_TYPE_MESSAGE);
42891
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
765
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
766 conversation->members = purple_conversation_members_new();
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
767 g_signal_connect_object(conversation->members, "items-changed",
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
768 G_CALLBACK(purple_conversation_members_item_changed_cb),
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
769 conversation, G_CONNECT_DEFAULT);
42981
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
770 g_signal_connect_object(conversation->members, "member-added",
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
771 G_CALLBACK(purple_conversation_members_member_added_cb),
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
772 conversation, G_CONNECT_DEFAULT);
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
773 g_signal_connect_object(conversation->members, "member-removed",
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
774 G_CALLBACK(purple_conversation_members_member_removed_cb),
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
775 conversation, G_CONNECT_DEFAULT);
39380
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39352
diff changeset
776 }
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39352
diff changeset
777
34687
aebc4dd321bf Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents: 34684
diff changeset
778 static void
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
779 purple_conversation_constructed(GObject *object) {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
780 PurpleConversation *conversation = PURPLE_CONVERSATION(object);
31906
d1ffe4b1de91 Add constant-time lookup of row in the userlist by way of PurpleConvChatBuddy ui_data
Paul Aurich <darkrain42@pidgin.im>
parents: 31905
diff changeset
781
39380
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39352
diff changeset
782 G_OBJECT_CLASS(purple_conversation_parent_class)->constructed(object);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
783
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
784 if(purple_strempty(conversation->title)) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
785 if(conversation->type == PURPLE_CONVERSATION_TYPE_DM ||
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
786 conversation->type == PURPLE_CONVERSATION_TYPE_GROUP_DM)
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
787 {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
788 /* There's no way to add members during construction, so just call
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
789 * set_title_generated.
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
790 */
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
791 purple_conversation_set_title_generated(conversation, TRUE);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
792 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
793 }
5858
1bc64d957067 [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
794 }
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
795
36109
2e4dd08b0131 Conversations: fix glib warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36108
diff changeset
796 static void
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
797 purple_conversation_finalize(GObject *object) {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
798 PurpleConversation *conversation = PURPLE_CONVERSATION(object);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30706
diff changeset
799
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
800 purple_request_close_with_handle(conversation);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
801
42778
4aa4ab7b24a7 Add the ability to leave conversations to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42773
diff changeset
802 g_clear_object(&conversation->account);
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
803 g_clear_pointer(&conversation->id, g_free);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
804 g_clear_object(&conversation->avatar);
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
805 g_clear_pointer(&conversation->alias, g_free);
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
806 g_clear_pointer(&conversation->title, g_free);
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
807
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
808 g_clear_pointer(&conversation->description, g_free);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
809 g_clear_pointer(&conversation->topic, g_free);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
810 g_clear_object(&conversation->topic_author);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
811 g_clear_pointer(&conversation->topic_updated, g_date_time_unref);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
812 g_clear_pointer(&conversation->user_nickname, g_free);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
813 g_clear_pointer(&conversation->created_on, g_date_time_unref);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
814 g_clear_object(&conversation->creator);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
815 g_clear_object(&conversation->tags);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
816 g_clear_object(&conversation->members);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
817 g_clear_object(&conversation->messages);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
818
42902
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
819 g_clear_handle_id(&conversation->typing_state_source, g_source_remove);
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
820 g_clear_pointer(&conversation->last_typing, g_date_time_unref);
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
821
43064
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
822 g_clear_error(&conversation->error);
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
823
43234
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
824 g_clear_pointer(&conversation->url, g_free);
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
825
39380
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39352
diff changeset
826 G_OBJECT_CLASS(purple_conversation_parent_class)->finalize(object);
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
827 }
19904
8abf4c2056eb Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19859
diff changeset
828
34687
aebc4dd321bf Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents: 34684
diff changeset
829 static void
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
830 purple_conversation_class_init(PurpleConversationClass *klass) {
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
831 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
832
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
833 obj_class->constructed = purple_conversation_constructed;
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
834 obj_class->finalize = purple_conversation_finalize;
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
835 obj_class->get_property = purple_conversation_get_property;
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
836 obj_class->set_property = purple_conversation_set_property;
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
837
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
838 /**
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
839 * PurpleConversation:id:
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
840 *
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
841 * An opaque identifier for this conversation. Generally speaking this is
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
842 * protocol dependent and should only be used as a unique identifier.
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
843 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
844 * Since: 3.0
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
845 */
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
846 properties[PROP_ID] = g_param_spec_string(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
847 "id", NULL, NULL,
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
848 NULL,
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
849 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
850
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
851 /**
42800
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
852 * PurpleConversation:global-id:
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
853 *
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
854 * A libpurple global id for the conversation.
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
855 *
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
856 * This is an opaque value but it ties the conversation to the libpurple
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
857 * account it belongs to, which makes it globally unique inside of
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
858 * libpurple.
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
859 *
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
860 * Since: 3.0
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
861 */
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
862 properties[PROP_GLOBAL_ID] = g_param_spec_string(
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
863 "global-id", NULL, NULL,
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
864 NULL,
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
865 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
866
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
867 /**
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
868 * PurpleConversation:type:
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
869 *
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
870 * A type hint for the conversation. This may be useful for protocols, but
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
871 * libpurple treats all conversations the same.
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
872 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
873 * Since: 3.0
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
874 */
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
875 properties[PROP_TYPE] = g_param_spec_enum(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
876 "type", NULL, NULL,
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
877 PURPLE_TYPE_CONVERSATION_TYPE,
42653
584895b844d2 PurpleConversationType's values were pascal case when they should be upper snake case
Gary Kramlich <grim@reaperworld.com>
parents: 42613
diff changeset
878 PURPLE_CONVERSATION_TYPE_UNSET,
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
879 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
880
42656
df9aafbae930 Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents: 42654
diff changeset
881 /**
df9aafbae930 Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents: 42654
diff changeset
882 * PurpleConversation:account:
df9aafbae930 Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents: 42654
diff changeset
883 *
df9aafbae930 Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents: 42654
diff changeset
884 * The account this conversation belongs to.
df9aafbae930 Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents: 42654
diff changeset
885 *
df9aafbae930 Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents: 42654
diff changeset
886 * 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: 42654
diff changeset
887 */
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
888 properties[PROP_ACCOUNT] = g_param_spec_object(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
889 "account", NULL, NULL,
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
890 PURPLE_TYPE_ACCOUNT,
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
891 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
892
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
893 /**
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
894 * PurpleConversation:avatar-editable:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
895 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
896 * Whether or not the user can edit the avatar for this conversation.
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
897 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
898 * This property should typically only be set by protocols and should be
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
899 * changed if the user's permissions in the conversation change.
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
900 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
901 * User interfaces should check
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
902 * [method@ProtocolConversation.implements_set_avatar] before making this
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
903 * action available to users.
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
904 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
905 * Since: 3.0
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
906 */
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
907 properties[PROP_AVATAR_EDITABLE] = g_param_spec_boolean(
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
908 "avatar-editable", NULL, NULL,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
909 FALSE,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
910 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
911
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
912 /**
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
913 * PurpleConversation:avatar:
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
914 *
43301
0e43dc8462e8 Replace Purple.Avatar with Purple.Image
Gary Kramlich <grim@reaperworld.com>
parents: 43234
diff changeset
915 * The avatar for the conversation.
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
916 *
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
917 * Not all protocols support this and most user interfaces will use the
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
918 * avatar of the remote contact for direct messages.
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
919 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
920 * Since: 3.0
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
921 */
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
922 properties[PROP_AVATAR] = g_param_spec_object(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
923 "avatar", NULL, NULL,
43301
0e43dc8462e8 Replace Purple.Avatar with Purple.Image
Gary Kramlich <grim@reaperworld.com>
parents: 43234
diff changeset
924 PURPLE_TYPE_IMAGE,
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
925 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
926
42656
df9aafbae930 Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents: 42654
diff changeset
927 /**
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
928 * PurpleConversation:alias:
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
929 *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
930 * An alias for the conversation that is local to the libpurple user.
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
931 *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
932 * Since: 3.0
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
933 */
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
934 properties[PROP_ALIAS] = g_param_spec_string(
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
935 "alias", NULL, NULL,
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
936 NULL,
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
937 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
938
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
939 /**
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
940 * PurpleConversation:title-editable:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
941 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
942 * Whether or not the user can edit the title.
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
943 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
944 * This property should typically only be set by protocols and should be
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
945 * changed if the user's permissions in the conversation change.
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
946 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
947 * User interfaces should check
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
948 * [method@ProtocolConversation.implements_set_title] before making this
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
949 * action available to users.
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
950 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
951 * Since: 3.0
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
952 */
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
953 properties[PROP_TITLE_EDITABLE] = g_param_spec_boolean(
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
954 "title-editable", NULL, NULL,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
955 FALSE,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
956 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
957
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
958 /**
42656
df9aafbae930 Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents: 42654
diff changeset
959 * PurpleConversation:title:
df9aafbae930 Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents: 42654
diff changeset
960 *
df9aafbae930 Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents: 42654
diff changeset
961 * The title of the conversation.
df9aafbae930 Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents: 42654
diff changeset
962 *
df9aafbae930 Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents: 42654
diff changeset
963 * 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: 42654
diff changeset
964 */
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
965 properties[PROP_TITLE] = g_param_spec_string(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
966 "title", NULL, NULL,
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
967 NULL,
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
968 G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
969
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
970 /**
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
971 * PurpleConversation:title-for-display:
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
972 *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
973 * The title that should be displayed for the conversation based on which
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
974 * properties are set.
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
975 *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
976 * If [property@Conversation:alias] is set, that will be returned.
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
977 *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
978 * If alias is not set but [property@Conversation:title] is set, then value
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
979 * of title will be returned.
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
980 *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
981 * As a fallback, [property@Conversation:id] will be returned if nothing
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
982 * else is set.
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
983 *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
984 * Since: 3.0
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
985 */
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
986 properties[PROP_TITLE_FOR_DISPLAY] = g_param_spec_string(
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
987 "title-for-display", NULL, NULL,
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
988 NULL,
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
989 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
990
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
991 /**
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
992 * PurpleConversation:title-generated:
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
993 *
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
994 * Whether or not the title of the conversation was generated by
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
995 * [method@Conversation.generate_title].
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
996 *
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
997 * Note: This only works on DMs and GroupDMs.
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
998 *
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
999 * If this is %TRUE, [method@Conversation.generate_title] will
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1000 * automatically be called whenever a member is added or removed, or when
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1001 * their display name changes.
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1002 *
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1003 * Since: 3.0
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1004 */
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1005 properties[PROP_TITLE_GENERATED] = g_param_spec_boolean(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
1006 "title-generated", NULL, NULL,
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1007 FALSE,
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1008 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1009
42656
df9aafbae930 Add a doc-check unit test to libpurple and fix the issues it has found
Gary Kramlich <grim@reaperworld.com>
parents: 42654
diff changeset
1010 /**
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1011 * PurpleConversation:age-restricted:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1012 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1013 * Whether or not the conversation is age restricted.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1014 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1015 * This is typically set only by a protocol plugin.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1016 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1017 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1018 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1019 properties[PROP_AGE_RESTRICTED] = g_param_spec_boolean(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
1020 "age-restricted", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1021 FALSE,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1022 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1023
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1024 /**
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1025 * PurpleConversation:description-editable:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1026 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1027 * Whether or not the user can edit the title.
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1028 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1029 * This property should typically only be set by protocols and should be
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1030 * changed if the user's permissions in the conversation change.
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1031 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1032 * User interfaces should check
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1033 * [method@ProtocolConversation.implements_set_description] before making
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1034 * this action available to users.
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1035 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1036 * Since: 3.0
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1037 */
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1038 properties[PROP_DESCRIPTION_EDITABLE] = g_param_spec_boolean(
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1039 "description-editable", NULL, NULL,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1040 FALSE,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1041 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1042
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1043 /**
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1044 * PurpleConversation:description:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1045 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1046 * Sets the description of the conversation. This field is typically used
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1047 * to give more information about a conversation than that which would fit
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1048 * in [property@Conversation:topic].
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1049 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1050 * This is typically set only by a protocol plugin.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1051 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1052 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1053 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1054 properties[PROP_DESCRIPTION] = g_param_spec_string(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
1055 "description", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1056 NULL,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1057 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1058
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1059 /**
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1060 * PurpleConversation:topic-editable:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1061 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1062 * Whether or not the user can edit the title.
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1063 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1064 * This property should typically only be set by protocols and should be
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1065 * changed if the user's permissions in the conversation change.
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1066 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1067 * User interfaces should check
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1068 * [method@ProtocolConversation.implements_set_topic] before making this
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1069 * action available to users.
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1070 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1071 * Since: 3.0
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1072 */
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1073 properties[PROP_TOPIC_EDITABLE] = g_param_spec_boolean(
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1074 "topic-editable", NULL, NULL,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1075 FALSE,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1076 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1077
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1078 /**
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1079 * PurpleConversation:topic:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1080 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1081 * The topic of the conversation.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1082 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1083 * This is normally controlled by the protocol plugin and often times
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1084 * requires permission for the user to set.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1085 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1086 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1087 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1088 properties[PROP_TOPIC] = g_param_spec_string(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
1089 "topic", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1090 NULL,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1091 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1092
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1093 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1094 * PurpleConversation:topic-author:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1095 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1096 * Sets the author of the topic for the conversation.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1097 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1098 * This should typically only be set by a protocol plugin.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1099 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1100 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1101 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1102 properties[PROP_TOPIC_AUTHOR] = g_param_spec_object(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
1103 "topic-author", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1104 PURPLE_TYPE_CONTACT_INFO,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1105 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1106
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1107 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1108 * PurpleConversation:topic-updated:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1109 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1110 * Set to the time that the topic was last updated.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1111 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1112 * This should typically only be set by a protocol plugin.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1113 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1114 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1115 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1116 properties[PROP_TOPIC_UPDATED] = g_param_spec_boxed(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
1117 "topic-updated", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1118 G_TYPE_DATE_TIME,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1119 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1120
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1121 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1122 * PurpleConversation:user-nickname:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1123 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1124 * The user's nickname in this conversation.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1125 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1126 * Some protocols allow the user to use a nickname rather than their normal
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1127 * contact information when joining a conversation. This field holds that
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1128 * value.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1129 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1130 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1131 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1132 properties[PROP_USER_NICKNAME] = g_param_spec_string(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
1133 "user-nickname", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1134 NULL,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1135 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1136
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1137 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1138 * PurpleConversation:favorite:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1139 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1140 * Whether or not the conversation has been marked as favorite by the user.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1141 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1142 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1143 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1144 properties[PROP_FAVORITE] = g_param_spec_boolean(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
1145 "favorite", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1146 FALSE,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1147 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1148
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1149 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1150 * PurpleConversation:created-on:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1151 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1152 * The [struct@GLib.DateTime] when this conversation was created. This can
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1153 * be %NULL if the value is not known or supported.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1154 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1155 * This should typically only be set by a protocol plugin.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1156 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1157 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1158 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1159 properties[PROP_CREATED_ON] = g_param_spec_boxed(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
1160 "created-on", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1161 G_TYPE_DATE_TIME,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1162 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1163
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1164 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1165 * PurpleConversation:creator:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1166 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1167 * The [class@ContactInfo] that created the conversation.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1168 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1169 * This should typically only be set by a protocol plugin.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1170 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1171 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1172 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1173 properties[PROP_CREATOR] = g_param_spec_object(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
1174 "creator", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1175 PURPLE_TYPE_CONTACT_INFO,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1176 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1177
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1178 /**
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1179 * PurpleConversation:online:
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1180 *
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1181 * Whether or not the conversation is able to send and receive messages.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1182 *
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1183 * This is typically tied to whether or not the account that this
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1184 * conversation belongs is online or not.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1185 *
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1186 * However, if a protocol supports federated conversation, it is possible
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1187 * for a conversation to be offline if the server it is on is currently
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1188 * unreachable.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1189 *
42486
594f84a2c97f Fix some small doc issues
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42355
diff changeset
1190 * See also [property@Conversation:federated].
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1191 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1192 * Since: 3.0
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1193 */
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1194 properties[PROP_ONLINE] = g_param_spec_boolean(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
1195 "online", NULL, NULL,
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1196 TRUE,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1197 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1198
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1199 /**
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1200 * PurpleConversation:federated:
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1201 *
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1202 * Whether or this conversation is federated.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1203 *
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1204 * This should only be set by protocols that support federated
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1205 * conversations.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1206 *
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1207 * When this is %TRUE the [property@Conversation:online] property will not
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1208 * be automatically set to match the [property@Account:connected] property
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1209 * of the account that this conversation belongs to. It is the
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1210 * responsibility of the protocol to manage the online property in this
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1211 * case.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1212 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1213 * Since: 3.0
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1214 */
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1215 properties[PROP_FEDERATED] = g_param_spec_boolean(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
1216 "federated", NULL, NULL,
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1217 FALSE,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1218 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1219
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1220 /**
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1221 * PurpleConversation:tags:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1222 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1223 * [class@Tags] for the conversation.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1224 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1225 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1226 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1227 properties[PROP_TAGS] = g_param_spec_object(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
1228 "tags", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1229 PURPLE_TYPE_TAGS,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1230 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1231
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1232 /**
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1233 * PurpleConversation:members:
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1234 *
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1235 * The members that are currently in this conversation.
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1236 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1237 * Since: 3.0
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1238 */
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1239 properties[PROP_MEMBERS] = g_param_spec_object(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
1240 "members", NULL, NULL,
42891
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
1241 PURPLE_TYPE_CONVERSATION_MEMBERS,
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1242 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1243
42299
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1244 /**
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1245 * PurpleConversation:messages:
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1246 *
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1247 * A [iface.Gio.ListModel] of all the messages in this conversation.
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1248 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1249 * Since: 3.0
42299
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1250 */
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1251 properties[PROP_MESSAGES] = g_param_spec_object(
43071
071588186662 Remove nick and blurb from libpurple properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43064
diff changeset
1252 "messages", NULL, NULL,
42299
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1253 G_TYPE_LIST_MODEL,
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1254 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1255
42848
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1256 /**
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1257 * PurpleConversation:needs-attention:
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1258 *
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1259 * Whether or not the conversation needs attention.
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1260 *
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1261 * This could be because there are new messages or the user has been
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1262 * kicked from the room, or something else.
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1263 *
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1264 * Since: 3.0
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1265 */
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1266 properties[PROP_NEEDS_ATTENTION] = g_param_spec_boolean(
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1267 "needs-attention", NULL, NULL,
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1268 FALSE,
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1269 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1270
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1271 /**
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1272 * PurpleConversation:typing-state:
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1273 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1274 * The [enum@TypingState] of the libpurple user in this conversation.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1275 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1276 * When the property changes to `typing`, a timeout will be setup to change
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1277 * the property to `paused` if the property hasn't been set to `typing`
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1278 * again before the timeout expires.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1279 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1280 * If the above timeout fires, the state will be changed to `paused`, and a
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1281 * new timeout will be added that will reset the state to `none` if it
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1282 * expires.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1283 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1284 * This means that user interfaces should only ever need to set the state
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1285 * to typing and should do so whenever the user types anything that could
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1286 * be part of a message. Things like keyboard navigation and %commands
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1287 * should not result in this property being changed.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1288 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1289 * If the [class@Protocol] that this conversation belongs to implements
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1290 * [iface@ProtocolConversation] and
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1291 * [vfunc@ProtocolConversation.send_typing],
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1292 * [vfunc@ProtocolConversation.send_typing] will be called when this
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1293 * property is set even if the state hasn't changed.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1294 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1295 * Since: 3.0
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1296 */
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1297 properties[PROP_TYPING_STATE] = g_param_spec_enum(
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1298 "typing-state", NULL, NULL,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1299 PURPLE_TYPE_TYPING_STATE,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1300 PURPLE_TYPING_STATE_NONE,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1301 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1302
42908
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1303 /**
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1304 * PurpleConversation:logging:
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1305 *
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1306 * Whether or not this conversation is currently being logged.
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1307 *
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1308 * Since: 3.0
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1309 */
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1310 properties[PROP_LOGGING] = g_param_spec_boolean(
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1311 "logging", NULL, NULL,
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1312 FALSE,
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1313 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1314
42916
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1315 /**
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1316 * PurpleConversation:drafting:
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1317 *
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1318 * Whether or not the user has drafted a message for this conversation.
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1319 *
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1320 * This will not be set to false after a call to
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1321 * [method@Conversation.write_message] as anything can call that which
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1322 * could break the accounting of this property.
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1323 *
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1324 * Since: 3.0
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1325 */
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1326 properties[PROP_DRAFTING] = g_param_spec_boolean(
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1327 "drafting", NULL, NULL,
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1328 FALSE,
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1329 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1330
43064
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1331 /**
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1332 * PurpleConversation:error:
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1333 *
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1334 * An error that was encountered in this conversation. For example, this could
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1335 * be a channel connection error or a kick message.
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1336 *
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1337 * Since: 3.0
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1338 */
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1339 properties[PROP_ERROR] = g_param_spec_boxed(
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1340 "error", NULL, NULL,
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1341 G_TYPE_ERROR,
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1342 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1343
43234
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1344 /**
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1345 * PurpleConversation:url:
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1346 *
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1347 * A URL related to the conversation.
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1348 *
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1349 * Some networks, notably IRC, allow you to associate a URL with a
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1350 * conversation. In that case, it is generally a URL to get more
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1351 * information about the conversation and not a URL to the conversation
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1352 * itself.
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1353 *
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1354 * Since: 3.0
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1355 */
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1356 properties[PROP_URL] = g_param_spec_string(
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1357 "url", NULL, NULL,
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1358 NULL,
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1359 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1360
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1361 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1362
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1363 /**
42736
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1364 * PurpleConversation::present:
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1365 * @conversation: The instance.
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1366 *
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1367 * Emitted by [method@Conversation.present] when something wants the
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1368 * conversation presented to the user.
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1369 *
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1370 * Since: 3.0
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1371 */
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1372 signals[SIG_PRESENT] = g_signal_new_class_handler(
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1373 "present",
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1374 G_OBJECT_CLASS_TYPE(klass),
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1375 G_SIGNAL_RUN_LAST,
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1376 NULL,
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1377 NULL,
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1378 NULL,
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1379 NULL,
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1380 G_TYPE_NONE,
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1381 0);
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1382 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1383
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1384 /******************************************************************************
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1385 * Public API
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1386 *****************************************************************************/
42669
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1387 gboolean
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1388 purple_conversation_is_dm(PurpleConversation *conversation) {
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1389 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1390
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1391 return conversation->type == PURPLE_CONVERSATION_TYPE_DM;
42669
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1392 }
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1393
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1394 gboolean
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1395 purple_conversation_is_group_dm(PurpleConversation *conversation) {
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1396 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1397
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1398 return conversation->type == PURPLE_CONVERSATION_TYPE_GROUP_DM;
42669
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1399 }
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1400
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1401 gboolean
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1402 purple_conversation_is_channel(PurpleConversation *conversation) {
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1403 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1404
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1405 return conversation->type == PURPLE_CONVERSATION_TYPE_CHANNEL;
42669
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1406 }
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1407
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1408 gboolean
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1409 purple_conversation_is_thread(PurpleConversation *conversation) {
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1410 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1411
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1412 return conversation->type == PURPLE_CONVERSATION_TYPE_THREAD;
42669
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1413 }
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1414
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1415 void
42736
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1416 purple_conversation_present(PurpleConversation *conversation) {
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1417 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1418
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1419 g_signal_emit(conversation, signals[SIG_PRESENT], 0);
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1420 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1421
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
1422 const char *
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
1423 purple_conversation_get_id(PurpleConversation *conversation) {
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
1424 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
1425
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1426 return conversation->id;
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
1427 }
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
1428
42800
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1429 char *
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1430 purple_conversation_get_global_id(PurpleConversation *conversation) {
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1431 const char *account_id = NULL;
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1432
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1433 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1434
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1435 account_id = purple_account_get_id(conversation->account);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1436
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1437 return g_strdup_printf("%s-%s", account_id, conversation->id);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1438 }
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1439
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
1440 PurpleConversationType
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
1441 purple_conversation_get_conversation_type(PurpleConversation *conversation) {
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
1442 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation),
42653
584895b844d2 PurpleConversationType's values were pascal case when they should be upper snake case
Gary Kramlich <grim@reaperworld.com>
parents: 42613
diff changeset
1443 PURPLE_CONVERSATION_TYPE_UNSET);
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
1444
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1445 return conversation->type;
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
1446 }
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
1447
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1448 PurpleAccount *
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1449 purple_conversation_get_account(PurpleConversation *conversation) {
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1450 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1451
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1452 return conversation->account;
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1453 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1454
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1455 PurpleConnection *
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1456 purple_conversation_get_connection(PurpleConversation *conversation) {
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1457 PurpleAccount *account;
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1458
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1459 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1460
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1461 account = purple_conversation_get_account(conversation);
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1462
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1463 if(account == NULL) {
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1464 return NULL;
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1465 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1466
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1467 return purple_account_get_connection(account);
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1468 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1469
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1470 void
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1471 purple_conversation_set_title(PurpleConversation *conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1472 const char *title)
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1473 {
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1474 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1475
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42760
diff changeset
1476 if(g_set_str(&conversation->title, title)) {
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1477 GObject *obj = G_OBJECT(conversation);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1478
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1479 /* We have to g_object_freeze_notify here because we're modifying more
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1480 * than one property. However, purple_conversation_generate_title will
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1481 * also have called g_object_freeze_notify before calling us because it
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1482 * needs to set the title-generated property to TRUE even though we set
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1483 * it to FALSE here. We do this, because we didn't want to write
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1484 * additional API that skips that part.
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1485 */
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1486 g_object_freeze_notify(obj);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1487 g_object_notify_by_pspec(obj, properties[PROP_TITLE]);
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1488 g_object_notify_by_pspec(obj, properties[PROP_TITLE_FOR_DISPLAY]);
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1489 purple_conversation_set_title_generated(conversation, FALSE);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1490 g_object_thaw_notify(obj);
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1491 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1492 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1493
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1494 const char *
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1495 purple_conversation_get_title(PurpleConversation *conversation) {
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1496 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1497
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1498 return conversation->title;
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1499 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1500
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1501 void
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1502 purple_conversation_generate_title(PurpleConversation *conversation) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1503 PurpleAccount *account = NULL;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1504 PurpleContactInfo *account_info = NULL;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1505 GString *str = NULL;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1506 guint n_members = 0;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1507 gboolean first = TRUE;
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1508
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1509 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1510
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1511 if(conversation->type != PURPLE_CONVERSATION_TYPE_DM &&
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1512 conversation->type != PURPLE_CONVERSATION_TYPE_GROUP_DM)
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1513 {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1514 g_warning("purple_conversation_generate_title called for non DM/Group "
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1515 "DM conversation");
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1516
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1517 return;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1518 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1519
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1520 account = purple_conversation_get_account(conversation);
42805
3e77e81168a5 Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42800
diff changeset
1521 account_info = purple_account_get_contact_info(account);
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1522
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1523 str = g_string_new("");
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1524
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1525 n_members = g_list_model_get_n_items(G_LIST_MODEL(conversation->members));
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1526 for(guint i = 0; i < n_members; i++) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1527 PurpleContactInfo *info = NULL;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1528 PurpleConversationMember *member = NULL;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1529 const char *name = NULL;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1530
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1531 member = g_list_model_get_item(G_LIST_MODEL(conversation->members), i);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1532 info = purple_conversation_member_get_contact_info(member);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1533 if(purple_contact_info_compare(info, account_info) == 0) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1534 g_clear_object(&member);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1535
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1536 continue;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1537 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1538
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1539 name = purple_contact_info_get_name_for_display(info);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1540 if(purple_strempty(name)) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1541 g_warning("contact %p has no displayable name", info);
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1542
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1543 g_clear_object(&member);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1544
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1545 continue;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1546 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1547
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1548 if(!first) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1549 g_string_append_printf(str, ", %s", name);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1550 } else {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1551 g_string_append(str, name);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1552 first = FALSE;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1553 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1554
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1555 g_clear_object(&member);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1556 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1557
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1558 /* If we found at least 1 user to add, then we set the title. */
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1559 if(!first) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1560 GObject *obj = G_OBJECT(conversation);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1561
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1562 g_object_freeze_notify(obj);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1563 purple_conversation_set_title(conversation, str->str);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1564 purple_conversation_set_title_generated(conversation, TRUE);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1565 g_object_thaw_notify(obj);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1566 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1567
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1568 g_string_free(str, TRUE);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1569 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1570
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1571 gboolean
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1572 purple_conversation_get_title_generated(PurpleConversation *conversation) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1573 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1574
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1575 return conversation->title_generated;
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1576 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1577
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1578 gboolean
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1579 purple_conversation_get_title_editable(PurpleConversation *conversation) {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1580 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1581
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1582 return conversation->title_editable;
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1583 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1584
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1585 void
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1586 purple_conversation_set_title_editable(PurpleConversation *conversation,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1587 gboolean editable)
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1588 {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1589 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1590
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1591 if(conversation->title_editable != editable) {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1592 conversation->title_editable = editable;
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1593
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1594 g_object_notify_by_pspec(G_OBJECT(conversation),
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1595 properties[PROP_TITLE_EDITABLE]);
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1596 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1597 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1598
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1599 void
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1600 purple_conversation_write_message(PurpleConversation *conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1601 PurpleMessage *message)
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1602 {
43100
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
1603 PurpleConversationMember *member = NULL;
43017
09661a988eab When writing a message make sure the author's typing state is set to none
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1604
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1605 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1606 g_return_if_fail(message != NULL);
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1607
42908
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1608 if(conversation->logging) {
41090
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1609 GError *error = NULL;
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1610 PurpleHistoryManager *manager = NULL;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1611 gboolean success = FALSE;
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1612
41090
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1613 manager = purple_history_manager_get_default();
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1614 /* We should probably handle this error somehow, but I don't think that
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1615 * spamming purple_debug_warning is necessarily the right call.
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1616 */
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1617 success = purple_history_manager_write(manager, conversation, message,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1618 &error);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1619 if(!success){
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1620 purple_debug_info("conversation",
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1621 "history manager write returned error: %s",
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1622 error->message);
41090
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1623
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1624 g_clear_error(&error);
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1625 }
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1626 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1627
43100
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
1628 member = purple_message_get_author(message);
43118
d7965104ef85 Fix some PURPLE_IS_CONVERSATION_MEMEBER assertion failures
Gary Kramlich <grim@reaperworld.com>
parents: 43100
diff changeset
1629 /* Event messages don't typically have an author. */
d7965104ef85 Fix some PURPLE_IS_CONVERSATION_MEMEBER assertion failures
Gary Kramlich <grim@reaperworld.com>
parents: 43100
diff changeset
1630 if(PURPLE_IS_CONVERSATION_MEMBER(member)) {
d7965104ef85 Fix some PURPLE_IS_CONVERSATION_MEMEBER assertion failures
Gary Kramlich <grim@reaperworld.com>
parents: 43100
diff changeset
1631 purple_conversation_member_set_typing_state(member,
d7965104ef85 Fix some PURPLE_IS_CONVERSATION_MEMEBER assertion failures
Gary Kramlich <grim@reaperworld.com>
parents: 43100
diff changeset
1632 PURPLE_TYPING_STATE_NONE,
d7965104ef85 Fix some PURPLE_IS_CONVERSATION_MEMEBER assertion failures
Gary Kramlich <grim@reaperworld.com>
parents: 43100
diff changeset
1633 0);
d7965104ef85 Fix some PURPLE_IS_CONVERSATION_MEMEBER assertion failures
Gary Kramlich <grim@reaperworld.com>
parents: 43100
diff changeset
1634 }
43017
09661a988eab When writing a message make sure the author's typing state is set to none
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1635
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1636 g_list_store_append(conversation->messages, message);
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1637 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1638
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1639 void
42743
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1640 purple_conversation_send_message_async(PurpleConversation *conversation,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1641 PurpleMessage *message,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1642 GCancellable *cancellable,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1643 GAsyncReadyCallback callback,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1644 gpointer data)
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1645 {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1646 PurpleAccount *account = NULL;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1647 PurpleProtocol *protocol = NULL;
43056
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1648 PurpleProtocolConversation *protocol_conversation = NULL;
42743
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1649 GTask *task = NULL;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1650
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1651 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1652 g_return_if_fail(PURPLE_IS_MESSAGE(message));
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1653
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1654 purple_conversation_set_typing_state(conversation,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1655 PURPLE_TYPING_STATE_NONE);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1656
42743
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1657 task = g_task_new(conversation, cancellable, callback, data);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1658 g_task_set_source_tag(task, purple_conversation_send_message_async);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1659 g_task_set_task_data(task, g_object_ref(message), g_object_unref);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1660
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1661 account = purple_conversation_get_account(conversation);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1662 protocol = purple_account_get_protocol(account);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1663
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1664 if(!PURPLE_IS_PROTOCOL_CONVERSATION(protocol)) {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1665 g_task_return_new_error(task, PURPLE_CONVERSATION_DOMAIN, 0,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1666 "protocol does not implement "
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1667 "PurpleProtocolConversation");
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1668
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1669 g_clear_object(&task);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1670
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1671 return;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1672 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1673
43056
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1674 protocol_conversation = PURPLE_PROTOCOL_CONVERSATION(protocol);
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1675 if(!purple_protocol_conversation_implements_send_message(protocol_conversation))
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1676 {
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1677 g_task_return_new_error(task, PURPLE_CONVERSATION_DOMAIN, 0,
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1678 "protocol does not implement "
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1679 "PurpleProtocolConversation.send_message");
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1680
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1681 g_clear_object(&task);
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1682
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1683 return;
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1684 }
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1685
42743
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1686 purple_protocol_conversation_send_message_async(PURPLE_PROTOCOL_CONVERSATION(protocol),
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1687 conversation,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1688 message,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1689 cancellable,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1690 purple_conversation_send_message_async_cb,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1691 task);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1692 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1693
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1694 gboolean
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1695 purple_conversation_send_message_finish(PurpleConversation *conversation,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1696 GAsyncResult *result,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1697 GError **error)
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1698 {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1699 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1700 g_return_val_if_fail(G_IS_ASYNC_RESULT(result), FALSE);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1701
43303
cddf3066f1bc Fix some broken logic in Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents: 43301
diff changeset
1702 g_return_val_if_fail(g_async_result_is_tagged(result,
cddf3066f1bc Fix some broken logic in Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents: 43301
diff changeset
1703 purple_conversation_send_message_async),
cddf3066f1bc Fix some broken logic in Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents: 43301
diff changeset
1704 FALSE);
42743
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1705
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1706 return g_task_propagate_boolean(G_TASK(result), error);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1707 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1708
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1709 gboolean
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1710 purple_conversation_has_focus(PurpleConversation *conversation) {
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1711 gboolean ret = FALSE;
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1712
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1713 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1714
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1715 return ret;
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1716 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1717
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1718 gboolean
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1719 purple_conversation_get_age_restricted(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1720 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1721
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1722 return conversation->age_restricted;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1723 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1724
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1725 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1726 purple_conversation_set_age_restricted(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1727 gboolean age_restricted)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1728 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1729 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1730
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1731 if(conversation->age_restricted != age_restricted) {
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1732 conversation->age_restricted = age_restricted;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1733
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1734 g_object_notify_by_pspec(G_OBJECT(conversation),
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1735 properties[PROP_AGE_RESTRICTED]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1736 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1737 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1738
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1739 const char *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1740 purple_conversation_get_description(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1741 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1742
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1743 return conversation->description;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1744 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1745
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1746 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1747 purple_conversation_set_description(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1748 const char *description)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1749 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1750 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1751
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42760
diff changeset
1752 if(g_set_str(&conversation->description, description)) {
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1753 g_object_notify_by_pspec(G_OBJECT(conversation),
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1754 properties[PROP_DESCRIPTION]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1755 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1756 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1757
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1758 gboolean
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1759 purple_conversation_get_description_editable(PurpleConversation *conversation)
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1760 {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1761 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1762
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1763 return conversation->description_editable;
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1764 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1765
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1766 void
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1767 purple_conversation_set_description_editable(PurpleConversation *conversation,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1768 gboolean editable)
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1769 {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1770 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1771
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1772 if(conversation->description_editable != editable) {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1773 conversation->description_editable = editable;
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1774
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1775 g_object_notify_by_pspec(G_OBJECT(conversation),
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1776 properties[PROP_DESCRIPTION_EDITABLE]);
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1777 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1778 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1779
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1780 const char *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1781 purple_conversation_get_topic(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1782 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1783
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1784 return conversation->topic;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1785 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1786
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1787 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1788 purple_conversation_set_topic(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1789 const char *topic)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1790 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1791 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1792
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42760
diff changeset
1793 if(g_set_str(&conversation->topic, topic)) {
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1794 g_object_notify_by_pspec(G_OBJECT(conversation),
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1795 properties[PROP_TOPIC]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1796 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1797 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1798
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1799 gboolean
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1800 purple_conversation_get_topic_editable(PurpleConversation *conversation) {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1801 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1802
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1803 return conversation->topic_editable;
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1804 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1805
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1806 void
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1807 purple_conversation_set_topic_editable(PurpleConversation *conversation,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1808 gboolean editable)
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1809 {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1810 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1811
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1812 if(conversation->topic_editable != editable) {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1813 conversation->topic_editable = editable;
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1814
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1815 g_object_notify_by_pspec(G_OBJECT(conversation),
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1816 properties[PROP_TOPIC_EDITABLE]);
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1817 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1818 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1819
42302
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1820 void
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1821 purple_conversation_set_topic_full(PurpleConversation *conversation,
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1822 const char *topic,
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1823 PurpleContactInfo *author,
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1824 GDateTime *updated)
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1825 {
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1826 GObject *obj = NULL;
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1827
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1828 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1829
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1830 obj = G_OBJECT(conversation);
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1831 g_object_freeze_notify(obj);
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1832
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1833 purple_conversation_set_topic(conversation, topic);
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1834 purple_conversation_set_topic_author(conversation, author);
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1835 purple_conversation_set_topic_updated(conversation, updated);
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1836
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1837 g_object_thaw_notify(obj);
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1838 }
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1839
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1840
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1841 PurpleContactInfo *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1842 purple_conversation_get_topic_author(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1843 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1844
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1845 return conversation->topic_author;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1846 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1847
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1848 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1849 purple_conversation_set_topic_author(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1850 PurpleContactInfo *author)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1851 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1852 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1853
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1854 if(g_set_object(&conversation->topic_author, author)) {
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1855 g_object_notify_by_pspec(G_OBJECT(conversation),
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1856 properties[PROP_TOPIC_AUTHOR]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1857 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1858 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1859
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1860 GDateTime *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1861 purple_conversation_get_topic_updated(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1862 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1863
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1864 return conversation->topic_updated;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1865 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1866
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1867 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1868 purple_conversation_set_topic_updated(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1869 GDateTime *updated)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1870 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1871 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1872
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1873 if(birb_date_time_set(&conversation->topic_updated, updated)) {
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1874 g_object_notify_by_pspec(G_OBJECT(conversation),
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1875 properties[PROP_TOPIC_UPDATED]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1876 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1877 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1878
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1879 const char *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1880 purple_conversation_get_user_nickname(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1881 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1882
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1883 return conversation->user_nickname;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1884 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1885
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1886 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1887 purple_conversation_set_user_nickname(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1888 const char *nickname)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1889 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1890 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1891
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42760
diff changeset
1892 if(g_set_str(&conversation->user_nickname, nickname)) {
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1893 g_object_notify_by_pspec(G_OBJECT(conversation),
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1894 properties[PROP_USER_NICKNAME]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1895 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1896 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1897
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1898 gboolean
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1899 purple_conversation_get_favorite(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1900 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1901
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1902 return conversation->favorite;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1903 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1904
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1905 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1906 purple_conversation_set_favorite(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1907 gboolean favorite)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1908 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1909 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1910
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1911 if(conversation->favorite != favorite) {
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1912 conversation->favorite = favorite;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1913
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1914 g_object_notify_by_pspec(G_OBJECT(conversation),
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1915 properties[PROP_FAVORITE]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1916 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1917 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1918
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1919 GDateTime *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1920 purple_conversation_get_created_on(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1921 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1922
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1923 return conversation->created_on;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1924 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1925
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1926 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1927 purple_conversation_set_created_on(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1928 GDateTime *created_on)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1929 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1930 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1931
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1932 if(birb_date_time_set(&conversation->created_on, created_on)) {
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1933 g_object_notify_by_pspec(G_OBJECT(conversation),
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1934 properties[PROP_CREATED_ON]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1935 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1936 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1937
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1938 PurpleContactInfo *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1939 purple_conversation_get_creator(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1940 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1941
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1942 return conversation->creator;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1943 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1944
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1945 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1946 purple_conversation_set_creator(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1947 PurpleContactInfo *creator)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1948 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1949 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1950
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1951 if(g_set_object(&conversation->creator, creator)) {
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1952 g_object_notify_by_pspec(G_OBJECT(conversation),
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1953 properties[PROP_CREATOR]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1954 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1955 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1956
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1957 gboolean
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1958 purple_conversation_get_online(PurpleConversation *conversation) {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1959 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1960
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1961 return conversation->online;
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1962 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1963
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1964 void
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1965 purple_conversation_set_online(PurpleConversation *conversation,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1966 gboolean online)
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1967 {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1968 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1969
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1970 if(conversation->online != online) {
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1971 conversation->online = online;
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1972
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1973 g_object_notify_by_pspec(G_OBJECT(conversation),
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1974 properties[PROP_ONLINE]);
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1975 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1976 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1977
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1978 gboolean
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1979 purple_conversation_get_federated(PurpleConversation *conversation) {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1980 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1981
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1982 return conversation->federated;
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1983 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1984
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1985 PurpleTags *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1986 purple_conversation_get_tags(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1987 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1988
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1989 return conversation->tags;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1990 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1991
42891
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
1992 PurpleConversationMembers *
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1993 purple_conversation_get_members(PurpleConversation *conversation) {
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1994 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1995
42891
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
1996 return conversation->members;
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1997 }
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1998
42299
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1999 GListModel *
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
2000 purple_conversation_get_messages(PurpleConversation *conversation) {
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
2001 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
2002
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
2003 if(G_IS_LIST_MODEL(conversation->messages)) {
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
2004 return G_LIST_MODEL(conversation->messages);
42299
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
2005 }
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
2006
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
2007 return NULL;
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
2008 }
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2009
43301
0e43dc8462e8 Replace Purple.Avatar with Purple.Image
Gary Kramlich <grim@reaperworld.com>
parents: 43234
diff changeset
2010 PurpleImage *
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2011 purple_conversation_get_avatar(PurpleConversation *conversation) {
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2012 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2013
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
2014 return conversation->avatar;
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2015 }
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2016
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2017 void
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2018 purple_conversation_set_avatar(PurpleConversation *conversation,
43301
0e43dc8462e8 Replace Purple.Avatar with Purple.Image
Gary Kramlich <grim@reaperworld.com>
parents: 43234
diff changeset
2019 PurpleImage *avatar)
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2020 {
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2021 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2022
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
2023 if(g_set_object(&conversation->avatar, avatar)) {
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2024 g_object_notify_by_pspec(G_OBJECT(conversation),
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2025 properties[PROP_AVATAR]);
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2026 }
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2027 }
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2028
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2029 gboolean
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2030 purple_conversation_get_avatar_editable(PurpleConversation *conversation) {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2031 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2032
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2033 return conversation->avatar_editable;
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2034 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2035
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2036 void
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2037 purple_conversation_set_avatar_editable(PurpleConversation *conversation,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2038 gboolean editable)
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2039 {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2040 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2041
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2042 if(conversation->avatar_editable != editable) {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2043 conversation->avatar_editable = editable;
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2044
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2045 g_object_notify_by_pspec(G_OBJECT(conversation),
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2046 properties[PROP_AVATAR_EDITABLE]);
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2047 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2048 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2049
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2050 const char *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2051 purple_conversation_get_title_for_display(PurpleConversation *conversation) {
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2052 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2053
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2054 if(!purple_strempty(conversation->alias)) {
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2055 return conversation->alias;
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2056 }
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2057
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2058 if(!purple_strempty(conversation->title)) {
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2059 return conversation->title;
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2060 }
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2061
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2062 return conversation->id;
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2063 }
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2064
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2065 const char *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2066 purple_conversation_get_alias(PurpleConversation *conversation) {
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2067 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2068
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2069 return conversation->alias;
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2070 }
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2071
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2072 void
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2073 purple_conversation_set_alias(PurpleConversation *conversation,
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2074 const char *alias)
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2075 {
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2076 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2077
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2078 if(g_set_str(&conversation->alias, alias)) {
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2079 GObject *obj = G_OBJECT(conversation);
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2080
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2081 g_object_freeze_notify(obj);
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2082 g_object_notify_by_pspec(obj, properties[PROP_ALIAS]);
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2083 g_object_notify_by_pspec(obj, properties[PROP_TITLE_FOR_DISPLAY]);
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2084 g_object_thaw_notify(obj);
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2085 }
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2086 }
42848
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2087
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2088 gboolean
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2089 purple_conversation_get_needs_attention(PurpleConversation *conversation) {
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2090 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2091
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2092 return conversation->needs_attention;
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2093 }
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2094
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2095 void
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2096 purple_conversation_set_needs_attention(PurpleConversation *conversation,
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2097 gboolean needs_attention)
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2098 {
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2099 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2100
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2101 if(conversation->needs_attention != needs_attention) {
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2102 conversation->needs_attention = needs_attention;
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2103
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2104 g_object_notify_by_pspec(G_OBJECT(conversation),
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2105 properties[PROP_NEEDS_ATTENTION]);
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2106 }
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2107 }
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2108
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2109 PurpleTypingState
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2110 purple_conversation_get_typing_state(PurpleConversation *conversation) {
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2111 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation),
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2112 PURPLE_TYPING_STATE_NONE);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2113
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2114 return conversation->typing_state;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2115 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2116
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2117 void
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2118 purple_conversation_set_typing_state(PurpleConversation *conversation,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2119 PurpleTypingState typing_state)
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2120 {
42894
7d128a161cad Only send the typing notifications if it's changed or if it's TYPING
Gary Kramlich <grim@reaperworld.com>
parents: 42891
diff changeset
2121 gboolean send = FALSE;
7d128a161cad Only send the typing notifications if it's changed or if it's TYPING
Gary Kramlich <grim@reaperworld.com>
parents: 42891
diff changeset
2122
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2123 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2124
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2125 /* Remove the old timeout because we have new activity. */
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2126 g_clear_handle_id(&conversation->typing_state_source, g_source_remove);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2127
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2128 /* We set some default timeouts based on the state. If the new state is
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2129 * TYPING, we use a 6 second timeout that will change the state to PAUSED.
42939
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2130 * When the state changes to PAUSED we will set a 30 second timeout that
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2131 * will change the state to NONE.
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2132 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2133 * This allows the user interface to just tell libpurple when the user is
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2134 * typing, and the rest happens automatically.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2135 */
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2136 if(typing_state == PURPLE_TYPING_STATE_TYPING) {
42902
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2137 GDateTime *now = NULL;
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2138
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2139 conversation->typing_state_source =
42939
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2140 g_timeout_add_seconds_once(6,
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2141 purple_conversation_typing_state_typing_cb,
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2142 conversation);
42902
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2143
42939
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2144 /* We don't want to spam services with typing notifications, so we only
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2145 * send them if it's been at least 3 seconds since the last one was
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2146 * sent.
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2147 *
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2148 * Use local time because this is local to the user and we might want
42902
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2149 * to output this during debug or something, and a local time stamp
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2150 * will make a lot more sense then.
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2151 */
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2152 now = g_date_time_new_now_local();
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2153 if(conversation->last_typing != NULL) {
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2154 GTimeSpan difference = 0;
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2155
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2156 difference = g_date_time_difference(now, conversation->last_typing);
42939
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2157 birb_date_time_clear(&conversation->last_typing);
42902
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2158
42939
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2159 if(difference >= 3 * G_TIME_SPAN_SECOND) {
42902
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2160 send = TRUE;
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2161 }
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2162 }
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2163
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2164 conversation->last_typing = now;
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2165 } else if(typing_state == PURPLE_TYPING_STATE_PAUSED) {
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2166 conversation->typing_state_source =
42939
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2167 g_timeout_add_seconds_once(30,
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2168 purple_conversation_typing_state_paused_cb,
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2169 conversation);
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2170 } else if(typing_state == PURPLE_TYPING_STATE_NONE) {
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2171 birb_date_time_clear(&conversation->last_typing);
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2172 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2173
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2174 if(conversation->typing_state != typing_state) {
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2175 conversation->typing_state = typing_state;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2176
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2177 g_object_notify_by_pspec(G_OBJECT(conversation),
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2178 properties[PROP_TYPING_STATE]);
42894
7d128a161cad Only send the typing notifications if it's changed or if it's TYPING
Gary Kramlich <grim@reaperworld.com>
parents: 42891
diff changeset
2179
7d128a161cad Only send the typing notifications if it's changed or if it's TYPING
Gary Kramlich <grim@reaperworld.com>
parents: 42891
diff changeset
2180 /* The state changed so we need to send it. */
7d128a161cad Only send the typing notifications if it's changed or if it's TYPING
Gary Kramlich <grim@reaperworld.com>
parents: 42891
diff changeset
2181 send = TRUE;
7d128a161cad Only send the typing notifications if it's changed or if it's TYPING
Gary Kramlich <grim@reaperworld.com>
parents: 42891
diff changeset
2182 }
7d128a161cad Only send the typing notifications if it's changed or if it's TYPING
Gary Kramlich <grim@reaperworld.com>
parents: 42891
diff changeset
2183
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2184 /* Check if we have a protocol that implements
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2185 * ProtocolConversation.send_typing and call it if it does.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2186 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2187 * We do this after the notify above to make sure the user interface will
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2188 * not be possibly blocked by the protocol.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2189 */
42894
7d128a161cad Only send the typing notifications if it's changed or if it's TYPING
Gary Kramlich <grim@reaperworld.com>
parents: 42891
diff changeset
2190 if(send && PURPLE_IS_ACCOUNT(conversation->account)) {
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2191 PurpleProtocol *protocol = NULL;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2192
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2193 protocol = purple_account_get_protocol(conversation->account);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2194 if(PURPLE_IS_PROTOCOL_CONVERSATION(protocol)) {
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2195 PurpleProtocolConversation *protocol_conversation = NULL;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2196
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2197 protocol_conversation = PURPLE_PROTOCOL_CONVERSATION(protocol);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2198
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2199 if(purple_protocol_conversation_implements_send_typing(protocol_conversation))
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2200 {
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2201 purple_protocol_conversation_send_typing(protocol_conversation,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2202 conversation,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2203 conversation->typing_state);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2204 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2205 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2206 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2207 }
42908
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2208
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2209 gboolean
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2210 purple_conversation_get_logging(PurpleConversation *conversation) {
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2211 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2212
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2213 return conversation->logging;
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2214 }
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2215
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2216 void
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2217 purple_conversation_set_logging(PurpleConversation *conversation,
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2218 gboolean logging)
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2219 {
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2220 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2221
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2222 if(conversation->logging != logging) {
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2223 conversation->logging = logging;
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2224
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2225 g_object_notify_by_pspec(G_OBJECT(conversation),
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2226 properties[PROP_LOGGING]);
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2227 }
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2228 }
42916
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2229
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2230 gboolean
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2231 purple_conversation_get_drafting(PurpleConversation *conversation) {
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2232 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2233
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2234 return conversation->drafting;
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2235 }
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2236
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2237 void
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2238 purple_conversation_set_drafting(PurpleConversation *conversation,
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2239 gboolean drafting)
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2240 {
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2241 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2242
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2243 if(conversation->drafting != drafting) {
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2244 conversation->drafting = drafting;
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2245
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2246 g_object_notify_by_pspec(G_OBJECT(conversation),
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2247 properties[PROP_DRAFTING]);
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2248 }
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2249 }
43064
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2250
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2251 GError *
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2252 purple_conversation_get_error(PurpleConversation *conversation) {
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2253 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2254
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2255 return conversation->error;
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2256 }
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2257
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2258 void
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2259 purple_conversation_set_error(PurpleConversation *conversation,
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2260 GError *error)
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2261 {
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2262 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2263
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2264 g_clear_error(&conversation->error);
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2265 if(error != NULL) {
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2266 conversation->error = g_error_copy(error);
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2267 }
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2268
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2269 g_object_notify_by_pspec(G_OBJECT(conversation), properties[PROP_ERROR]);
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2270 }
43100
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2271
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2272 PurpleConversationMember *
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2273 purple_conversation_find_or_add_member(PurpleConversation *conversation,
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2274 PurpleContactInfo *info,
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2275 gboolean announce,
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2276 const char *message)
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2277 {
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2278 PurpleConversationMember *member = NULL;
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2279
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2280 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2281 g_return_val_if_fail(PURPLE_IS_CONTACT_INFO(info), NULL);
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2282
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2283 member = purple_conversation_members_find_member(conversation->members,
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2284 info);
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2285 if(!PURPLE_IS_CONVERSATION_MEMBER(member)) {
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2286 member = purple_conversation_members_add_member(conversation->members,
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2287 info, announce,
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2288 message);
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2289 }
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2290
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2291 return member;
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2292 }
43234
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2293
43309
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2294 PurpleMessage *
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2295 purple_conversation_find_message_by_id(PurpleConversation *conversation,
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2296 const char *id)
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2297 {
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2298 GListModel *model = G_LIST_MODEL(conversation->messages);
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2299 guint n_items = g_list_model_get_n_items(model);
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2300
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2301 g_return_val_if_fail(id != NULL, NULL);
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2302
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2303 for (guint i = 0; i < n_items; i++) {
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2304 PurpleMessage *message = PURPLE_MESSAGE(g_list_model_get_item(model, i));
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2305
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2306 if (purple_strequal(purple_message_get_id(message), id))
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2307 return message;
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2308 }
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2309
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2310 return NULL;
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2311 }
099e1dfb856b Add Purple.Conversation.find_message_by_id
Gong Zhile <gongzl@stu.hebust.edu.cn>
parents: 43303
diff changeset
2312
43234
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2313 const char *
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2314 purple_conversation_get_url(PurpleConversation *conversation) {
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2315 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2316
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2317 return conversation->url;
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2318 }
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2319
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2320 void
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2321 purple_conversation_set_url(PurpleConversation *conversation, const char *url)
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2322 {
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2323 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2324
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2325 if(g_set_str(&conversation->url, url)) {
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2326 g_object_notify_by_pspec(G_OBJECT(conversation), properties[PROP_URL]);
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2327 }
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2328 }

mercurial