libpurple/purpleconversation.c

Thu, 07 Aug 2025 21:34:33 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 07 Aug 2025 21:34:33 -0500
changeset 43301
0e43dc8462e8
parent 43234
85be702275e6
child 43303
cddf3066f1bc
permissions
-rw-r--r--

Replace Purple.Avatar with Purple.Image

Purple.Avatar was unnecessary and this just moves everything to Purple.Image
which should work just fine.

Testing Done:
Loaded a demo account and verified that the avatars were shown in the contact list properly. Also called in the turtles.

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

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
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
327 if(!success) {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
328 if(error == NULL) {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
329 error = g_error_new(PURPLE_CONVERSATION_DOMAIN, 0,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
330 "unknown error");
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
331 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
332
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
333 purple_message_set_error(message, error);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
334 g_task_return_error(task, error);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
335
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
336 g_clear_error(&error);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
337 } else {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
338 /* If the protocol didn't set delivered, set it now. */
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
339 if(!purple_message_get_delivered(message)) {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
340 purple_message_set_delivered(message, TRUE);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
341 }
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 g_task_return_boolean(task, TRUE);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
344 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
345
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
346 g_clear_object(&task);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
347 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
348
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
349 /**************************************************************************
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
350 * Callbacks
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
351 **************************************************************************/
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
352 static void
42891
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
353 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
354 G_GNUC_UNUSED guint position,
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
355 G_GNUC_UNUSED guint removed,
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
356 G_GNUC_UNUSED guint added,
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
357 gpointer data)
42760
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 PurpleConversation *conversation = data;
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 if(purple_conversation_get_title_generated(conversation)) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
362 purple_conversation_generate_title(conversation);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
363 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
364 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
365
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
366 static void
42981
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
367 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
368 PurpleConversationMember *member,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
369 gboolean announce,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
370 const char *join_message,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
371 gpointer data)
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
372 {
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
373 PurpleConversation *conversation = data;
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
374 PurpleMessage *message = NULL;
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
375 char *contents = NULL;
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
376
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
377 if(!announce) {
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
378 return;
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
379 }
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
380
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
381 if(purple_strempty(join_message)) {
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
382 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
383 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
384 } 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
385 contents = g_strdup(join_message);
42981
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
386 }
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
387
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
388 message = g_object_new(
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
389 PURPLE_TYPE_MESSAGE,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
390 "contents", contents,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
391 "event", TRUE,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
392 NULL);
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 g_free(contents);
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
395
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
396 purple_conversation_write_message(conversation, message);
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
397 }
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
398
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
399 static void
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
400 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
401 PurpleConversationMember *member,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
402 gboolean announce,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
403 const char *part_message,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
404 gpointer data)
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
405 {
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
406 PurpleConversation *conversation = data;
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
407 PurpleMessage *message = NULL;
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
408 char *contents = NULL;
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
409
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
410 if(!announce) {
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
411 return;
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
412 }
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
413
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
414 if(purple_strempty(part_message)) {
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
415 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
416 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
417 } 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
418 contents = g_strdup(part_message);
42981
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
419 }
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
420
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
421 message = g_object_new(
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
422 PURPLE_TYPE_MESSAGE,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
423 "contents", contents,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
424 "event", TRUE,
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
425 NULL);
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 g_free(contents);
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
428
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
429 purple_conversation_write_message(conversation, message);
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
430 }
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
431
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
432 static void
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
433 purple_conversation_account_connected_cb(GObject *obj,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
434 G_GNUC_UNUSED GParamSpec *pspec,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
435 gpointer data)
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
436 {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
437 PurpleConversation *conversation = data;
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
438 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
439
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
440 if(conversation->federated) {
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
441 /* 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
442 * 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
443 * safely set the conversation to offline.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
444 */
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
445 if(!connected) {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
446 purple_conversation_set_online(conversation, FALSE);
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
447 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
448 } else {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
449 purple_conversation_set_online(conversation, connected);
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
450 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
451 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
452
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
453 /*
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
454 * 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
455 * @data: The conversation instance.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
456 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
457 * 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
458 * 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
459 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
460 * 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
461 * 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
462 * 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
463 * function.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
464 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
465 * 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
466 * 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
467 */
42939
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
468 static void
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
469 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
470 PurpleConversation *conversation = data;
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 conversation->typing_state_source = 0;
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_set_typing_state(conversation,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
475 PURPLE_TYPING_STATE_PAUSED);
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
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
478 /*
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
479 * 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
480 * @data: The conversation instance.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
481 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
482 * 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
483 * 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
484 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
485 * 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
486 * 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
487 * 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
488 * function.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
489 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
490 * 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
491 * 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
492 */
42939
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
493 static void
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
494 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
495 PurpleConversation *conversation = data;
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 conversation->typing_state_source = 0;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
498
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
499 purple_conversation_set_typing_state(conversation,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
500 PURPLE_TYPING_STATE_NONE);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
501 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
502
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
503 /**************************************************************************
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
504 * GObject Implementation
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
505 **************************************************************************/
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
506 static void
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
507 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
508 const GValue *value, GParamSpec *pspec)
14582
ae974395b9da [gaim-migrate @ 17240]
Lars T. Mikkelsen
parents: 14254
diff changeset
509 {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
510 PurpleConversation *conversation = PURPLE_CONVERSATION(obj);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
511
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
512 switch (param_id) {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
513 case PROP_ID:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
514 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
515 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
516 case PROP_TYPE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
517 purple_conversation_set_conversation_type(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
518 g_value_get_enum(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
519 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
520 case PROP_ACCOUNT:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
521 purple_conversation_set_account(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
522 g_value_get_object(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
523 break;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
524 case PROP_AVATAR_EDITABLE:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
525 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
526 g_value_get_boolean(value));
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
527 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
528 case PROP_AVATAR:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
529 purple_conversation_set_avatar(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
530 g_value_get_object(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
531 break;
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
532 case PROP_ALIAS:
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
533 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
534 break;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
535 case PROP_TITLE_EDITABLE:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
536 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
537 g_value_get_boolean(value));
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
538 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
539 case PROP_TITLE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
540 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
541 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
542 case PROP_AGE_RESTRICTED:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
543 purple_conversation_set_age_restricted(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
544 g_value_get_boolean(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
545 break;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
546 case PROP_DESCRIPTION_EDITABLE:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
547 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
548 g_value_get_boolean(value));
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
549 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
550 case PROP_DESCRIPTION:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
551 purple_conversation_set_description(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
552 g_value_get_string(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
553 break;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
554 case PROP_TOPIC_EDITABLE:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
555 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
556 g_value_get_boolean(value));
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
557 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
558 case PROP_TOPIC:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
559 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
560 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
561 case PROP_TOPIC_AUTHOR:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
562 purple_conversation_set_topic_author(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
563 g_value_get_object(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
564 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
565 case PROP_TOPIC_UPDATED:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
566 purple_conversation_set_topic_updated(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
567 g_value_get_boxed(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
568 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
569 case PROP_USER_NICKNAME:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
570 purple_conversation_set_user_nickname(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
571 g_value_get_string(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
572 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
573 case PROP_FAVORITE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
574 purple_conversation_set_favorite(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
575 g_value_get_boolean(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
576 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
577 case PROP_CREATED_ON:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
578 purple_conversation_set_created_on(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
579 g_value_get_boxed(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
580 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
581 case PROP_CREATOR:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
582 purple_conversation_set_creator(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
583 g_value_get_object(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
584 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
585 case PROP_ONLINE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
586 purple_conversation_set_online(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
587 g_value_get_boolean(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
588 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
589 case PROP_FEDERATED:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
590 purple_conversation_set_federated(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
591 g_value_get_boolean(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
592 break;
42848
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
593 case PROP_NEEDS_ATTENTION:
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
594 purple_conversation_set_needs_attention(conversation,
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
595 g_value_get_boolean(value));
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
596 break;
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
597 case PROP_TYPING_STATE:
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
598 purple_conversation_set_typing_state(conversation,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
599 g_value_get_enum(value));
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
600 break;
42908
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
601 case PROP_LOGGING:
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
602 purple_conversation_set_logging(conversation,
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
603 g_value_get_boolean(value));
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
604 break;
42916
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
605 case PROP_DRAFTING:
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
606 purple_conversation_set_drafting(conversation,
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
607 g_value_get_boolean(value));
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
608 break;
43234
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
609 case PROP_URL:
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
610 purple_conversation_set_url(conversation, g_value_get_string(value));
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
611 break;
43064
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
612 case PROP_ERROR:
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
613 purple_conversation_set_error(conversation, g_value_get_boxed(value));
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
614 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
615 default:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
616 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
617 break;
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
618 }
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
619 }
23312
0530decb56e4 Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23278
diff changeset
620
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
621 static void
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
622 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
623 GParamSpec *pspec)
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
624 {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
625 PurpleConversation *conversation = PURPLE_CONVERSATION(obj);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
626
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
627 switch(param_id) {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
628 case PROP_ID:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
629 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
630 break;
42800
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
631 case PROP_GLOBAL_ID:
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
632 g_value_take_string(value,
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
633 purple_conversation_get_global_id(conversation));
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
634 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
635 case PROP_TYPE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
636 g_value_set_enum(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
637 purple_conversation_get_conversation_type(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
638 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
639 case PROP_ACCOUNT:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
640 g_value_set_object(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
641 purple_conversation_get_account(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
642 break;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
643 case PROP_AVATAR_EDITABLE:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
644 g_value_set_boolean(value,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
645 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
646 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
647 case PROP_AVATAR:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
648 g_value_set_object(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
649 purple_conversation_get_avatar(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
650 break;
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
651 case PROP_ALIAS:
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
652 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
653 break;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
654 case PROP_TITLE_EDITABLE:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
655 g_value_set_boolean(value,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
656 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
657 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
658 case PROP_TITLE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
659 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
660 break;
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
661 case PROP_TITLE_FOR_DISPLAY:
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
662 g_value_set_string(value,
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
663 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
664 break;
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
665 case PROP_TITLE_GENERATED:
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
666 g_value_set_boolean(value,
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
667 purple_conversation_get_title_generated(conversation));
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
668 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
669 case PROP_AGE_RESTRICTED:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
670 g_value_set_boolean(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
671 purple_conversation_get_age_restricted(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
672 break;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
673 case PROP_DESCRIPTION_EDITABLE:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
674 g_value_set_boolean(value,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
675 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
676 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
677 case PROP_DESCRIPTION:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
678 g_value_set_string(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
679 purple_conversation_get_description(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
680 break;
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
681 case PROP_TOPIC_EDITABLE:
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
682 g_value_set_boolean(value,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
683 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
684 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
685 case PROP_TOPIC:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
686 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
687 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
688 case PROP_TOPIC_AUTHOR:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
689 g_value_set_object(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
690 purple_conversation_get_topic_author(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
691 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
692 case PROP_TOPIC_UPDATED:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
693 g_value_set_boxed(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
694 purple_conversation_get_topic_updated(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
695 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
696 case PROP_USER_NICKNAME:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
697 g_value_set_string(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
698 purple_conversation_get_user_nickname(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
699 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
700 case PROP_FAVORITE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
701 g_value_set_boolean(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
702 purple_conversation_get_favorite(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
703 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
704 case PROP_CREATED_ON:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
705 g_value_set_boxed(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
706 purple_conversation_get_created_on(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
707 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
708 case PROP_CREATOR:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
709 g_value_set_object(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
710 purple_conversation_get_creator(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
711 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
712 case PROP_ONLINE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
713 g_value_set_boolean(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
714 purple_conversation_get_online(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
715 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
716 case PROP_FEDERATED:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
717 g_value_set_boolean(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
718 purple_conversation_get_federated(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
719 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
720 case PROP_TAGS:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
721 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
722 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
723 case PROP_MEMBERS:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
724 g_value_set_object(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
725 purple_conversation_get_members(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
726 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
727 case PROP_MESSAGES:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
728 g_value_set_object(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
729 purple_conversation_get_messages(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
730 break;
42848
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
731 case PROP_NEEDS_ATTENTION:
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
732 g_value_set_boolean(value,
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
733 purple_conversation_get_needs_attention(conversation));
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
734 break;
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
735 case PROP_TYPING_STATE:
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
736 g_value_set_enum(value,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
737 purple_conversation_get_typing_state(conversation));
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
738 break;
42908
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
739 case PROP_LOGGING:
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
740 g_value_set_boolean(value,
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
741 purple_conversation_get_logging(conversation));
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
742 break;
42916
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
743 case PROP_DRAFTING:
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
744 g_value_set_boolean(value,
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
745 purple_conversation_get_drafting(conversation));
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
746 break;
43064
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
747 case PROP_ERROR:
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
748 g_value_set_boxed(value, purple_conversation_get_error(conversation));
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
749 break;
43234
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
750 case PROP_URL:
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
751 g_value_set_string(value, purple_conversation_get_url(conversation));
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
752 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
753 default:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
754 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
755 break;
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
756 }
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
757 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
758
39380
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39352
diff changeset
759 static void
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
760 purple_conversation_init(PurpleConversation *conversation) {
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
761 conversation->tags = purple_tags_new();
42968
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
762
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
763 /* 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
764 * 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
765 * 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
766 */
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
767 purple_tags_add(conversation->tags, "type");
9bb936b002a2 Add some automatic tags to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42939
diff changeset
768
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
769 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
770
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
771 conversation->members = purple_conversation_members_new();
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
772 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
773 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
774 conversation, G_CONNECT_DEFAULT);
42981
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
775 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
776 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
777 conversation, G_CONNECT_DEFAULT);
c512d4a3eda0 Add some basic event messages for membership changes
Gary Kramlich <grim@reaperworld.com>
parents: 42968
diff changeset
778 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
779 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
780 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
781 }
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39352
diff changeset
782
34687
aebc4dd321bf Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents: 34684
diff changeset
783 static void
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
784 purple_conversation_constructed(GObject *object) {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
785 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
786
39380
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39352
diff changeset
787 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
788
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
789 if(purple_strempty(conversation->title)) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
790 if(conversation->type == PURPLE_CONVERSATION_TYPE_DM ||
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
791 conversation->type == PURPLE_CONVERSATION_TYPE_GROUP_DM)
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 /* 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
794 * set_title_generated.
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
795 */
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
796 purple_conversation_set_title_generated(conversation, TRUE);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
797 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
798 }
5858
1bc64d957067 [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
799 }
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
800
36109
2e4dd08b0131 Conversations: fix glib warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36108
diff changeset
801 static void
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
802 purple_conversation_finalize(GObject *object) {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
803 PurpleConversation *conversation = PURPLE_CONVERSATION(object);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30706
diff changeset
804
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
805 purple_request_close_with_handle(conversation);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
806
42778
4aa4ab7b24a7 Add the ability to leave conversations to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42773
diff changeset
807 g_clear_object(&conversation->account);
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
808 g_clear_pointer(&conversation->id, g_free);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
809 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
810 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
811 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
812
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
813 g_clear_pointer(&conversation->description, g_free);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
814 g_clear_pointer(&conversation->topic, g_free);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
815 g_clear_object(&conversation->topic_author);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
816 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
817 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
818 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
819 g_clear_object(&conversation->creator);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
820 g_clear_object(&conversation->tags);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
821 g_clear_object(&conversation->members);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
822 g_clear_object(&conversation->messages);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
823
42902
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
824 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
825 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
826
43064
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
827 g_clear_error(&conversation->error);
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
828
43234
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
829 g_clear_pointer(&conversation->url, g_free);
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
830
39380
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39352
diff changeset
831 G_OBJECT_CLASS(purple_conversation_parent_class)->finalize(object);
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
832 }
19904
8abf4c2056eb Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19859
diff changeset
833
34687
aebc4dd321bf Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents: 34684
diff changeset
834 static void
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
835 purple_conversation_class_init(PurpleConversationClass *klass) {
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
836 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
837
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
838 obj_class->constructed = purple_conversation_constructed;
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
839 obj_class->finalize = purple_conversation_finalize;
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
840 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
841 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
842
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
843 /**
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
844 * PurpleConversation:id:
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 * 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
847 * 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
848 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
849 * Since: 3.0
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
850 */
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
851 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
852 "id", NULL, NULL,
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
853 NULL,
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
854 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
855
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
856 /**
42800
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
857 * PurpleConversation:global-id:
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
858 *
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
859 * A libpurple global id for the conversation.
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
860 *
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
861 * 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
862 * 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
863 * libpurple.
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
864 *
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
865 * Since: 3.0
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 properties[PROP_GLOBAL_ID] = g_param_spec_string(
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
868 "global-id", NULL, NULL,
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
869 NULL,
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
870 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
871
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
872 /**
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
873 * PurpleConversation:type:
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 * 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
876 * libpurple treats all conversations the same.
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
877 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
878 * Since: 3.0
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
879 */
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
880 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
881 "type", NULL, NULL,
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
882 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
883 PURPLE_CONVERSATION_TYPE_UNSET,
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
884 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
885
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
886 /**
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 * 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
888 *
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
889 * 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
890 *
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
891 * 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
892 */
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
893 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
894 "account", NULL, NULL,
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
895 PURPLE_TYPE_ACCOUNT,
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
896 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
897
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
898 /**
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
899 * PurpleConversation:avatar-editable:
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 * 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
902 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
903 * 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
904 * 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
905 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
906 * User interfaces should check
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
907 * [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
908 * action available to users.
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
909 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
910 * Since: 3.0
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 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
913 "avatar-editable", NULL, NULL,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
914 FALSE,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
915 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
916
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
917 /**
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
918 * PurpleConversation:avatar:
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
919 *
43301
0e43dc8462e8 Replace Purple.Avatar with Purple.Image
Gary Kramlich <grim@reaperworld.com>
parents: 43234
diff changeset
920 * The avatar for the conversation.
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 * 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
923 * avatar of the remote contact for direct messages.
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
924 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
925 * Since: 3.0
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
926 */
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
927 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
928 "avatar", NULL, NULL,
43301
0e43dc8462e8 Replace Purple.Avatar with Purple.Image
Gary Kramlich <grim@reaperworld.com>
parents: 43234
diff changeset
929 PURPLE_TYPE_IMAGE,
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
930 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
931
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
932 /**
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
933 * PurpleConversation:alias:
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
934 *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
935 * 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
936 *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
937 * Since: 3.0
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 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
940 "alias", NULL, NULL,
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
941 NULL,
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
942 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
943
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
944 /**
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
945 * PurpleConversation:title-editable:
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 * 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
948 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
949 * 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
950 * 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
951 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
952 * User interfaces should check
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
953 * [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
954 * action available to users.
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
955 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
956 * Since: 3.0
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 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
959 "title-editable", NULL, NULL,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
960 FALSE,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
961 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
962
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
963 /**
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
964 * 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
965 *
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
966 * 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
967 *
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
968 * 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
969 */
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
970 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
971 "title", NULL, NULL,
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
972 NULL,
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
973 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
974
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
975 /**
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
976 * PurpleConversation:title-for-display:
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 * 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
979 * properties are set.
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 * 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
982 *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
983 * 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
984 * of title will be returned.
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 * 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
987 * else is set.
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
988 *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
989 * Since: 3.0
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 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
992 "title-for-display", NULL, NULL,
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
993 NULL,
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
994 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
995
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
996 /**
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
997 * PurpleConversation:title-generated:
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 * 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
1000 * [method@Conversation.generate_title].
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1001 *
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1002 * 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
1003 *
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1004 * 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
1005 * 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
1006 * their display name changes.
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1007 *
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1008 * Since: 3.0
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1009 */
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1010 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
1011 "title-generated", NULL, NULL,
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1012 FALSE,
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1013 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
1014
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
1015 /**
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1016 * PurpleConversation:age-restricted:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1017 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1018 * 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
1019 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1020 * 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
1021 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1022 * Since: 3.0
42292
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 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
1025 "age-restricted", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1026 FALSE,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1027 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1028
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1029 /**
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1030 * PurpleConversation:description-editable:
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 * 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
1033 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1034 * 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
1035 * 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
1036 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1037 * User interfaces should check
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1038 * [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
1039 * this action available to users.
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1040 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1041 * Since: 3.0
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 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
1044 "description-editable", NULL, NULL,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1045 FALSE,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1046 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
1047
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1048 /**
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1049 * PurpleConversation:description:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1050 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1051 * 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
1052 * 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
1053 * in [property@Conversation:topic].
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1054 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1055 * 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
1056 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1057 * Since: 3.0
42292
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 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
1060 "description", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1061 NULL,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1062 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1063
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1064 /**
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1065 * PurpleConversation:topic-editable:
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 * 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
1068 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1069 * 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
1070 * 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
1071 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1072 * User interfaces should check
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1073 * [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
1074 * action available to users.
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1075 *
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1076 * Since: 3.0
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 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
1079 "topic-editable", NULL, NULL,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1080 FALSE,
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1081 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
1082
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1083 /**
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1084 * PurpleConversation:topic:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1085 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1086 * The topic of the conversation.
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 * 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
1089 * requires permission for the user to set.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1090 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1091 * Since: 3.0
42292
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 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
1094 "topic", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1095 NULL,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1096 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
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 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1099 * PurpleConversation:topic-author:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1100 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1101 * 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
1102 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1103 * 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
1104 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1105 * Since: 3.0
42292
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 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
1108 "topic-author", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1109 PURPLE_TYPE_CONTACT_INFO,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1110 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
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 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1113 * PurpleConversation:topic-updated:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1114 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1115 * 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
1116 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1117 * 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
1118 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1119 * Since: 3.0
42292
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 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
1122 "topic-updated", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1123 G_TYPE_DATE_TIME,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1124 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
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 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1127 * PurpleConversation:user-nickname:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1128 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1129 * The user's nickname in this conversation.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1130 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1131 * 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
1132 * 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
1133 * value.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1134 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1135 * Since: 3.0
42292
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 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
1138 "user-nickname", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1139 NULL,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1140 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1141
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1142 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1143 * PurpleConversation:favorite:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1144 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1145 * 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
1146 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1147 * Since: 3.0
42292
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 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
1150 "favorite", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1151 FALSE,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1152 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1153
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 * PurpleConversation:created-on:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1156 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1157 * 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
1158 * 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
1159 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1160 * 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
1161 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1162 * Since: 3.0
42292
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 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
1165 "created-on", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1166 G_TYPE_DATE_TIME,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1167 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
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 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1170 * PurpleConversation:creator:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1171 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1172 * The [class@ContactInfo] that created the conversation.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1173 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1174 * 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
1175 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1176 * Since: 3.0
42292
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 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
1179 "creator", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1180 PURPLE_TYPE_CONTACT_INFO,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1181 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1182
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1183 /**
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1184 * PurpleConversation:online:
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 * 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
1187 *
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1188 * 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
1189 * conversation belongs is online or not.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1190 *
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1191 * 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
1192 * 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
1193 * unreachable.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1194 *
42486
594f84a2c97f Fix some small doc issues
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42355
diff changeset
1195 * See also [property@Conversation:federated].
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1196 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1197 * Since: 3.0
42318
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 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
1200 "online", NULL, NULL,
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1201 TRUE,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1202 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
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 /**
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1205 * PurpleConversation:federated:
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 * Whether or this conversation is federated.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1208 *
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1209 * 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
1210 * conversations.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1211 *
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1212 * 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
1213 * 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
1214 * 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
1215 * 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
1216 * case.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1217 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1218 * Since: 3.0
42318
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 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
1221 "federated", NULL, NULL,
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1222 FALSE,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1223 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
1224
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1225 /**
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1226 * PurpleConversation:tags:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1227 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1228 * [class@Tags] for the conversation.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1229 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1230 * Since: 3.0
42292
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 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
1233 "tags", NULL, NULL,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1234 PURPLE_TYPE_TAGS,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1235 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1236
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1237 /**
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1238 * PurpleConversation:members:
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1239 *
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1240 * The members that are currently in this conversation.
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1241 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1242 * Since: 3.0
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1243 */
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1244 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
1245 "members", NULL, NULL,
42891
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
1246 PURPLE_TYPE_CONVERSATION_MEMBERS,
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1247 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1248
42299
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1249 /**
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1250 * PurpleConversation:messages:
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1251 *
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1252 * 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
1253 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1254 * Since: 3.0
42299
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1255 */
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1256 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
1257 "messages", NULL, NULL,
42299
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1258 G_TYPE_LIST_MODEL,
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1259 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1260
42848
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1261 /**
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1262 * PurpleConversation:needs-attention:
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 * Whether or not the conversation needs attention.
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 * 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
1267 * kicked from the room, or something else.
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1268 *
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1269 * Since: 3.0
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1270 */
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1271 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
1272 "needs-attention", NULL, NULL,
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1273 FALSE,
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1274 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1275
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1276 /**
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1277 * PurpleConversation:typing-state:
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1278 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1279 * 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
1280 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1281 * 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
1282 * 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
1283 * again before the timeout expires.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1284 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1285 * 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
1286 * 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
1287 * expires.
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 * 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
1290 * 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
1291 * 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
1292 * 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
1293 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1294 * 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
1295 * [iface@ProtocolConversation] and
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1296 * [vfunc@ProtocolConversation.send_typing],
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1297 * [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
1298 * 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
1299 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1300 * Since: 3.0
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1301 */
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1302 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
1303 "typing-state", NULL, NULL,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1304 PURPLE_TYPE_TYPING_STATE,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1305 PURPLE_TYPING_STATE_NONE,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1306 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
1307
42908
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1308 /**
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1309 * PurpleConversation:logging:
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1310 *
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1311 * 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
1312 *
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1313 * Since: 3.0
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1314 */
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1315 properties[PROP_LOGGING] = g_param_spec_boolean(
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1316 "logging", NULL, NULL,
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1317 FALSE,
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1318 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1319
42916
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1320 /**
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1321 * PurpleConversation:drafting:
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1322 *
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1323 * 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
1324 *
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1325 * 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
1326 * [method@Conversation.write_message] as anything can call that which
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1327 * could break the accounting of this property.
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1328 *
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1329 * Since: 3.0
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1330 */
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1331 properties[PROP_DRAFTING] = g_param_spec_boolean(
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1332 "drafting", NULL, NULL,
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1333 FALSE,
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1334 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1335
43064
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 * PurpleConversation:error:
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 * 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
1340 * be a channel connection error or a kick message.
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1341 *
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1342 * Since: 3.0
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1343 */
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1344 properties[PROP_ERROR] = g_param_spec_boxed(
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1345 "error", NULL, NULL,
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1346 G_TYPE_ERROR,
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1347 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
1348
43234
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1349 /**
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1350 * PurpleConversation:url:
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1351 *
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1352 * A URL related to the conversation.
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 * 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
1355 * 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
1356 * 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
1357 * itself.
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1358 *
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1359 * Since: 3.0
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1360 */
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1361 properties[PROP_URL] = g_param_spec_string(
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1362 "url", NULL, NULL,
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1363 NULL,
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1364 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
1365
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1366 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
1367
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1368 /**
42736
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1369 * PurpleConversation::present:
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1370 * @conversation: The instance.
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 * 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
1373 * 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
1374 *
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1375 * Since: 3.0
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1376 */
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1377 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
1378 "present",
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1379 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
1380 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
1381 NULL,
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1382 NULL,
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1383 NULL,
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1384 NULL,
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1385 G_TYPE_NONE,
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1386 0);
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1387 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1388
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1389 /******************************************************************************
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1390 * Public API
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1391 *****************************************************************************/
42669
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1392 gboolean
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1393 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
1394 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
1395
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1396 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
1397 }
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1398
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1399 gboolean
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1400 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
1401 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
1402
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1403 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
1404 }
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1405
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1406 gboolean
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1407 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
1408 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
1409
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1410 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
1411 }
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1412
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1413 gboolean
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1414 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
1415 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
1416
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1417 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
1418 }
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1419
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1420 void
42736
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1421 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
1422 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
1423
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1424 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
1425 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1426
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
1427 const char *
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
1428 purple_conversation_get_id(PurpleConversation *conversation) {
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
1429 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
1430
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1431 return conversation->id;
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
1432 }
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
1433
42800
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1434 char *
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1435 purple_conversation_get_global_id(PurpleConversation *conversation) {
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1436 const char *account_id = NULL;
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1437
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1438 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
1439
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1440 account_id = purple_account_get_id(conversation->account);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1441
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1442 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
1443 }
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1444
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
1445 PurpleConversationType
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
1446 purple_conversation_get_conversation_type(PurpleConversation *conversation) {
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
1447 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
1448 PURPLE_CONVERSATION_TYPE_UNSET);
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
1449
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1450 return conversation->type;
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
1451 }
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
1452
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1453 PurpleAccount *
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1454 purple_conversation_get_account(PurpleConversation *conversation) {
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1455 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
1456
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1457 return conversation->account;
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1458 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1459
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1460 PurpleConnection *
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1461 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
1462 PurpleAccount *account;
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1463
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1464 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
1465
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1466 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
1467
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1468 if(account == NULL) {
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1469 return NULL;
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1470 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1471
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1472 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
1473 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1474
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1475 void
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1476 purple_conversation_set_title(PurpleConversation *conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1477 const char *title)
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1478 {
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1479 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
1480
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42760
diff changeset
1481 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
1482 GObject *obj = G_OBJECT(conversation);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1483
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1484 /* 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
1485 * 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
1486 * 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
1487 * 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
1488 * 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
1489 * additional API that skips that part.
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1490 */
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1491 g_object_freeze_notify(obj);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1492 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
1493 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
1494 purple_conversation_set_title_generated(conversation, FALSE);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1495 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
1496 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1497 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1498
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1499 const char *
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1500 purple_conversation_get_title(PurpleConversation *conversation) {
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1501 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
1502
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1503 return conversation->title;
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1504 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1505
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1506 void
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1507 purple_conversation_generate_title(PurpleConversation *conversation) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1508 PurpleAccount *account = NULL;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1509 PurpleContactInfo *account_info = NULL;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1510 GString *str = NULL;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1511 guint n_members = 0;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1512 gboolean first = TRUE;
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1513
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1514 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
1515
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1516 if(conversation->type != PURPLE_CONVERSATION_TYPE_DM &&
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1517 conversation->type != PURPLE_CONVERSATION_TYPE_GROUP_DM)
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 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
1520 "DM conversation");
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1521
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1522 return;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1523 }
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 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
1526 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
1527
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1528 str = g_string_new("");
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1529
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1530 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
1531 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
1532 PurpleContactInfo *info = NULL;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1533 PurpleConversationMember *member = NULL;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1534 const char *name = NULL;
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 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
1537 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
1538 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
1539 g_clear_object(&member);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1540
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1541 continue;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1542 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1543
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1544 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
1545 if(purple_strempty(name)) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1546 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
1547
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1548 g_clear_object(&member);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1549
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1550 continue;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1551 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1552
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1553 if(!first) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1554 g_string_append_printf(str, ", %s", name);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1555 } else {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1556 g_string_append(str, name);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1557 first = FALSE;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1558 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1559
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1560 g_clear_object(&member);
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
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1563 /* 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
1564 if(!first) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1565 GObject *obj = G_OBJECT(conversation);
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 g_object_freeze_notify(obj);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1568 purple_conversation_set_title(conversation, str->str);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1569 purple_conversation_set_title_generated(conversation, TRUE);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1570 g_object_thaw_notify(obj);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1571 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1572
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1573 g_string_free(str, TRUE);
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
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1576 gboolean
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1577 purple_conversation_get_title_generated(PurpleConversation *conversation) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1578 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
1579
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1580 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
1581 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1582
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1583 gboolean
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1584 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
1585 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
1586
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1587 return conversation->title_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
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1590 void
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1591 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
1592 gboolean 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_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
1595
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1596 if(conversation->title_editable != editable) {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1597 conversation->title_editable = editable;
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1598
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1599 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
1600 properties[PROP_TITLE_EDITABLE]);
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1601 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1602 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1603
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1604 void
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1605 purple_conversation_write_message(PurpleConversation *conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1606 PurpleMessage *message)
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1607 {
43100
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
1608 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
1609
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1610 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
1611 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
1612
42908
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1613 if(conversation->logging) {
41090
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1614 GError *error = NULL;
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1615 PurpleHistoryManager *manager = NULL;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1616 gboolean success = FALSE;
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1617
41090
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1618 manager = purple_history_manager_get_default();
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1619 /* 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
1620 * 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
1621 */
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1622 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
1623 &error);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1624 if(!success){
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1625 purple_debug_info("conversation",
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1626 "history manager write returned error: %s",
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1627 error->message);
41090
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1628
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1629 g_clear_error(&error);
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1630 }
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1631 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1632
43100
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
1633 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
1634 /* 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
1635 if(PURPLE_IS_CONVERSATION_MEMBER(member)) {
d7965104ef85 Fix some PURPLE_IS_CONVERSATION_MEMEBER assertion failures
Gary Kramlich <grim@reaperworld.com>
parents: 43100
diff changeset
1636 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
1637 PURPLE_TYPING_STATE_NONE,
d7965104ef85 Fix some PURPLE_IS_CONVERSATION_MEMEBER assertion failures
Gary Kramlich <grim@reaperworld.com>
parents: 43100
diff changeset
1638 0);
d7965104ef85 Fix some PURPLE_IS_CONVERSATION_MEMEBER assertion failures
Gary Kramlich <grim@reaperworld.com>
parents: 43100
diff changeset
1639 }
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
1640
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1641 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
1642 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1643
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1644 void
42743
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1645 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
1646 PurpleMessage *message,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1647 GCancellable *cancellable,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1648 GAsyncReadyCallback callback,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1649 gpointer data)
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 PurpleAccount *account = NULL;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1652 PurpleProtocol *protocol = NULL;
43056
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1653 PurpleProtocolConversation *protocol_conversation = NULL;
42743
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1654 GTask *task = NULL;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1655
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1656 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
1657 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
1658
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1659 purple_conversation_set_typing_state(conversation,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1660 PURPLE_TYPING_STATE_NONE);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1661
42743
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1662 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
1663 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
1664 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
1665
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1666 account = purple_conversation_get_account(conversation);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1667 protocol = purple_account_get_protocol(account);
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 if(!PURPLE_IS_PROTOCOL_CONVERSATION(protocol)) {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1670 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
1671 "protocol does not implement "
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1672 "PurpleProtocolConversation");
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1673
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1674 g_clear_object(&task);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1675
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1676 return;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1677 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1678
43056
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1679 protocol_conversation = PURPLE_PROTOCOL_CONVERSATION(protocol);
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1680 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
1681 {
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1682 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
1683 "protocol does not implement "
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1684 "PurpleProtocolConversation.send_message");
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1685
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1686 g_clear_object(&task);
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1687
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1688 return;
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1689 }
49358391e695 Add Purple.ProtocolConversation.implements_send_message
Gary Kramlich <grim@reaperworld.com>
parents: 43018
diff changeset
1690
42743
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1691 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
1692 conversation,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1693 message,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1694 cancellable,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1695 purple_conversation_send_message_async_cb,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1696 task);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1697 }
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 gboolean
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1700 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
1701 GAsyncResult *result,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1702 GError **error)
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1703 {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1704 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
1705 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
1706
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1707 g_return_val_if_fail(g_task_get_source_tag(G_TASK(result)) !=
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1708 purple_conversation_send_message_async, FALSE);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1709
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1710 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
1711 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1712
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1713 gboolean
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1714 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
1715 gboolean ret = FALSE;
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1716
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1717 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
1718
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1719 return ret;
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1720 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1721
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1722 gboolean
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1723 purple_conversation_get_age_restricted(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1724 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
1725
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1726 return conversation->age_restricted;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1727 }
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 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1730 purple_conversation_set_age_restricted(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1731 gboolean age_restricted)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1732 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1733 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
1734
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1735 if(conversation->age_restricted != age_restricted) {
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1736 conversation->age_restricted = age_restricted;
42292
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 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
1739 properties[PROP_AGE_RESTRICTED]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1740 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1741 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1742
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1743 const char *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1744 purple_conversation_get_description(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1745 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
1746
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1747 return conversation->description;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1748 }
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 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1751 purple_conversation_set_description(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1752 const char *description)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1753 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1754 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
1755
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42760
diff changeset
1756 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
1757 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
1758 properties[PROP_DESCRIPTION]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1759 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1760 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1761
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1762 gboolean
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1763 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
1764 {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1765 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
1766
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1767 return conversation->description_editable;
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1768 }
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 void
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1771 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
1772 gboolean editable)
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1773 {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1774 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
1775
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1776 if(conversation->description_editable != editable) {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1777 conversation->description_editable = editable;
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 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
1780 properties[PROP_DESCRIPTION_EDITABLE]);
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1781 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1782 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1783
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1784 const char *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1785 purple_conversation_get_topic(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1786 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
1787
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1788 return conversation->topic;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1789 }
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 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1792 purple_conversation_set_topic(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1793 const char *topic)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1794 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1795 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
1796
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42760
diff changeset
1797 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
1798 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
1799 properties[PROP_TOPIC]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1800 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1801 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1802
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1803 gboolean
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1804 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
1805 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
1806
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1807 return conversation->topic_editable;
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1808 }
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 void
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1811 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
1812 gboolean editable)
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1813 {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1814 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
1815
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1816 if(conversation->topic_editable != editable) {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1817 conversation->topic_editable = editable;
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 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
1820 properties[PROP_TOPIC_EDITABLE]);
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1821 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1822 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
1823
42302
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1824 void
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1825 purple_conversation_set_topic_full(PurpleConversation *conversation,
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1826 const char *topic,
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1827 PurpleContactInfo *author,
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1828 GDateTime *updated)
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 GObject *obj = NULL;
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1831
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1832 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1833
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1834 obj = G_OBJECT(conversation);
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1835 g_object_freeze_notify(obj);
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 purple_conversation_set_topic(conversation, topic);
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1838 purple_conversation_set_topic_author(conversation, author);
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1839 purple_conversation_set_topic_updated(conversation, updated);
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1840
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1841 g_object_thaw_notify(obj);
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1842 }
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1843
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1844
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1845 PurpleContactInfo *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1846 purple_conversation_get_topic_author(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1847 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
1848
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1849 return conversation->topic_author;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1850 }
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 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1853 purple_conversation_set_topic_author(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1854 PurpleContactInfo *author)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1855 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1856 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
1857
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1858 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
1859 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
1860 properties[PROP_TOPIC_AUTHOR]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1861 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1862 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1863
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1864 GDateTime *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1865 purple_conversation_get_topic_updated(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1866 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
1867
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1868 return conversation->topic_updated;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1869 }
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 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1872 purple_conversation_set_topic_updated(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1873 GDateTime *updated)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1874 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1875 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
1876
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1877 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
1878 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
1879 properties[PROP_TOPIC_UPDATED]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1880 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1881 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1882
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1883 const char *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1884 purple_conversation_get_user_nickname(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1885 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
1886
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1887 return conversation->user_nickname;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1888 }
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 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1891 purple_conversation_set_user_nickname(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1892 const char *nickname)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1893 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1894 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
1895
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42760
diff changeset
1896 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
1897 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
1898 properties[PROP_USER_NICKNAME]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1899 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1900 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1901
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1902 gboolean
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1903 purple_conversation_get_favorite(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1904 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
1905
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1906 return conversation->favorite;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1907 }
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 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1910 purple_conversation_set_favorite(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1911 gboolean favorite)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1912 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1913 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
1914
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1915 if(conversation->favorite != favorite) {
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1916 conversation->favorite = favorite;
42292
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 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
1919 properties[PROP_FAVORITE]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1920 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1921 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1922
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1923 GDateTime *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1924 purple_conversation_get_created_on(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1925 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
1926
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1927 return conversation->created_on;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1928 }
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 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1931 purple_conversation_set_created_on(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1932 GDateTime *created_on)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1933 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1934 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
1935
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1936 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
1937 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
1938 properties[PROP_CREATED_ON]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1939 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1940 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1941
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1942 PurpleContactInfo *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1943 purple_conversation_get_creator(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1944 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
1945
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1946 return conversation->creator;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1947 }
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 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1950 purple_conversation_set_creator(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1951 PurpleContactInfo *creator)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1952 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1953 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
1954
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1955 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
1956 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
1957 properties[PROP_CREATOR]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1958 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1959 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1960
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1961 gboolean
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1962 purple_conversation_get_online(PurpleConversation *conversation) {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1963 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
1964
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1965 return conversation->online;
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1966 }
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 void
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1969 purple_conversation_set_online(PurpleConversation *conversation,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1970 gboolean online)
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1971 {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1972 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
1973
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1974 if(conversation->online != online) {
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1975 conversation->online = online;
42318
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 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
1978 properties[PROP_ONLINE]);
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1979 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1980 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1981
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1982 gboolean
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1983 purple_conversation_get_federated(PurpleConversation *conversation) {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1984 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
1985
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1986 return conversation->federated;
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1987 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1988
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1989 PurpleTags *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1990 purple_conversation_get_tags(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1991 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
1992
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1993 return conversation->tags;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1994 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1995
42891
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
1996 PurpleConversationMembers *
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1997 purple_conversation_get_members(PurpleConversation *conversation) {
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1998 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
1999
42891
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
2000 return conversation->members;
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
2001 }
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
2002
42299
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
2003 GListModel *
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
2004 purple_conversation_get_messages(PurpleConversation *conversation) {
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
2005 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
2006
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
2007 if(G_IS_LIST_MODEL(conversation->messages)) {
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
2008 return G_LIST_MODEL(conversation->messages);
42299
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
2009 }
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
2010
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
2011 return NULL;
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
2012 }
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2013
43301
0e43dc8462e8 Replace Purple.Avatar with Purple.Image
Gary Kramlich <grim@reaperworld.com>
parents: 43234
diff changeset
2014 PurpleImage *
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2015 purple_conversation_get_avatar(PurpleConversation *conversation) {
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2016 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
2017
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
2018 return conversation->avatar;
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2019 }
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 void
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2022 purple_conversation_set_avatar(PurpleConversation *conversation,
43301
0e43dc8462e8 Replace Purple.Avatar with Purple.Image
Gary Kramlich <grim@reaperworld.com>
parents: 43234
diff changeset
2023 PurpleImage *avatar)
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2024 {
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2025 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2026
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
2027 if(g_set_object(&conversation->avatar, avatar)) {
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2028 g_object_notify_by_pspec(G_OBJECT(conversation),
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2029 properties[PROP_AVATAR]);
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2030 }
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
2031 }
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2032
43137
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2033 gboolean
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2034 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
2035 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
2036
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2037 return conversation->avatar_editable;
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2038 }
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 void
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2041 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
2042 gboolean editable)
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2043 {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2044 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
2045
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2046 if(conversation->avatar_editable != editable) {
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2047 conversation->avatar_editable = editable;
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 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
2050 properties[PROP_AVATAR_EDITABLE]);
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2051 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2052 }
8d1d2ab65c87 Add properties to track whether conversation properties are editable
Gary Kramlich <grim@reaperworld.com>
parents: 43135
diff changeset
2053
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2054 const char *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2055 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
2056 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
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->alias)) {
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2059 return conversation->alias;
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 if(!purple_strempty(conversation->title)) {
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2063 return conversation->title;
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
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2066 return conversation->id;
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2067 }
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 const char *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2070 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
2071 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
2072
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2073 return conversation->alias;
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2074 }
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 void
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2077 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
2078 const char *alias)
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2079 {
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2080 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
2081
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2082 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
2083 GObject *obj = G_OBJECT(conversation);
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2084
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2085 g_object_freeze_notify(obj);
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2086 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
2087 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
2088 g_object_thaw_notify(obj);
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2089 }
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
2090 }
42848
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 gboolean
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2093 purple_conversation_get_needs_attention(PurpleConversation *conversation) {
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2094 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
2095
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2096 return conversation->needs_attention;
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2097 }
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 void
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2100 purple_conversation_set_needs_attention(PurpleConversation *conversation,
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2101 gboolean needs_attention)
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2102 {
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2103 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
2104
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2105 if(conversation->needs_attention != needs_attention) {
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2106 conversation->needs_attention = needs_attention;
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2107
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2108 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
2109 properties[PROP_NEEDS_ATTENTION]);
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2110 }
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
2111 }
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2112
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2113 PurpleTypingState
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2114 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
2115 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
2116 PURPLE_TYPING_STATE_NONE);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2117
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2118 return conversation->typing_state;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2119 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2120
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2121 void
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2122 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
2123 PurpleTypingState typing_state)
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2124 {
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
2125 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
2126
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2127 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
2128
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2129 /* 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
2130 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
2131
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2132 /* 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
2133 * 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
2134 * 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
2135 * 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
2136 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2137 * 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
2138 * typing, and the rest happens automatically.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2139 */
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2140 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
2141 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
2142
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2143 conversation->typing_state_source =
42939
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2144 g_timeout_add_seconds_once(6,
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2145 purple_conversation_typing_state_typing_cb,
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2146 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
2147
42939
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2148 /* 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
2149 * 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
2150 * sent.
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2151 *
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2152 * 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
2153 * 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
2154 * 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
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 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
2157 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
2158 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
2159
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2160 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
2161 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
2162
42939
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2163 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
2164 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
2165 }
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2166 }
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2167
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
2168 conversation->last_typing = now;
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2169 } 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
2170 conversation->typing_state_source =
42939
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2171 g_timeout_add_seconds_once(30,
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2172 purple_conversation_typing_state_paused_cb,
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2173 conversation);
4921f19b1b7b Clean up some stuff in the typing code
Gary Kramlich <grim@reaperworld.com>
parents: 42916
diff changeset
2174 } 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
2175 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
2176 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2177
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2178 if(conversation->typing_state != typing_state) {
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2179 conversation->typing_state = typing_state;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2180
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2181 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
2182 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
2183
7d128a161cad Only send the typing notifications if it's changed or if it's TYPING
Gary Kramlich <grim@reaperworld.com>
parents: 42891
diff changeset
2184 /* 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
2185 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
2186 }
7d128a161cad Only send the typing notifications if it's changed or if it's TYPING
Gary Kramlich <grim@reaperworld.com>
parents: 42891
diff changeset
2187
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2188 /* 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
2189 * 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
2190 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2191 * 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
2192 * 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
2193 */
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
2194 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
2195 PurpleProtocol *protocol = 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 = purple_account_get_protocol(conversation->account);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2198 if(PURPLE_IS_PROTOCOL_CONVERSATION(protocol)) {
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2199 PurpleProtocolConversation *protocol_conversation = NULL;
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 protocol_conversation = PURPLE_PROTOCOL_CONVERSATION(protocol);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2202
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2203 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
2204 {
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2205 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
2206 conversation,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2207 conversation->typing_state);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2208 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2209 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2210 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
2211 }
42908
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 gboolean
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2214 purple_conversation_get_logging(PurpleConversation *conversation) {
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2215 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
2216
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2217 return conversation->logging;
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2218 }
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 void
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2221 purple_conversation_set_logging(PurpleConversation *conversation,
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2222 gboolean logging)
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2223 {
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2224 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
2225
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2226 if(conversation->logging != logging) {
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2227 conversation->logging = logging;
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2228
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2229 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
2230 properties[PROP_LOGGING]);
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2231 }
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
2232 }
42916
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 gboolean
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2235 purple_conversation_get_drafting(PurpleConversation *conversation) {
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2236 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2237
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2238 return conversation->drafting;
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2239 }
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 void
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2242 purple_conversation_set_drafting(PurpleConversation *conversation,
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2243 gboolean drafting)
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2244 {
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2245 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2246
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2247 if(conversation->drafting != drafting) {
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2248 conversation->drafting = drafting;
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2249
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2250 g_object_notify_by_pspec(G_OBJECT(conversation),
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2251 properties[PROP_DRAFTING]);
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2252 }
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
2253 }
43064
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 GError *
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2256 purple_conversation_get_error(PurpleConversation *conversation) {
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2257 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2258
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2259 return conversation->error;
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2260 }
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 void
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2263 purple_conversation_set_error(PurpleConversation *conversation,
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2264 GError *error)
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2265 {
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2266 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
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 g_clear_error(&conversation->error);
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2269 if(error != NULL) {
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2270 conversation->error = g_error_copy(error);
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2271 }
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2272
ac5311a8f11e Add PurpleConversation:error property
Markus Fischer <ivanhoe@fiscari.de>
parents: 43056
diff changeset
2273 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
2274 }
43100
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2275
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2276 PurpleConversationMember *
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2277 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
2278 PurpleContactInfo *info,
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2279 gboolean announce,
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2280 const char *message)
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2281 {
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2282 PurpleConversationMember *member = NULL;
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2283
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2284 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
2285 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
2286
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2287 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
2288 info);
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2289 if(!PURPLE_IS_CONVERSATION_MEMBER(member)) {
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2290 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
2291 info, announce,
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2292 message);
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2293 }
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2294
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2295 return member;
e6df74d36862 Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents: 43071
diff changeset
2296 }
43234
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2297
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2298 const char *
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2299 purple_conversation_get_url(PurpleConversation *conversation) {
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2300 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2301
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2302 return conversation->url;
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2303 }
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2304
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2305 void
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2306 purple_conversation_set_url(PurpleConversation *conversation, const char *url)
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2307 {
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2308 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2309
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2310 if(g_set_str(&conversation->url, url)) {
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2311 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
2312 }
85be702275e6 Add Purple.Conversation:url
Gary Kramlich <grim@reaperworld.com>
parents: 43137
diff changeset
2313 }

mercurial