libpurple/purpleconversation.c

Thu, 17 Oct 2024 23:57:22 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 17 Oct 2024 23:57:22 -0500
changeset 43017
09661a988eab
parent 42999
5a506dee26d2
child 43018
78cd7c6e8c40
permissions
-rw-r--r--

When writing a message make sure the author's typing state is set to none

This allows protocols to be lazy and not need to send a typing state of none
across the wire as well as not having to worry about it at all.

Testing Done:
Sending a message from senpai and verified the typing state changed when the message was written to the conversation.

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

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

mercurial