libpurple/purpleconversation.c

Mon, 02 Sep 2024 20:23:52 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 02 Sep 2024 20:23:52 -0500
changeset 42916
28a4480fe746
parent 42908
64bbb9d4bf94
child 42939
4921f19b1b7b
permissions
-rw-r--r--

Add Purple.Conversation:drafting

This allows user interfaces to track whether a user has started drafting a
message in a conversation and can then display something to show that.

Testing Done:
Ran the tests under valgrind and called in the turtles for the rest.

Bugs closed: PIDGIN-17916

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

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"
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40304
diff changeset
33 #include "purpleprivate.h"
42321
9c0a6010fbc5 Use PurpleProtocolConversation if it's available when sending a message.
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
34 #include "purpleprotocolconversation.h"
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
35 #include "purpletags.h"
42725
ceb13f1de2d2 Remove PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 42720
diff changeset
36 #include "signals.h"
ceb13f1de2d2 Remove PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 42720
diff changeset
37 #include "util.h"
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5860
diff changeset
38
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
39 struct _PurpleConversation {
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
40 GObject parent;
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
41
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
42 char *id;
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
43 PurpleConversationType type;
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
44 PurpleAccount *account;
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
45
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
46 PurpleAvatar *avatar;
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
47 char *name;
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
48 char *alias;
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
49 char *title;
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
50 gboolean title_generated;
11581
5c7f44be5dfe [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11552
diff changeset
51
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
52 gboolean age_restricted;
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
53 char *description;
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
54 char *topic;
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
55 PurpleContactInfo *topic_author;
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
56 GDateTime *topic_updated;
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
57 char *user_nickname;
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
58 gboolean favorite;
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
59 GDateTime *created_on;
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
60 PurpleContactInfo *creator;
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
61 gboolean online;
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
62 gboolean federated;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
63 PurpleTags *tags;
42891
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
64
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
65 PurpleConversationMembers *members;
42299
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
66
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
67 GListStore *messages;
42848
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
68 gboolean needs_attention;
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
69
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
70 PurpleTypingState typing_state;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
71 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
72 GDateTime *last_typing;
42908
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
73
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
74 gboolean logging;
42916
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
75 gboolean drafting;
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
76 };
27967
01a64c630e35 More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents: 27954
diff changeset
77
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
78 enum {
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
79 PROP_0,
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
80 PROP_ID,
42800
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
81 PROP_GLOBAL_ID,
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
82 PROP_TYPE,
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
83 PROP_ACCOUNT,
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
84 PROP_AVATAR,
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
85 PROP_NAME,
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
86 PROP_ALIAS,
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
87 PROP_TITLE,
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
88 PROP_TITLE_FOR_DISPLAY,
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
89 PROP_TITLE_GENERATED,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
90 PROP_AGE_RESTRICTED,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
91 PROP_DESCRIPTION,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
92 PROP_TOPIC,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
93 PROP_TOPIC_AUTHOR,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
94 PROP_TOPIC_UPDATED,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
95 PROP_USER_NICKNAME,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
96 PROP_FAVORITE,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
97 PROP_CREATED_ON,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
98 PROP_CREATOR,
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
99 PROP_ONLINE,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
100 PROP_FEDERATED,
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
101 PROP_TAGS,
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
102 PROP_MEMBERS,
42299
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
103 PROP_MESSAGES,
42848
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
104 PROP_NEEDS_ATTENTION,
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
105 PROP_TYPING_STATE,
42908
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
106 PROP_LOGGING,
42916
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
107 PROP_DRAFTING,
42584
687260353985 Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42557
diff changeset
108 N_PROPERTIES,
27967
01a64c630e35 More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents: 27954
diff changeset
109 };
42584
687260353985 Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42557
diff changeset
110 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
66
cf3be86d0b63 [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
111
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
112 enum {
42736
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
113 SIG_PRESENT,
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
114 N_SIGNALS,
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
115 };
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
116 static guint signals[N_SIGNALS] = {0, };
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
117
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
118 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
119
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
120 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
121 GParamSpec *pspec,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
122 gpointer data);
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
123
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
124 /**************************************************************************
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
125 * Helpers
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
126 **************************************************************************/
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
127 static void
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
128 purple_conversation_set_title_generated(PurpleConversation *conversation,
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
129 gboolean title_generated)
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
130 {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
131 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
132
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
133 /* 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
134 * 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
135 * on DMs and GroupDMs.
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
136 */
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
137 if(conversation->type != PURPLE_CONVERSATION_TYPE_DM &&
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
138 conversation->type != PURPLE_CONVERSATION_TYPE_GROUP_DM &&
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
139 title_generated)
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
140 {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
141 return;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
142 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
143
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
144 if(conversation->title_generated != title_generated) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
145 GObject *obj = G_OBJECT(conversation);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
146
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
147 conversation->title_generated = title_generated;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
148
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
149 g_object_freeze_notify(obj);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
150
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
151 if(conversation->title_generated) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
152 purple_conversation_generate_title(conversation);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
153 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
154
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
155 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
156 properties[PROP_TITLE_GENERATED]);
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 g_object_thaw_notify(obj);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
159 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
160 }
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 static void
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
163 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
164 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
165
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42760
diff changeset
166 if(g_set_str(&conversation->id, id)) {
42800
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
167 GObject *obj = G_OBJECT(conversation);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
168
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
169 g_object_freeze_notify(obj);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
170 g_object_notify_by_pspec(obj, properties[PROP_ID]);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
171 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
172 g_object_thaw_notify(obj);
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
173 }
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
174 }
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
175
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
176 static void
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
177 purple_conversation_set_account(PurpleConversation *conversation,
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
178 PurpleAccount *account)
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
179 {
42514
461893f76c54 Automatically add accounts as a member when creating conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42486
diff changeset
180 PurpleConversationMember *member = NULL;
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
181
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
182 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
183
42514
461893f76c54 Automatically add accounts as a member when creating conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42486
diff changeset
184 /* 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
185 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
186 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
187 PurpleContactInfo *info = NULL;
3e77e81168a5 Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42800
diff changeset
188
3e77e81168a5 Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42800
diff changeset
189 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
190 purple_conversation_members_remove_member(conversation->members,
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
191 info, FALSE, NULL);
42514
461893f76c54 Automatically add accounts as a member when creating conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42486
diff changeset
192 }
461893f76c54 Automatically add accounts as a member when creating conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42486
diff changeset
193 }
461893f76c54 Automatically add accounts as a member when creating conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42486
diff changeset
194
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
195 if(g_set_object(&conversation->account, account)) {
42800
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
196 GObject *obj = NULL;
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
197
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
198 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
199 PurpleContactInfo *info = NULL;
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
200 PurpleConversationMember *member = NULL;
42805
3e77e81168a5 Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42800
diff changeset
201
3e77e81168a5 Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42800
diff changeset
202 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
203 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
204 info, FALSE, NULL);
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
205
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
206 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
207 member, "typing-state",
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
208 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
209
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
210 g_signal_connect_object(account, "notify::connected",
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
211 G_CALLBACK(purple_conversation_account_connected_cb),
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
212 conversation, 0);
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
213 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
214
42800
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
215 obj = G_OBJECT(conversation);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
216 g_object_freeze_notify(obj);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
217 g_object_notify_by_pspec(obj, properties[PROP_ACCOUNT]);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
218 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
219 g_object_thaw_notify(obj);
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
220 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
221 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
222
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
223 static void
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
224 purple_conversation_set_conversation_type(PurpleConversation *conversation,
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
225 PurpleConversationType type)
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
226 {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
227 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
228
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
229 if(type != conversation->type) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
230 conversation->type = type;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
231
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
232 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
233 properties[PROP_TYPE]);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
234 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
235 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
236
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
237 static void
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
238 purple_conversation_set_federated(PurpleConversation *conversation,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
239 gboolean federated)
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
240 {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
241 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
242
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
243 if(conversation->federated != federated) {
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
244 conversation->federated = federated;
42318
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 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
247 properties[PROP_FEDERATED]);
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
248 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
249 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
250
4359
cf899ee07d1d [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
251 static void
42743
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
252 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
253 GAsyncResult *result,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
254 gpointer data)
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
255 {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
256 PurpleMessage *message = NULL;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
257 PurpleProtocolConversation *protocol = NULL;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
258 GError *error = NULL;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
259 GTask *task = data;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
260 gboolean success = FALSE;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
261
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
262 /* 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
263 * make sure its callback gets called.
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
264 */
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
265 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
266 g_clear_object(&task);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
267
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
268 return;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
269 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
270
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
271 protocol = PURPLE_PROTOCOL_CONVERSATION(source);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
272 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
273
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
274 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
275 result, &error);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
276
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
277 if(!success) {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
278 if(error == NULL) {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
279 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
280 "unknown error");
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
281 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
282
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
283 purple_message_set_error(message, error);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
284 g_task_return_error(task, error);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
285
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
286 g_clear_error(&error);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
287 } else {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
288 /* 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
289 if(!purple_message_get_delivered(message)) {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
290 purple_message_set_delivered(message, TRUE);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
291 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
292
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
293 g_task_return_boolean(task, TRUE);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
294 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
295
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
296 g_clear_object(&task);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
297 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
298
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
299 /**************************************************************************
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
300 * Callbacks
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
301 **************************************************************************/
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
302 static void
42891
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
303 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
304 G_GNUC_UNUSED guint position,
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
305 G_GNUC_UNUSED guint removed,
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
306 G_GNUC_UNUSED guint added,
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
307 gpointer data)
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
308 {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
309 PurpleConversation *conversation = data;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
310
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
311 if(purple_conversation_get_title_generated(conversation)) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
312 purple_conversation_generate_title(conversation);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
313 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
314 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
315
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
316 static void
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
317 purple_conversation_account_connected_cb(GObject *obj,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
318 G_GNUC_UNUSED GParamSpec *pspec,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
319 gpointer data)
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
320 {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
321 PurpleConversation *conversation = data;
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
322 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
323
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
324 if(conversation->federated) {
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
325 /* 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
326 * 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
327 * safely set the conversation to offline.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
328 */
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
329 if(!connected) {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
330 purple_conversation_set_online(conversation, FALSE);
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
331 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
332 } else {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
333 purple_conversation_set_online(conversation, connected);
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
334 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
335 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
336
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
337 /*
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
338 * 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
339 * @data: The conversation instance.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
340 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
341 * 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
342 * 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
343 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
344 * 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
345 * 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
346 * 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
347 * function.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
348 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
349 * 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
350 * 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
351 */
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
352 static gboolean
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
353 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
354 PurpleConversation *conversation = data;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
355
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
356 conversation->typing_state_source = 0;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
357
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
358 purple_conversation_set_typing_state(conversation,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
359 PURPLE_TYPING_STATE_PAUSED);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
360
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
361 return G_SOURCE_REMOVE;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
362 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
363
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
364 /*
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
365 * 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
366 * @data: The conversation instance.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
367 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
368 * 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
369 * 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
370 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
371 * 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
372 * 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
373 * 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
374 * function.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
375 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
376 * 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
377 * 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
378 */
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
379 static gboolean
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
380 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
381 PurpleConversation *conversation = data;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
382
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
383 conversation->typing_state_source = 0;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
384
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
385 purple_conversation_set_typing_state(conversation,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
386 PURPLE_TYPING_STATE_NONE);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
387
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
388 return G_SOURCE_REMOVE;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
389 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
390
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
391 /**************************************************************************
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
392 * GObject Implementation
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
393 **************************************************************************/
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
394 static void
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
395 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
396 const GValue *value, GParamSpec *pspec)
14582
ae974395b9da [gaim-migrate @ 17240]
Lars T. Mikkelsen
parents: 14254
diff changeset
397 {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
398 PurpleConversation *conversation = PURPLE_CONVERSATION(obj);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
399
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
400 switch (param_id) {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
401 case PROP_ID:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
402 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
403 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
404 case PROP_TYPE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
405 purple_conversation_set_conversation_type(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
406 g_value_get_enum(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
407 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
408 case PROP_ACCOUNT:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
409 purple_conversation_set_account(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
410 g_value_get_object(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
411 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
412 case PROP_AVATAR:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
413 purple_conversation_set_avatar(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
414 g_value_get_object(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
415 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
416 case PROP_NAME:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
417 purple_conversation_set_name(conversation, g_value_get_string(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
418 break;
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
419 case PROP_ALIAS:
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
420 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
421 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
422 case PROP_TITLE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
423 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
424 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
425 case PROP_AGE_RESTRICTED:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
426 purple_conversation_set_age_restricted(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
427 g_value_get_boolean(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
428 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
429 case PROP_DESCRIPTION:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
430 purple_conversation_set_description(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
431 g_value_get_string(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
432 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
433 case PROP_TOPIC:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
434 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
435 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
436 case PROP_TOPIC_AUTHOR:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
437 purple_conversation_set_topic_author(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
438 g_value_get_object(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
439 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
440 case PROP_TOPIC_UPDATED:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
441 purple_conversation_set_topic_updated(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
442 g_value_get_boxed(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
443 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
444 case PROP_USER_NICKNAME:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
445 purple_conversation_set_user_nickname(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
446 g_value_get_string(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
447 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
448 case PROP_FAVORITE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
449 purple_conversation_set_favorite(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
450 g_value_get_boolean(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
451 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
452 case PROP_CREATED_ON:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
453 purple_conversation_set_created_on(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
454 g_value_get_boxed(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
455 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
456 case PROP_CREATOR:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
457 purple_conversation_set_creator(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
458 g_value_get_object(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
459 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
460 case PROP_ONLINE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
461 purple_conversation_set_online(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
462 g_value_get_boolean(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
463 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
464 case PROP_FEDERATED:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
465 purple_conversation_set_federated(conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
466 g_value_get_boolean(value));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
467 break;
42848
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
468 case PROP_NEEDS_ATTENTION:
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
469 purple_conversation_set_needs_attention(conversation,
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
470 g_value_get_boolean(value));
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
471 break;
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
472 case PROP_TYPING_STATE:
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
473 purple_conversation_set_typing_state(conversation,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
474 g_value_get_enum(value));
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
475 break;
42908
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
476 case PROP_LOGGING:
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
477 purple_conversation_set_logging(conversation,
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
478 g_value_get_boolean(value));
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
479 break;
42916
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
480 case PROP_DRAFTING:
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
481 purple_conversation_set_drafting(conversation,
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
482 g_value_get_boolean(value));
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
483 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
484 default:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
485 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
486 break;
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
487 }
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
488 }
23312
0530decb56e4 Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23278
diff changeset
489
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
490 static void
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
491 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
492 GParamSpec *pspec)
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
493 {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
494 PurpleConversation *conversation = PURPLE_CONVERSATION(obj);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
495
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
496 switch(param_id) {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
497 case PROP_ID:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
498 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
499 break;
42800
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
500 case PROP_GLOBAL_ID:
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
501 g_value_take_string(value,
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
502 purple_conversation_get_global_id(conversation));
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
503 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
504 case PROP_TYPE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
505 g_value_set_enum(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
506 purple_conversation_get_conversation_type(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
507 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
508 case PROP_ACCOUNT:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
509 g_value_set_object(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
510 purple_conversation_get_account(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
511 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
512 case PROP_AVATAR:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
513 g_value_set_object(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
514 purple_conversation_get_avatar(conversation));
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_NAME:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
517 g_value_set_string(value, purple_conversation_get_name(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
518 break;
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
519 case PROP_ALIAS:
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
520 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
521 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
522 case PROP_TITLE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
523 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
524 break;
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
525 case PROP_TITLE_FOR_DISPLAY:
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
526 g_value_set_string(value,
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
527 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
528 break;
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
529 case PROP_TITLE_GENERATED:
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
530 g_value_set_boolean(value,
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
531 purple_conversation_get_title_generated(conversation));
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
532 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
533 case PROP_AGE_RESTRICTED:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
534 g_value_set_boolean(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
535 purple_conversation_get_age_restricted(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
536 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
537 case PROP_DESCRIPTION:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
538 g_value_set_string(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
539 purple_conversation_get_description(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
540 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
541 case PROP_TOPIC:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
542 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
543 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
544 case PROP_TOPIC_AUTHOR:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
545 g_value_set_object(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
546 purple_conversation_get_topic_author(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
547 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
548 case PROP_TOPIC_UPDATED:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
549 g_value_set_boxed(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
550 purple_conversation_get_topic_updated(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
551 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
552 case PROP_USER_NICKNAME:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
553 g_value_set_string(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
554 purple_conversation_get_user_nickname(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
555 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
556 case PROP_FAVORITE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
557 g_value_set_boolean(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
558 purple_conversation_get_favorite(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
559 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
560 case PROP_CREATED_ON:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
561 g_value_set_boxed(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
562 purple_conversation_get_created_on(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
563 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
564 case PROP_CREATOR:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
565 g_value_set_object(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
566 purple_conversation_get_creator(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
567 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
568 case PROP_ONLINE:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
569 g_value_set_boolean(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
570 purple_conversation_get_online(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
571 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
572 case PROP_FEDERATED:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
573 g_value_set_boolean(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
574 purple_conversation_get_federated(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
575 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
576 case PROP_TAGS:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
577 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
578 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
579 case PROP_MEMBERS:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
580 g_value_set_object(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
581 purple_conversation_get_members(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
582 break;
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
583 case PROP_MESSAGES:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
584 g_value_set_object(value,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
585 purple_conversation_get_messages(conversation));
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
586 break;
42848
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
587 case PROP_NEEDS_ATTENTION:
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
588 g_value_set_boolean(value,
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
589 purple_conversation_get_needs_attention(conversation));
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
590 break;
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
591 case PROP_TYPING_STATE:
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
592 g_value_set_enum(value,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
593 purple_conversation_get_typing_state(conversation));
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
594 break;
42908
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
595 case PROP_LOGGING:
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
596 g_value_set_boolean(value,
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
597 purple_conversation_get_logging(conversation));
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
598 break;
42916
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
599 case PROP_DRAFTING:
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
600 g_value_set_boolean(value,
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
601 purple_conversation_get_drafting(conversation));
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
602 break;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
603 default:
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
604 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
605 break;
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
606 }
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
607 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
608
39380
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39352
diff changeset
609 static void
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
610 purple_conversation_init(PurpleConversation *conversation) {
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
611 conversation->tags = purple_tags_new();
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
612 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
613
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
614 conversation->members = purple_conversation_members_new();
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
615 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
616 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
617 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
618 }
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39352
diff changeset
619
34687
aebc4dd321bf Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents: 34684
diff changeset
620 static void
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
621 purple_conversation_constructed(GObject *object) {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
622 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
623
39380
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39352
diff changeset
624 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
625
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
626 if(purple_strempty(conversation->title)) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
627 if(conversation->type == PURPLE_CONVERSATION_TYPE_DM ||
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
628 conversation->type == PURPLE_CONVERSATION_TYPE_GROUP_DM)
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
629 {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
630 /* 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
631 * set_title_generated.
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
632 */
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
633 purple_conversation_set_title_generated(conversation, TRUE);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
634 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
635 }
5858
1bc64d957067 [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
636 }
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
637
36109
2e4dd08b0131 Conversations: fix glib warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36108
diff changeset
638 static void
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
639 purple_conversation_dispose(GObject *obj) {
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
640 g_object_set_data(obj, "is-finalizing", GINT_TO_POINTER(TRUE));
36109
2e4dd08b0131 Conversations: fix glib warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36108
diff changeset
641 }
2e4dd08b0131 Conversations: fix glib warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36108
diff changeset
642
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
643 static void
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
644 purple_conversation_finalize(GObject *object) {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
645 PurpleConversation *conversation = PURPLE_CONVERSATION(object);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30706
diff changeset
646
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
647 purple_request_close_with_handle(conversation);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
648
42778
4aa4ab7b24a7 Add the ability to leave conversations to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42773
diff changeset
649 g_clear_object(&conversation->account);
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
650 g_clear_pointer(&conversation->id, g_free);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
651 g_clear_object(&conversation->avatar);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
652 g_clear_pointer(&conversation->name, g_free);
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
653 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
654 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
655
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
656 g_clear_pointer(&conversation->description, g_free);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
657 g_clear_pointer(&conversation->topic, g_free);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
658 g_clear_object(&conversation->topic_author);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
659 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
660 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
661 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
662 g_clear_object(&conversation->creator);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
663 g_clear_object(&conversation->tags);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
664 g_clear_object(&conversation->members);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
665 g_clear_object(&conversation->messages);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
666
42902
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
667 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
668 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
669
39380
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39352
diff changeset
670 G_OBJECT_CLASS(purple_conversation_parent_class)->finalize(object);
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
671 }
19904
8abf4c2056eb Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19859
diff changeset
672
34687
aebc4dd321bf Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents: 34684
diff changeset
673 static void
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
674 purple_conversation_class_init(PurpleConversationClass *klass) {
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
675 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
676
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
677 obj_class->constructed = purple_conversation_constructed;
36109
2e4dd08b0131 Conversations: fix glib warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36108
diff changeset
678 obj_class->dispose = purple_conversation_dispose;
34646
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
679 obj_class->finalize = purple_conversation_finalize;
e7f4631e93f7 Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
680 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
681 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
682
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
683 /**
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
684 * PurpleConversation:id:
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
685 *
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
686 * 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
687 * 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
688 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
689 * Since: 3.0
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
690 */
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
691 properties[PROP_ID] = g_param_spec_string(
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
692 "id", "id",
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
693 "The identifier for the conversation.",
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
694 NULL,
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
695 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
696
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
697 /**
42800
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
698 * PurpleConversation:global-id:
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
699 *
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
700 * A libpurple global id for the conversation.
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
701 *
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
702 * 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
703 * 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
704 * libpurple.
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
705 *
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
706 * Since: 3.0
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
707 */
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
708 properties[PROP_GLOBAL_ID] = g_param_spec_string(
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
709 "global-id", NULL, NULL,
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
710 NULL,
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
711 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
712
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
713 /**
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
714 * PurpleConversation:type:
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
715 *
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
716 * 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
717 * libpurple treats all conversations the same.
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
718 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
719 * Since: 3.0
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
720 */
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
721 properties[PROP_TYPE] = g_param_spec_enum(
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
722 "type", "type",
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
723 "The type of the conversation.",
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
724 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
725 PURPLE_CONVERSATION_TYPE_UNSET,
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
726 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
727
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
728 /**
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
729 * 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
730 *
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
731 * 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
732 *
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
733 * 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
734 */
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
735 properties[PROP_ACCOUNT] = g_param_spec_object(
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
736 "account", "Account",
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
737 "The account for the conversation.",
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
738 PURPLE_TYPE_ACCOUNT,
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
739 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
740
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
741 /**
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
742 * PurpleConversation:avatar:
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
743 *
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
744 * The [class@Avatar] for the conversation.
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
745 *
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
746 * 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
747 * avatar of the remote contact for direct messages.
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
748 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
749 * Since: 3.0
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
750 */
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
751 properties[PROP_AVATAR] = g_param_spec_object(
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
752 "avatar", "avatar",
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
753 "The avatar for this conversation.",
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
754 PURPLE_TYPE_AVATAR,
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
755 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
756
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
757 /**
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
758 * PurpleConversation:name:
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
759 *
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
760 * The name 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
761 *
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
762 * 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
763 */
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
764 properties[PROP_NAME] = g_param_spec_string(
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
765 "name", "Name",
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
766 "The name of the conversation.",
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
767 NULL,
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
768 G_PARAM_READWRITE | 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
769
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
770 /**
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
771 * PurpleConversation:alias:
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
772 *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
773 * 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
774 *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
775 * Since: 3.0
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
776 */
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
777 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
778 "alias", NULL, NULL,
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
779 NULL,
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
780 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
781
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
782 /**
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
783 * 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
784 *
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
785 * 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
786 *
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
787 * 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
788 */
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
789 properties[PROP_TITLE] = g_param_spec_string(
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
790 "title", "Title",
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
791 "The title of the conversation.",
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
792 NULL,
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
793 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
794
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
795 /**
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
796 * PurpleConversation:title-for-display:
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
797 *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
798 * 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
799 * properties are set.
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
800 *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
801 * 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
802 *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
803 * 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
804 * of title will be returned.
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
805 *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
806 * 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
807 * else is set.
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
808 *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
809 * Since: 3.0
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
810 */
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
811 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
812 "title-for-display", NULL, NULL,
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
813 NULL,
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
814 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
815
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
816 /**
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
817 * PurpleConversation:title-generated:
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
818 *
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
819 * 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
820 * [method@Conversation.generate_title].
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
821 *
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
822 * 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
823 *
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
824 * 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
825 * 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
826 * their display name changes.
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
827 *
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
828 * Since: 3.0
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
829 */
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
830 properties[PROP_TITLE_GENERATED] = g_param_spec_boolean(
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
831 "title-generated", "title-generated",
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
832 "Whether or not the current title was generated.",
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
833 FALSE,
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
834 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
835
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
836 /**
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
837 * PurpleConversation:age-restricted:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
838 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
839 * 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
840 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
841 * 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
842 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
843 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
844 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
845 properties[PROP_AGE_RESTRICTED] = g_param_spec_boolean(
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
846 "age-restricted", "age-restricted",
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
847 "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
848 FALSE,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
849 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
850
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
851 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
852 * PurpleConversation:description:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
853 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
854 * 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
855 * 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
856 * in [property@Conversation:topic].
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
857 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
858 * 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
859 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
860 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
861 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
862 properties[PROP_DESCRIPTION] = g_param_spec_string(
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
863 "description", "description",
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
864 "The description for the conversation.",
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
865 NULL,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
866 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
867
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
868 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
869 * PurpleConversation:topic:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
870 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
871 * The topic of the conversation.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
872 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
873 * 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
874 * requires permission for the user to set.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
875 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
876 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
877 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
878 properties[PROP_TOPIC] = g_param_spec_string(
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
879 "topic", "topic",
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
880 "The topic for the conversation.",
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
881 NULL,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
882 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
883
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
884 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
885 * PurpleConversation:topic-author:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
886 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
887 * 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
888 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
889 * 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
890 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
891 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
892 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
893 properties[PROP_TOPIC_AUTHOR] = g_param_spec_object(
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
894 "topic-author", "topic-author",
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
895 "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
896 PURPLE_TYPE_CONTACT_INFO,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
897 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
898
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
899 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
900 * PurpleConversation:topic-updated:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
901 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
902 * 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
903 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
904 * 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
905 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
906 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
907 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
908 properties[PROP_TOPIC_UPDATED] = g_param_spec_boxed(
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
909 "topic-updated", "topic-updated",
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
910 "The time when the topic was last updated for the conversation.",
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
911 G_TYPE_DATE_TIME,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
912 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
913
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
914 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
915 * PurpleConversation:user-nickname:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
916 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
917 * The user's nickname in this conversation.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
918 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
919 * 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
920 * 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
921 * value.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
922 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
923 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
924 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
925 properties[PROP_USER_NICKNAME] = g_param_spec_string(
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
926 "user-nickname", "user-nickname",
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
927 "The nickname for the user in the conversation.",
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
928 NULL,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
929 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
930
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
931 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
932 * PurpleConversation:favorite:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
933 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
934 * 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
935 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
936 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
937 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
938 properties[PROP_FAVORITE] = g_param_spec_boolean(
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
939 "favorite", "favorite",
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
940 "Whether or not the conversation is a favorite.",
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
941 FALSE,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
942 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
943
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
944 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
945 * PurpleConversation:created-on:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
946 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
947 * 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
948 * 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
949 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
950 * 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
951 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
952 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
953 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
954 properties[PROP_CREATED_ON] = g_param_spec_boxed(
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
955 "created-on", "created-on",
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
956 "When the conversation was created.",
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
957 G_TYPE_DATE_TIME,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
958 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
959
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
960 /**
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
961 * PurpleConversation:creator:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
962 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
963 * The [class@ContactInfo] that created the conversation.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
964 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
965 * 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
966 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
967 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
968 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
969 properties[PROP_CREATOR] = g_param_spec_object(
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
970 "creator", "creator",
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
971 "The contact info of who created the conversation.",
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
972 PURPLE_TYPE_CONTACT_INFO,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
973 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
974
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
975 /**
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
976 * PurpleConversation:online:
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
977 *
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
978 * 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
979 *
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
980 * 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
981 * conversation belongs is online or not.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
982 *
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
983 * 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
984 * 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
985 * unreachable.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
986 *
42486
594f84a2c97f Fix some small doc issues
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42355
diff changeset
987 * See also [property@Conversation:federated].
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
988 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
989 * Since: 3.0
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
990 */
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
991 properties[PROP_ONLINE] = g_param_spec_boolean(
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
992 "online", "online",
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
993 "Whether or not the conversation can send and receive messages.",
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
994 TRUE,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
995 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
996
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
997 /**
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
998 * PurpleConversation:federated:
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
999 *
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1000 * Whether or this conversation is federated.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1001 *
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1002 * 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
1003 * conversations.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1004 *
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1005 * 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
1006 * 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
1007 * 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
1008 * 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
1009 * case.
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1010 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1011 * Since: 3.0
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1012 */
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1013 properties[PROP_FEDERATED] = g_param_spec_boolean(
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1014 "federated", "federated",
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1015 "Whether or not this conversation is federated.",
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1016 FALSE,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1017 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
1018
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1019 /**
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1020 * PurpleConversation:tags:
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1021 *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1022 * [class@Tags] for the conversation.
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1023 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1024 * Since: 3.0
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1025 */
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1026 properties[PROP_TAGS] = g_param_spec_object(
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1027 "tags", "tags",
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1028 "The tags for the conversation.",
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1029 PURPLE_TYPE_TAGS,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1030 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1031
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1032 /**
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1033 * PurpleConversation:members:
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1034 *
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1035 * The members that are currently in this conversation.
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1036 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1037 * Since: 3.0
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1038 */
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1039 properties[PROP_MEMBERS] = g_param_spec_object(
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1040 "members", "members",
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1041 "The members that are currently in this conversation",
42891
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
1042 PURPLE_TYPE_CONVERSATION_MEMBERS,
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1043 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1044
42299
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1045 /**
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1046 * PurpleConversation:messages:
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1047 *
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1048 * 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
1049 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1050 * Since: 3.0
42299
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1051 */
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1052 properties[PROP_MESSAGES] = g_param_spec_object(
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1053 "messages", "messages",
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1054 "All of the messages in this conversation's history.",
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1055 G_TYPE_LIST_MODEL,
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1056 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1057
42848
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1058 /**
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1059 * PurpleConversation:needs-attention:
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1060 *
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1061 * Whether or not the conversation needs attention.
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1062 *
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1063 * 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
1064 * kicked from the room, or something else.
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1065 *
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1066 * Since: 3.0
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1067 */
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1068 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
1069 "needs-attention", NULL, NULL,
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1070 FALSE,
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1071 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1072
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1073 /**
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1074 * PurpleConversation:typing-state:
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1075 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1076 * 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
1077 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1078 * 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
1079 * 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
1080 * again before the timeout expires.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1081 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1082 * 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
1083 * 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
1084 * expires.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1085 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1086 * 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
1087 * 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
1088 * 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
1089 * 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
1090 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1091 * 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
1092 * [iface@ProtocolConversation] and
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1093 * [vfunc@ProtocolConversation.send_typing],
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1094 * [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
1095 * 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
1096 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1097 * Since: 3.0
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1098 */
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1099 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
1100 "typing-state", NULL, NULL,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1101 PURPLE_TYPE_TYPING_STATE,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1102 PURPLE_TYPING_STATE_NONE,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1103 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
1104
42908
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1105 /**
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1106 * PurpleConversation:logging:
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1107 *
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1108 * 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
1109 *
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1110 * Since: 3.0
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1111 */
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1112 properties[PROP_LOGGING] = g_param_spec_boolean(
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1113 "logging", NULL, NULL,
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1114 FALSE,
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1115 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1116
42916
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1117 /**
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1118 * PurpleConversation:drafting:
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1119 *
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1120 * 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
1121 *
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1122 * 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
1123 * [method@Conversation.write_message] as anything can call that which
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1124 * could break the accounting of this property.
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1125 *
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1126 * Since: 3.0
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1127 */
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1128 properties[PROP_DRAFTING] = g_param_spec_boolean(
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1129 "drafting", NULL, NULL,
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1130 FALSE,
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1131 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1132
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1133 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
1134
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1135 /**
42736
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1136 * PurpleConversation::present:
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1137 * @conversation: The instance.
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1138 *
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1139 * 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
1140 * 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
1141 *
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1142 * Since: 3.0
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1143 */
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1144 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
1145 "present",
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1146 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
1147 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
1148 NULL,
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1149 NULL,
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1150 NULL,
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1151 NULL,
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1152 G_TYPE_NONE,
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1153 0);
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1154 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1155
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1156 /******************************************************************************
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1157 * Public API
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1158 *****************************************************************************/
42669
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1159 gboolean
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1160 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
1161 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
1162
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1163 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
1164 }
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1165
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1166 gboolean
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1167 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
1168 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
1169
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1170 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
1171 }
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1172
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1173 gboolean
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1174 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
1175 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
1176
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1177 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
1178 }
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1179
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1180 gboolean
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1181 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
1182 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
1183
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1184 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
1185 }
6d41b29637ef Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents: 42656
diff changeset
1186
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1187 void
42736
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1188 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
1189 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
1190
630084f39cc5 Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents: 42735
diff changeset
1191 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
1192 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1193
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
1194 const char *
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
1195 purple_conversation_get_id(PurpleConversation *conversation) {
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
1196 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
1197
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1198 return conversation->id;
42272
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
1199 }
015257326ad4 Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42258
diff changeset
1200
42800
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1201 char *
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1202 purple_conversation_get_global_id(PurpleConversation *conversation) {
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1203 const char *account_id = NULL;
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1204
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1205 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
1206
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1207 account_id = purple_account_get_id(conversation->account);
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1208
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1209 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
1210 }
5c55680a1a6b Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents: 42778
diff changeset
1211
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
1212 PurpleConversationType
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
1213 purple_conversation_get_conversation_type(PurpleConversation *conversation) {
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
1214 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
1215 PURPLE_CONVERSATION_TYPE_UNSET);
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
1216
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1217 return conversation->type;
42316
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
1218 }
3985c3404f20 Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents: 42302
diff changeset
1219
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1220 PurpleAccount *
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1221 purple_conversation_get_account(PurpleConversation *conversation) {
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1222 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
1223
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1224 return conversation->account;
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1225 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1226
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1227 PurpleConnection *
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1228 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
1229 PurpleAccount *account;
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1230
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1231 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
1232
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1233 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
1234
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1235 if(account == NULL) {
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1236 return NULL;
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1237 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1238
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1239 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
1240 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1241
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1242 void
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1243 purple_conversation_set_title(PurpleConversation *conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1244 const char *title)
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1245 {
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1246 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
1247
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42760
diff changeset
1248 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
1249 GObject *obj = G_OBJECT(conversation);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1250
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1251 /* 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
1252 * 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
1253 * 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
1254 * 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
1255 * 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
1256 * additional API that skips that part.
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1257 */
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1258 g_object_freeze_notify(obj);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1259 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
1260 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
1261 purple_conversation_set_title_generated(conversation, FALSE);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1262 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
1263 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1264 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1265
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1266 const char *
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1267 purple_conversation_get_title(PurpleConversation *conversation) {
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1268 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
1269
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1270 return conversation->title;
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1271 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1272
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1273 void
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1274 purple_conversation_generate_title(PurpleConversation *conversation) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1275 PurpleAccount *account = NULL;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1276 PurpleContactInfo *account_info = NULL;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1277 GString *str = NULL;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1278 guint n_members = 0;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1279 gboolean first = TRUE;
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1280
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1281 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
1282
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1283 if(conversation->type != PURPLE_CONVERSATION_TYPE_DM &&
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1284 conversation->type != PURPLE_CONVERSATION_TYPE_GROUP_DM)
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1285 {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1286 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
1287 "DM conversation");
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1288
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1289 return;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1290 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1291
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1292 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
1293 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
1294
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1295 str = g_string_new("");
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1296
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1297 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
1298 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
1299 PurpleContactInfo *info = NULL;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1300 PurpleConversationMember *member = NULL;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1301 const char *name = NULL;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1302
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1303 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
1304 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
1305 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
1306 g_clear_object(&member);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1307
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1308 continue;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1309 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1310
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1311 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
1312 if(purple_strempty(name)) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1313 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
1314
42760
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1315 g_clear_object(&member);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1316
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1317 continue;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1318 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1319
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1320 if(!first) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1321 g_string_append_printf(str, ", %s", name);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1322 } else {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1323 g_string_append(str, name);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1324 first = FALSE;
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1325 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1326
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1327 g_clear_object(&member);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1328 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1329
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1330 /* 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
1331 if(!first) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1332 GObject *obj = G_OBJECT(conversation);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1333
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1334 g_object_freeze_notify(obj);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1335 purple_conversation_set_title(conversation, str->str);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1336 purple_conversation_set_title_generated(conversation, TRUE);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1337 g_object_thaw_notify(obj);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1338 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1339
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1340 g_string_free(str, TRUE);
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1341 }
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1342
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1343 gboolean
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1344 purple_conversation_get_title_generated(PurpleConversation *conversation) {
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1345 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
1346
0c293ecd56c2 Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents: 42756
diff changeset
1347 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
1348 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1349
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1350 void
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1351 purple_conversation_set_name(PurpleConversation *conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1352 const char *name)
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1353 {
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1354 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
1355
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42760
diff changeset
1356 if(g_set_str(&conversation->name, name)) {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1357 g_object_notify_by_pspec(G_OBJECT(conversation),
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1358 properties[PROP_NAME]);
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1359 }
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1360 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1361
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1362 const char *
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1363 purple_conversation_get_name(PurpleConversation *conversation) {
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1364 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
1365
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1366 return conversation->name;
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1367 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1368
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1369 void
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1370 purple_conversation_write_message(PurpleConversation *conversation,
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1371 PurpleMessage *message)
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1372 {
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1373 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
1374 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
1375
42908
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1376 if(conversation->logging) {
41090
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1377 GError *error = NULL;
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1378 PurpleHistoryManager *manager = NULL;
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1379 gboolean success = FALSE;
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1380
41090
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1381 manager = purple_history_manager_get_default();
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1382 /* 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
1383 * 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
1384 */
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1385 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
1386 &error);
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1387 if(!success){
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1388 purple_debug_info("conversation",
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1389 "history manager write returned error: %s",
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1390 error->message);
41090
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1391
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1392 g_clear_error(&error);
741992355ead GSoC History API including sqlite history adapter
James Culver <rewtguy@gmail.com>
parents: 41083
diff changeset
1393 }
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1394 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1395
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1396 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
1397 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1398
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1399 void
42743
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1400 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
1401 PurpleMessage *message,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1402 GCancellable *cancellable,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1403 GAsyncReadyCallback callback,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1404 gpointer data)
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1405 {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1406 PurpleAccount *account = NULL;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1407 PurpleProtocol *protocol = NULL;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1408 GTask *task = NULL;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1409
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1410 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
1411 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
1412
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1413 purple_conversation_set_typing_state(conversation,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1414 PURPLE_TYPING_STATE_NONE);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1415
42743
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1416 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
1417 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
1418 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
1419
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1420 account = purple_conversation_get_account(conversation);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1421 protocol = purple_account_get_protocol(account);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1422
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1423 if(!PURPLE_IS_PROTOCOL_CONVERSATION(protocol)) {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1424 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
1425 "protocol does not implement "
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1426 "PurpleProtocolConversation");
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1427
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1428 g_clear_object(&task);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1429
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1430 return;
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1431 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1432
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1433 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
1434 conversation,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1435 message,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1436 cancellable,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1437 purple_conversation_send_message_async_cb,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1438 task);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1439 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1440
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1441 gboolean
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1442 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
1443 GAsyncResult *result,
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1444 GError **error)
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1445 {
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1446 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
1447 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
1448
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1449 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
1450 purple_conversation_send_message_async, FALSE);
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1451
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1452 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
1453 }
bcc726c6c61a Add purple_conversation_send_message_async and _finish
Gary Kramlich <grim@reaperworld.com>
parents: 42740
diff changeset
1454
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1455 gboolean
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1456 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
1457 gboolean ret = FALSE;
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1458
42735
441ec6ccbd93 A bunch of random cleanups for PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42734
diff changeset
1459 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
40854
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1460
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1461 return ret;
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1462 }
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1463
f1b7c03f6cc7 Use G_DECLARE_DERIVABLE_TYPE for PurpleConversation and additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 40853
diff changeset
1464 gboolean
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1465 purple_conversation_get_age_restricted(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1466 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
1467
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1468 return conversation->age_restricted;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1469 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1470
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1471 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1472 purple_conversation_set_age_restricted(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1473 gboolean age_restricted)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1474 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1475 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
1476
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1477 if(conversation->age_restricted != age_restricted) {
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1478 conversation->age_restricted = age_restricted;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1479
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1480 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
1481 properties[PROP_AGE_RESTRICTED]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1482 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1483 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1484
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1485 const char *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1486 purple_conversation_get_description(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1487 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
1488
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1489 return conversation->description;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1490 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1491
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1492 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1493 purple_conversation_set_description(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1494 const char *description)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1495 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1496 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
1497
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42760
diff changeset
1498 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
1499 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
1500 properties[PROP_DESCRIPTION]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1501 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1502 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1503
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1504 const char *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1505 purple_conversation_get_topic(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1506 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
1507
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1508 return conversation->topic;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1509 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1510
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1511 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1512 purple_conversation_set_topic(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1513 const char *topic)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1514 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1515 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
1516
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42760
diff changeset
1517 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
1518 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
1519 properties[PROP_TOPIC]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1520 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1521 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1522
42302
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1523 void
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1524 purple_conversation_set_topic_full(PurpleConversation *conversation,
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1525 const char *topic,
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1526 PurpleContactInfo *author,
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1527 GDateTime *updated)
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1528 {
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1529 GObject *obj = NULL;
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1530
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1531 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1532
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1533 obj = G_OBJECT(conversation);
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1534 g_object_freeze_notify(obj);
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1535
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1536 purple_conversation_set_topic(conversation, topic);
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1537 purple_conversation_set_topic_author(conversation, author);
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1538 purple_conversation_set_topic_updated(conversation, updated);
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1539
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1540 g_object_thaw_notify(obj);
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1541 }
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1542
54e2bf5af34a Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents: 42299
diff changeset
1543
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1544 PurpleContactInfo *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1545 purple_conversation_get_topic_author(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1546 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
1547
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1548 return conversation->topic_author;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1549 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1550
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1551 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1552 purple_conversation_set_topic_author(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1553 PurpleContactInfo *author)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1554 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1555 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
1556
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1557 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
1558 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
1559 properties[PROP_TOPIC_AUTHOR]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1560 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1561 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1562
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1563 GDateTime *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1564 purple_conversation_get_topic_updated(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1565 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
1566
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1567 return conversation->topic_updated;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1568 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1569
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1570 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1571 purple_conversation_set_topic_updated(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1572 GDateTime *updated)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1573 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1574 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
1575
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1576 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
1577 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
1578 properties[PROP_TOPIC_UPDATED]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1579 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1580 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1581
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1582 const char *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1583 purple_conversation_get_user_nickname(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1584 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
1585
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1586 return conversation->user_nickname;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1587 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1588
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1589 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1590 purple_conversation_set_user_nickname(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1591 const char *nickname)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1592 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1593 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
1594
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42760
diff changeset
1595 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
1596 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
1597 properties[PROP_USER_NICKNAME]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1598 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1599 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1600
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1601 gboolean
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1602 purple_conversation_get_favorite(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1603 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
1604
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1605 return conversation->favorite;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1606 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1607
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1608 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1609 purple_conversation_set_favorite(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1610 gboolean favorite)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1611 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1612 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
1613
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1614 if(conversation->favorite != favorite) {
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1615 conversation->favorite = favorite;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1616
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1617 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
1618 properties[PROP_FAVORITE]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1619 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1620 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1621
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1622 GDateTime *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1623 purple_conversation_get_created_on(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1624 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
1625
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1626 return conversation->created_on;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1627 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1628
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1629 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1630 purple_conversation_set_created_on(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1631 GDateTime *created_on)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1632 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1633 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
1634
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1635 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
1636 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
1637 properties[PROP_CREATED_ON]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1638 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1639 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1640
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1641 PurpleContactInfo *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1642 purple_conversation_get_creator(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1643 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
1644
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1645 return conversation->creator;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1646 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1647
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1648 void
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1649 purple_conversation_set_creator(PurpleConversation *conversation,
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1650 PurpleContactInfo *creator)
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1651 {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1652 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
1653
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1654 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
1655 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
1656 properties[PROP_CREATOR]);
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1657 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1658 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1659
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1660 gboolean
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1661 purple_conversation_get_online(PurpleConversation *conversation) {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1662 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
1663
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1664 return conversation->online;
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1665 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1666
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1667 void
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1668 purple_conversation_set_online(PurpleConversation *conversation,
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1669 gboolean online)
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1670 {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1671 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
1672
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1673 if(conversation->online != online) {
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1674 conversation->online = online;
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1675
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1676 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
1677 properties[PROP_ONLINE]);
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1678 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1679 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1680
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1681 gboolean
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1682 purple_conversation_get_federated(PurpleConversation *conversation) {
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1683 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
1684
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1685 return conversation->federated;
42318
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1686 }
3b05e7088b61 Add online and federated properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42316
diff changeset
1687
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1688 PurpleTags *
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1689 purple_conversation_get_tags(PurpleConversation *conversation) {
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1690 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
1691
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1692 return conversation->tags;
42292
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1693 }
5bc9561e5f2b Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42275
diff changeset
1694
42891
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
1695 PurpleConversationMembers *
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1696 purple_conversation_get_members(PurpleConversation *conversation) {
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1697 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
1698
42891
7f8daf96e7d3 Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents: 42887
diff changeset
1699 return conversation->members;
42114
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1700 }
d3fe2b899c89 Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42070
diff changeset
1701
42299
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1702 GListModel *
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1703 purple_conversation_get_messages(PurpleConversation *conversation) {
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1704 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
1705
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1706 if(G_IS_LIST_MODEL(conversation->messages)) {
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1707 return G_LIST_MODEL(conversation->messages);
42299
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1708 }
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1709
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1710 return NULL;
2dce52f93848 Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
1711 }
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
1712
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
1713 PurpleAvatar *
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
1714 purple_conversation_get_avatar(PurpleConversation *conversation) {
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
1715 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
1716
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1717 return conversation->avatar;
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
1718 }
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
1719
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
1720 void
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
1721 purple_conversation_set_avatar(PurpleConversation *conversation,
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
1722 PurpleAvatar *avatar)
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
1723 {
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
1724 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
1725
42734
4e0eef85cd80 Make PurpleConversation final
Gary Kramlich <grim@reaperworld.com>
parents: 42732
diff changeset
1726 if(g_set_object(&conversation->avatar, avatar)) {
42355
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
1727 g_object_notify_by_pspec(G_OBJECT(conversation),
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
1728 properties[PROP_AVATAR]);
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
1729 }
6f7c6b84aaa0 Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42321
diff changeset
1730 }
42773
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1731
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1732 const char *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1733 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
1734 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
1735
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1736 if(!purple_strempty(conversation->alias)) {
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1737 return conversation->alias;
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1738 }
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1739
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1740 if(!purple_strempty(conversation->title)) {
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1741 return conversation->title;
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1742 }
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1743
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1744 return conversation->id;
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1745 }
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1746
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1747 const char *
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1748 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
1749 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
1750
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1751 return conversation->alias;
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1752 }
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1753
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1754 void
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1755 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
1756 const char *alias)
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1757 {
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1758 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
1759
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1760 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
1761 GObject *obj = G_OBJECT(conversation);
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1762
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1763 g_object_freeze_notify(obj);
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1764 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
1765 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
1766 g_object_thaw_notify(obj);
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1767 }
2718698a94b9 Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1768 }
42848
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1769
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1770 gboolean
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1771 purple_conversation_get_needs_attention(PurpleConversation *conversation) {
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1772 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
1773
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1774 return conversation->needs_attention;
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1775 }
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1776
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1777 void
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1778 purple_conversation_set_needs_attention(PurpleConversation *conversation,
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1779 gboolean needs_attention)
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1780 {
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1781 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
1782
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1783 if(conversation->needs_attention != needs_attention) {
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1784 conversation->needs_attention = needs_attention;
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1785
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1786 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
1787 properties[PROP_NEEDS_ATTENTION]);
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1788 }
f9a04b0bed1f Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42839
diff changeset
1789 }
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1790
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1791 PurpleTypingState
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1792 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
1793 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
1794 PURPLE_TYPING_STATE_NONE);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1795
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1796 return conversation->typing_state;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1797 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1798
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1799 void
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1800 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
1801 PurpleTypingState typing_state)
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1802 {
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
1803 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
1804
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1805 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
1806
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1807 /* 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
1808 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
1809
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1810 /* 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
1811 * TYPING, we use a 6 second timeout that will change the state to PAUSED.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1812 * When the state changes to PAUSED we will set a 30 second time that will
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1813 * change the state to NONE.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1814 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1815 * 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
1816 * typing, and the rest happens automatically.
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1817 */
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1818 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
1819 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
1820
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1821 conversation->typing_state_source =
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1822 g_timeout_add_seconds(6,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1823 purple_conversation_typing_state_typing_cb,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1824 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
1825
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
1826 /* Use local time because this is local to the user and we might want
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
1827 * 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
1828 * 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
1829 */
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
1830 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
1831 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
1832 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
1833
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
1834 difference = g_date_time_difference(now, conversation->last_typing);
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
1835
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
1836 if(difference > 3 * G_TIME_SPAN_SECOND) {
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
1837 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
1838 }
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
1839 }
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
1840
fc235710664e Only send typing notifications if we haven't sent on in 3 seconds
Gary Kramlich <grim@reaperworld.com>
parents: 42895
diff changeset
1841 conversation->last_typing = now;
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1842 } 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
1843 conversation->typing_state_source =
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1844 g_timeout_add_seconds(30,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1845 purple_conversation_typing_state_paused_cb,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1846 conversation);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1847 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1848
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1849 if(conversation->typing_state != typing_state) {
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1850 conversation->typing_state = typing_state;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1851
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1852 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
1853 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
1854
7d128a161cad Only send the typing notifications if it's changed or if it's TYPING
Gary Kramlich <grim@reaperworld.com>
parents: 42891
diff changeset
1855 /* 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
1856 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
1857 }
7d128a161cad Only send the typing notifications if it's changed or if it's TYPING
Gary Kramlich <grim@reaperworld.com>
parents: 42891
diff changeset
1858
42884
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1859 /* 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
1860 * 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
1861 *
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1862 * 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
1863 * 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
1864 */
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
1865 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
1866 PurpleProtocol *protocol = NULL;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1867
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1868 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
1869 if(PURPLE_IS_PROTOCOL_CONVERSATION(protocol)) {
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1870 PurpleProtocolConversation *protocol_conversation = NULL;
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1871
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1872 protocol_conversation = PURPLE_PROTOCOL_CONVERSATION(protocol);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1873
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1874 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
1875 {
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1876 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
1877 conversation,
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1878 conversation->typing_state);
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1879 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1880 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1881 }
5a7d425c9d1b Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42857
diff changeset
1882 }
42908
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1883
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1884 gboolean
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1885 purple_conversation_get_logging(PurpleConversation *conversation) {
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1886 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
1887
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1888 return conversation->logging;
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1889 }
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1890
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1891 void
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1892 purple_conversation_set_logging(PurpleConversation *conversation,
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1893 gboolean logging)
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1894 {
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1895 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
1896
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1897 if(conversation->logging != logging) {
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1898 conversation->logging = logging;
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1899
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1900 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
1901 properties[PROP_LOGGING]);
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1902 }
64bbb9d4bf94 Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents: 42902
diff changeset
1903 }
42916
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1904
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1905 gboolean
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1906 purple_conversation_get_drafting(PurpleConversation *conversation) {
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1907 g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE);
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1908
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1909 return conversation->drafting;
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1910 }
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1911
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1912 void
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1913 purple_conversation_set_drafting(PurpleConversation *conversation,
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1914 gboolean drafting)
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1915 {
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1916 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1917
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1918 if(conversation->drafting != drafting) {
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1919 conversation->drafting = drafting;
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1920
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1921 g_object_notify_by_pspec(G_OBJECT(conversation),
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1922 properties[PROP_DRAFTING]);
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1923 }
28a4480fe746 Add Purple.Conversation:drafting
Gary Kramlich <grim@reaperworld.com>
parents: 42908
diff changeset
1924 }

mercurial