Sun, 10 Aug 2025 23:44:08 +0800
Add Purple.Conversation.find_message_by_id
The method was added so that a protocol or plugin could easily lookup
for the reference for a message. This will be especially useful when a
protocol received a quoted message but only with an id.
|
42323
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This library is free software; you can redistribute it and/or |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * modify it under the terms of the GNU Lesser General Public |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * License as published by the Free Software Foundation; either |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * version 2 of the License, or (at your option) any later version. |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This library is distributed in the hope that it will be useful, |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * Lesser General Public License for more details. |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU Lesser General Public |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * License along with this library; if not, see <https://www.gnu.org/licenses/>. |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | */ |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | #include <glib/gi18n-lib.h> |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | #include "purpledemoprotocolconversation.h" |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
42675
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
23 | #include "purpledemoplugin.h" |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
24 | #include "purpledemoprotocol.h" |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
25 | |
|
42323
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | typedef struct { |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | PurpleConversation *conversation; |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | PurpleMessage *message; |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | } PurpleDemoProtocolIMInfo; |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | |
|
42675
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
31 | /****************************************************************************** |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
32 | * Helpers |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
33 | *****************************************************************************/ |
|
42323
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | static void |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | purple_demo_protocol_im_info_free(PurpleDemoProtocolIMInfo *info) { |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | g_clear_object(&info->conversation); |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | g_clear_object(&info->message); |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | g_free(info); |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | } |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | |
|
42675
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
41 | static gint |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
42 | purple_demo_protocol_contact_sort(gconstpointer a, gconstpointer b, |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
43 | G_GNUC_UNUSED gpointer data) |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
44 | { |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
45 | return purple_contact_info_compare(PURPLE_CONTACT_INFO((gpointer)a), |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
46 | PURPLE_CONTACT_INFO((gpointer)b)); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
47 | } |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
48 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
49 | static char * |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
50 | purple_demo_protocol_generate_conversation_id(PurpleAccount *account, |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
51 | PurpleCreateConversationDetails *details) |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
52 | { |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
53 | GChecksum *checksum = NULL; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
54 | GListModel *participants = NULL; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
55 | GListStore *sorted = NULL; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
56 | char *ret = NULL; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
57 | const char *id = NULL; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
58 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
59 | /* Sort the participants. */ |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
60 | sorted = g_list_store_new(PURPLE_TYPE_CONTACT); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
61 | participants = purple_create_conversation_details_get_participants(details); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
62 | for(guint i = 0; i < g_list_model_get_n_items(participants); i++) { |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
63 | PurpleContactInfo *info = NULL; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
64 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
65 | info = g_list_model_get_item(participants, i); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
66 | g_list_store_insert_sorted(sorted, info, |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
67 | purple_demo_protocol_contact_sort, |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
68 | NULL); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
69 | g_clear_object(&info); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
70 | } |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
71 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
72 | /* Build a checksum of the account and the sorted participants. */ |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
73 | checksum = g_checksum_new(G_CHECKSUM_SHA256); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
74 | |
|
42803
984f8dfabb47
Update the protocols to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42738
diff
changeset
|
75 | id = purple_account_get_id(account); |
|
42675
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
76 | g_checksum_update(checksum, (guchar *)id, -1); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
77 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
78 | for(guint i = 0; i < g_list_model_get_n_items(G_LIST_MODEL(sorted)); i++) { |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
79 | PurpleContactInfo *info = NULL; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
80 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
81 | info = g_list_model_get_item(G_LIST_MODEL(sorted), i); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
82 | id = purple_contact_info_get_id(info); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
83 | g_checksum_update(checksum, (guchar *)id, -1); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
84 | g_clear_object(&info); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
85 | } |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
86 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
87 | ret = g_strdup(g_checksum_get_string(checksum)); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
88 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
89 | g_clear_pointer(&checksum, g_checksum_free); |
|
42888
ed22ea598bec
Fix a couple of memory leaks in the demo plugin
Markus Fischer <ivanhoe@fiscari.de>
parents:
42826
diff
changeset
|
90 | g_clear_object(&sorted); |
|
42675
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
91 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
92 | return ret; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
93 | } |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
94 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
95 | /****************************************************************************** |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
96 | * Callbacks |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
97 | *****************************************************************************/ |
|
42323
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | static gboolean |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | purple_demo_protocol_echo_im_cb(gpointer data) { |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | PurpleDemoProtocolIMInfo *info = data; |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | |
|
42738
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
102 | purple_conversation_write_message(info->conversation, info->message); |
|
42323
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | return G_SOURCE_REMOVE; |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | } |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | |
|
42675
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
107 | /****************************************************************************** |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
108 | * PurpleProtocolConversation Implementation |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
109 | *****************************************************************************/ |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
110 | static PurpleCreateConversationDetails * |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
111 | purple_demo_protocol_get_create_conversation_details(G_GNUC_UNUSED PurpleProtocolConversation *protocol, |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
112 | G_GNUC_UNUSED PurpleAccount *account) |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
113 | { |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
114 | return purple_create_conversation_details_new(9); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
115 | } |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
116 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
117 | static void |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
118 | purple_demo_protocol_create_conversation_async(PurpleProtocolConversation *protocol, |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
119 | PurpleAccount *account, |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
120 | PurpleCreateConversationDetails *details, |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
121 | GCancellable *cancellable, |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
122 | GAsyncReadyCallback callback, |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
123 | gpointer data) |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
124 | { |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
125 | PurpleConversation *conversation = NULL; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
126 | PurpleConversationManager *manager = NULL; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
127 | PurpleConversationType type = PURPLE_CONVERSATION_TYPE_UNSET; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
128 | GListModel *participants = NULL; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
129 | GTask *task = NULL; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
130 | char *id = NULL; |
|
43162
b6b96199a068
Demo: when creating a conversation make sure we have participants
Gary Kramlich <grim@reaperworld.com>
parents:
43149
diff
changeset
|
131 | guint n_participants = 0; |
|
42675
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
132 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
133 | task = g_task_new(protocol, cancellable, callback, data); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
134 | g_task_set_source_tag(task, |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
135 | purple_demo_protocol_create_conversation_async); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
136 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
137 | participants = purple_create_conversation_details_get_participants(details); |
|
43162
b6b96199a068
Demo: when creating a conversation make sure we have participants
Gary Kramlich <grim@reaperworld.com>
parents:
43149
diff
changeset
|
138 | n_participants = g_list_model_get_n_items(participants); |
|
b6b96199a068
Demo: when creating a conversation make sure we have participants
Gary Kramlich <grim@reaperworld.com>
parents:
43149
diff
changeset
|
139 | if(n_participants == 0) { |
|
b6b96199a068
Demo: when creating a conversation make sure we have participants
Gary Kramlich <grim@reaperworld.com>
parents:
43149
diff
changeset
|
140 | g_task_return_new_error_literal(task, PURPLE_DEMO_DOMAIN, 0, |
|
b6b96199a068
Demo: when creating a conversation make sure we have participants
Gary Kramlich <grim@reaperworld.com>
parents:
43149
diff
changeset
|
141 | _("no participants were provided")); |
|
b6b96199a068
Demo: when creating a conversation make sure we have participants
Gary Kramlich <grim@reaperworld.com>
parents:
43149
diff
changeset
|
142 | g_clear_object(&task); |
|
b6b96199a068
Demo: when creating a conversation make sure we have participants
Gary Kramlich <grim@reaperworld.com>
parents:
43149
diff
changeset
|
143 | |
|
b6b96199a068
Demo: when creating a conversation make sure we have participants
Gary Kramlich <grim@reaperworld.com>
parents:
43149
diff
changeset
|
144 | return; |
|
b6b96199a068
Demo: when creating a conversation make sure we have participants
Gary Kramlich <grim@reaperworld.com>
parents:
43149
diff
changeset
|
145 | } |
|
b6b96199a068
Demo: when creating a conversation make sure we have participants
Gary Kramlich <grim@reaperworld.com>
parents:
43149
diff
changeset
|
146 | |
|
b6b96199a068
Demo: when creating a conversation make sure we have participants
Gary Kramlich <grim@reaperworld.com>
parents:
43149
diff
changeset
|
147 | if(n_participants == 1) { |
|
42675
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
148 | type = PURPLE_CONVERSATION_TYPE_DM; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
149 | } else { |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
150 | type = PURPLE_CONVERSATION_TYPE_GROUP_DM; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
151 | } |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
152 | id = purple_demo_protocol_generate_conversation_id(account, details); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
153 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
154 | conversation = g_object_new( |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
155 | PURPLE_TYPE_CONVERSATION, |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
156 | "account", account, |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
157 | "id", id, |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
158 | "type", type, |
|
43178
c1ee3a2f783e
Update the IRCv3 and Demo protocol plugins to default conversations to online
Gary Kramlich <grim@reaperworld.com>
parents:
43162
diff
changeset
|
159 | "online", TRUE, |
|
42675
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
160 | NULL); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
161 | g_clear_pointer(&id, g_free); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
162 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
163 | for(guint i = 0; i < g_list_model_get_n_items(participants); i++) { |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
164 | PurpleContactInfo *info = NULL; |
|
43078
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
165 | PurpleConversationMember *member = NULL; |
|
42892
ca6c19529734
Port the Demo protocol plugin to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42888
diff
changeset
|
166 | PurpleConversationMembers *members = NULL; |
|
43078
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
167 | PurpleTags *tags = NULL; |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
168 | const char *badge_id = NULL; |
|
42675
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
169 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
170 | info = g_list_model_get_item(participants, i); |
|
42892
ca6c19529734
Port the Demo protocol plugin to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42888
diff
changeset
|
171 | members = purple_conversation_get_members(conversation); |
|
43078
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
172 | member = purple_conversation_members_add_member(members, info, FALSE, |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
173 | NULL); |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
174 | |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
175 | tags = purple_contact_info_get_tags(info); |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
176 | badge_id = purple_tags_get(tags, "demo-badge"); |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
177 | if(!purple_strempty(badge_id)) { |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
178 | PurpleBadge *badge = NULL; |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
179 | PurpleBadgeManager *manager = NULL; |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
180 | PurpleBadges *badges = NULL; |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
181 | |
|
43149
7e425e201771
Fix some broken stuff with badges in demo and ircv3
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
182 | badges = purple_conversation_member_get_badges(member); |
|
7e425e201771
Fix some broken stuff with badges in demo and ircv3
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
183 | |
|
43078
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
184 | manager = purple_badge_manager_get_default(); |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
185 | badge = purple_badge_manager_find(manager, badge_id); |
|
43149
7e425e201771
Fix some broken stuff with badges in demo and ircv3
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
186 | if(PURPLE_IS_BADGE(badge)) { |
|
7e425e201771
Fix some broken stuff with badges in demo and ircv3
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
187 | purple_badges_add_badge(badges, badge); |
|
7e425e201771
Fix some broken stuff with badges in demo and ircv3
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
188 | } else { |
|
43078
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
189 | char *icon_name = NULL; |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
190 | char *id = NULL; |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
191 | |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
192 | id = g_strdup_printf("demo-badge-%s", badge_id); |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
193 | icon_name = g_strdup_printf("demo-badge-%s", badge_id); |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
194 | badge = purple_badge_new(id, 0, icon_name, " "); |
|
43184
d01d9aeec436
Add simple tool tips to badges.
Gary Kramlich <grim@reaperworld.com>
parents:
43178
diff
changeset
|
195 | purple_badge_set_description(badge, badge_id); |
|
43078
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
196 | g_free(id); |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
197 | g_free(icon_name); |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
198 | |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
199 | purple_badge_manager_add(manager, badge); |
|
43149
7e425e201771
Fix some broken stuff with badges in demo and ircv3
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
200 | purple_badges_add_badge(badges, badge); |
|
7e425e201771
Fix some broken stuff with badges in demo and ircv3
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
201 | g_clear_object(&badge); |
|
43078
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
202 | } |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
203 | } |
|
d6d76c53fc95
Add badges to the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
43066
diff
changeset
|
204 | |
|
42675
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
205 | g_clear_object(&info); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
206 | } |
|
42888
ed22ea598bec
Fix a couple of memory leaks in the demo plugin
Markus Fischer <ivanhoe@fiscari.de>
parents:
42826
diff
changeset
|
207 | g_clear_object(&details); |
|
42675
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
208 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
209 | manager = purple_conversation_manager_get_default(); |
|
43030
97ed7473351f
Update the protocols for the ConversationManager deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
42924
diff
changeset
|
210 | if(!purple_conversation_manager_add(manager, conversation)) { |
|
42675
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
211 | g_task_return_new_error(task, PURPLE_DEMO_DOMAIN, 0, |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
212 | _("This conversation already exists.")); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
213 | g_clear_object(&task); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
214 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
215 | return; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
216 | } |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
217 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
218 | g_task_return_pointer(task, conversation, g_object_unref); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
219 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
220 | g_clear_object(&task); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
221 | } |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
222 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
223 | static PurpleConversation * |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
224 | purple_demo_protocol_create_conversation_finish(G_GNUC_UNUSED PurpleProtocolConversation *protocol, |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
225 | GAsyncResult *result, |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
226 | GError **error) |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
227 | { |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
228 | GTask *task = G_TASK(result); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
229 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
230 | g_return_val_if_fail(g_task_get_source_tag(task) == |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
231 | purple_demo_protocol_create_conversation_async, |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
232 | NULL); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
233 | |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
234 | return g_task_propagate_pointer(task, error); |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
235 | } |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
236 | |
|
42323
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | static void |
|
42924
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
238 | purple_demo_protocol_conversation_leave_conversation_async(PurpleProtocolConversation *protocol, |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
239 | G_GNUC_UNUSED PurpleConversation *conversation, |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
240 | GCancellable *cancellable, |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
241 | GAsyncReadyCallback callback, |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
242 | gpointer data) |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
243 | { |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
244 | GTask *task = NULL; |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
245 | |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
246 | task = g_task_new(protocol, cancellable, callback, data); |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
247 | g_task_set_source_tag(task, |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
248 | purple_demo_protocol_conversation_leave_conversation_async); |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
249 | |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
250 | g_task_return_boolean(task, TRUE); |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
251 | g_clear_object(&task); |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
252 | } |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
253 | |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
254 | static gboolean |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
255 | purple_demo_protocol_conversation_leave_conversation_finish(G_GNUC_UNUSED PurpleProtocolConversation *protocol, |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
256 | GAsyncResult *result, |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
257 | GError **error) |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
258 | { |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
259 | gpointer tag = purple_demo_protocol_conversation_leave_conversation_async; |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
260 | |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
261 | g_return_val_if_fail(g_async_result_is_tagged(result, tag), FALSE); |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
262 | |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
263 | return g_task_propagate_boolean(G_TASK(result), error); |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
264 | } |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
265 | |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
266 | static void |
|
42323
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | purple_demo_protocol_send_message_async(G_GNUC_UNUSED PurpleProtocolConversation *protocol, |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | PurpleConversation *conversation, |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
269 | PurpleMessage *message, |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | GCancellable *cancellable, |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
271 | GAsyncReadyCallback callback, |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
272 | gpointer data) |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
273 | { |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
274 | GTask *task = NULL; |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
275 | |
|
42738
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
276 | if(purple_conversation_is_dm(conversation)) { |
|
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
277 | PurpleAccount *account = NULL; |
|
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
278 | PurpleContact *contact = NULL; |
|
42906
e0d5b79e7431
Fix some issues with Purple.Message in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42892
diff
changeset
|
279 | PurpleContactInfo *contact_info = NULL; |
|
42738
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
280 | PurpleContactManager *manager = NULL; |
|
43100
e6df74d36862
Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents:
43078
diff
changeset
|
281 | PurpleConversationMember *member = NULL; |
|
42892
ca6c19529734
Port the Demo protocol plugin to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42888
diff
changeset
|
282 | PurpleConversationMembers *members = NULL; |
|
42323
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
283 | |
|
42738
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
284 | account = purple_conversation_get_account(conversation); |
|
42892
ca6c19529734
Port the Demo protocol plugin to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42888
diff
changeset
|
285 | members = purple_conversation_get_members(conversation); |
|
42323
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
286 | |
|
42738
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
287 | manager = purple_contact_manager_get_default(); |
|
42323
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
288 | |
|
42738
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
289 | /* Check if this dm is with echo. */ |
|
42906
e0d5b79e7431
Fix some issues with Purple.Message in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42892
diff
changeset
|
290 | contact = purple_contact_manager_find_with_id(manager, account, |
|
e0d5b79e7431
Fix some issues with Purple.Message in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42892
diff
changeset
|
291 | "echo"); |
|
e0d5b79e7431
Fix some issues with Purple.Message in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42892
diff
changeset
|
292 | contact_info = PURPLE_CONTACT_INFO(contact); |
|
43100
e6df74d36862
Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents:
43078
diff
changeset
|
293 | member = purple_conversation_members_find_member(members, contact_info); |
|
e6df74d36862
Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents:
43078
diff
changeset
|
294 | if(PURPLE_IS_CONVERSATION_MEMBER(member)) { |
|
42738
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
295 | PurpleDemoProtocolIMInfo *info = NULL; |
|
42906
e0d5b79e7431
Fix some issues with Purple.Message in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42892
diff
changeset
|
296 | const char *contents = purple_message_get_contents(message); |
|
42598
5e42cba3e8ad
Add an offline contact in the Demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42323
diff
changeset
|
297 | |
|
42738
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
298 | info = g_new(PurpleDemoProtocolIMInfo, 1); |
|
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
299 | info->conversation = g_object_ref(conversation); |
|
43100
e6df74d36862
Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents:
43078
diff
changeset
|
300 | info->message = purple_message_new(member, contents); |
|
43066
850400fb36c0
Add an edited command to the demo protocol
Gary Kramlich <grim@reaperworld.com>
parents:
43030
diff
changeset
|
301 | purple_message_set_edited(info->message, |
|
850400fb36c0
Add an edited command to the demo protocol
Gary Kramlich <grim@reaperworld.com>
parents:
43030
diff
changeset
|
302 | purple_message_get_edited(message)); |
|
42738
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
303 | |
|
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
304 | g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, |
|
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
305 | purple_demo_protocol_echo_im_cb, info, |
|
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
306 | (GDestroyNotify)purple_demo_protocol_im_info_free); |
|
42598
5e42cba3e8ad
Add an offline contact in the Demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42323
diff
changeset
|
307 | } |
|
5e42cba3e8ad
Add an offline contact in the Demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42323
diff
changeset
|
308 | |
|
42738
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
309 | /* Check if this dm is with aegina. */ |
|
42906
e0d5b79e7431
Fix some issues with Purple.Message in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42892
diff
changeset
|
310 | contact = purple_contact_manager_find_with_id(manager, account, |
|
e0d5b79e7431
Fix some issues with Purple.Message in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42892
diff
changeset
|
311 | "aegina"); |
|
e0d5b79e7431
Fix some issues with Purple.Message in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42892
diff
changeset
|
312 | contact_info = PURPLE_CONTACT_INFO(contact); |
|
43100
e6df74d36862
Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents:
43078
diff
changeset
|
313 | member = purple_conversation_members_find_member(members, contact_info); |
|
e6df74d36862
Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents:
43078
diff
changeset
|
314 | if(PURPLE_IS_CONVERSATION_MEMBER(member)) { |
|
42738
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
315 | PurpleDemoProtocolIMInfo *info = g_new(PurpleDemoProtocolIMInfo, 1); |
|
43100
e6df74d36862
Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents:
43078
diff
changeset
|
316 | PurpleConversationMember *author = purple_message_get_author(message); |
|
e6df74d36862
Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents:
43078
diff
changeset
|
317 | PurpleContactInfo *author_info = NULL; |
|
42738
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
318 | const char *contents = NULL; |
|
42906
e0d5b79e7431
Fix some issues with Purple.Message in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42892
diff
changeset
|
319 | const char *author_id = NULL; |
|
42598
5e42cba3e8ad
Add an offline contact in the Demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42323
diff
changeset
|
320 | |
|
43100
e6df74d36862
Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents:
43078
diff
changeset
|
321 | author_info = purple_conversation_member_get_contact_info(author); |
|
e6df74d36862
Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents:
43078
diff
changeset
|
322 | author_id = purple_contact_info_get_id(author_info); |
|
42906
e0d5b79e7431
Fix some issues with Purple.Message in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42892
diff
changeset
|
323 | if(purple_strequal(author_id, "hades")) { |
|
42738
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
324 | contents = "🫥️"; |
|
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
325 | } else { |
|
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
326 | /* TRANSLATORS: This is a reference to the Cap of Invisibility owned by |
|
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
327 | * various Greek gods, such as Hades, as mentioned. */ |
|
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
328 | contents = _("Don't tell Hades I have his Cap"); |
|
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
329 | } |
|
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
330 | |
|
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
331 | info->conversation = g_object_ref(conversation); |
|
43100
e6df74d36862
Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents:
43078
diff
changeset
|
332 | info->message = purple_message_new(member, contents); |
|
42738
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
333 | |
|
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
334 | g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, purple_demo_protocol_echo_im_cb, |
|
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
335 | info, (GDestroyNotify)purple_demo_protocol_im_info_free); |
|
f755b10c05a3
Update the demo protocol plugin to not depend on conversation names
Gary Kramlich <grim@reaperworld.com>
parents:
42675
diff
changeset
|
336 | } |
|
42323
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
337 | } |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
338 | |
|
43307
d8fa7059d11b
Mark messages sent in the demo protocol as delivered
Gary Kramlich <grim@reaperworld.com>
parents:
43184
diff
changeset
|
339 | purple_message_set_delivered(message, TRUE); |
|
42323
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
340 | purple_conversation_write_message(conversation, message); |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
341 | |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
342 | task = g_task_new(protocol, cancellable, callback, data); |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
343 | g_task_return_boolean(task, TRUE); |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
344 | |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
345 | g_clear_object(&task); |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
346 | } |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
347 | |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
348 | static gboolean |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
349 | purple_demo_protocol_send_message_finish(G_GNUC_UNUSED PurpleProtocolConversation *protocol, |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
350 | GAsyncResult *result, |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
351 | GError **error) |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
352 | { |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
353 | g_return_val_if_fail(G_IS_TASK(result), FALSE); |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
354 | |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
355 | return g_task_propagate_boolean(G_TASK(result), error); |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
356 | } |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
357 | |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
358 | void |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
359 | purple_demo_protocol_conversation_init(PurpleProtocolConversationInterface *iface) { |
|
42675
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
360 | iface->get_create_conversation_details = |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
361 | purple_demo_protocol_get_create_conversation_details; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
362 | iface->create_conversation_async = |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
363 | purple_demo_protocol_create_conversation_async; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
364 | iface->create_conversation_finish = |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
365 | purple_demo_protocol_create_conversation_finish; |
|
69e078981440
Implement conversation create for the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
366 | |
|
42924
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
367 | iface->leave_conversation_async = |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
368 | purple_demo_protocol_conversation_leave_conversation_async; |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
369 | iface->leave_conversation_finish = |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
370 | purple_demo_protocol_conversation_leave_conversation_finish; |
|
8091ed36e8b0
Implement Purple.ProtocolConversation.leave_async and .leave_finish in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42906
diff
changeset
|
371 | |
|
42323
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
372 | iface->send_message_async = purple_demo_protocol_send_message_async; |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
373 | iface->send_message_finish = purple_demo_protocol_send_message_finish; |
|
119cc14f9c12
Port the Demo protocol plugin to PurpleProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
374 | } |