libpurple/server.c

Sat, 13 Apr 2024 19:06:12 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Sat, 13 Apr 2024 19:06:12 -0500
changeset 42708
36610b5bd662
parent 42706
6039c89f2f5c
child 42715
f886f74847b0
permissions
-rw-r--r--

Remove PurpleChatConversation

This has been replaced by the generic PurpleConversation and nothing uses it
anymore.

Testing Done:
Ran with the turtles with the diff from r/3105 on top of this.

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

1
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
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
2 * Purple - Internet Messaging Library
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
1
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15808
diff changeset
5 * Purple is the legal property of its developers, whose names are too numerous
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
6 * to list here. Please refer to the COPYRIGHT file distributed with this
8046
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 7956
diff changeset
7 * source distribution.
1
efe077a7e70d [gaim-migrate @ 10]
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.
1
efe077a7e70d [gaim-migrate @ 10]
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.
1
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 *
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
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/>.
1
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21 */
16795
bc4a4f0b81dd Documentation update
Sean Egan <seanegan@pidgin.im>
parents: 16490
diff changeset
22
bc4a4f0b81dd Documentation update
Sean Egan <seanegan@pidgin.im>
parents: 16490
diff changeset
23 /* This file is the fullcrap */
bc4a4f0b81dd Documentation update
Sean Egan <seanegan@pidgin.im>
parents: 16490
diff changeset
24
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
25 #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
26
34706
02cb08146888 Renamed blist.[ch] to buddylist.[ch]
Ankit Vani <a@nevitus.org>
parents: 34670
diff changeset
27 #include "buddylist.h"
42557
e868bfcc092a Only include headers when they're necessary for header files
Gary Kramlich <grim@reaperworld.com>
parents: 42306
diff changeset
28 #include "conversations.h"
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
29 #include "debug.h"
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
30 #include "notify.h"
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
31 #include "prefs.h"
40853
d3518ff99fa7 rename conversation.[ch] to purpleconversation.[ch] and split PurpleConversationUiOps out to its own file to avoid circular include issues.
Gary Kramlich <grim@reaperworld.com>
parents: 40804
diff changeset
32 #include "purpleconversation.h"
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
33 #include "purpleconversationmanager.h"
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40079
diff changeset
34 #include "purpleprivate.h"
41155
922c9e70900c Rename protocol.[ch] to purpleprotocol.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
35 #include "purpleprotocol.h"
40697
81f81f5d2f39 Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents: 40579
diff changeset
36 #include "purpleprotocolchat.h"
40507
77d7bc9e5151 Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
37 #include "purpleprotocolim.h"
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40697
diff changeset
38 #include "purpleprotocolserver.h"
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
39 #include "request.h"
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6479
diff changeset
40 #include "signals.h"
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
41 #include "server.h"
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
42 #include "util.h"
1
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
43
13844
835b8f7b3d1d [gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents: 13791
diff changeset
44 unsigned int
35499
c4c5e0a670b1 Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents: 35265
diff changeset
45 purple_serv_send_typing(PurpleConnection *gc, const char *name, PurpleIMTypingState state)
13844
835b8f7b3d1d [gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents: 13791
diff changeset
46 {
40507
77d7bc9e5151 Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
47 if(gc) {
77d7bc9e5151 Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
48 PurpleProtocol *protocol = purple_connection_get_protocol(gc);
77d7bc9e5151 Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
49 PurpleProtocolIM *im = PURPLE_PROTOCOL_IM(protocol);
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5170
diff changeset
50
40507
77d7bc9e5151 Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
51 return purple_protocol_im_send_typing(im, gc, name, state);
28578
74b2a6dba113 Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents: 28577
diff changeset
52 }
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5170
diff changeset
53
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5170
diff changeset
54 return 0;
2993
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
55 }
1
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
56
36076
a0e5b68ff4ef Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35501
diff changeset
57 int purple_serv_send_im(PurpleConnection *gc, PurpleMessage *msg)
1
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
58 {
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
59 PurpleAccount *account = NULL;
40885
87f6241da196 Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents: 40870
diff changeset
60 PurpleConversation *im = NULL;
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
61 PurpleConversationManager *manager = NULL;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
62 PurpleProtocol *protocol = NULL;
2123
4cfdde0aa3f1 [gaim-migrate @ 2133]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 2108
diff changeset
63 int val = -EINVAL;
36098
4951752ad038 Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36089
diff changeset
64 const gchar *recipient;
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5170
diff changeset
65
13422
0221ca926ebe [gaim-migrate @ 15796]
Richard Laager <rlaager@pidgin.im>
parents: 13418
diff changeset
66 g_return_val_if_fail(gc != NULL, val);
36076
a0e5b68ff4ef Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35501
diff changeset
67 g_return_val_if_fail(msg != NULL, val);
13422
0221ca926ebe [gaim-migrate @ 15796]
Richard Laager <rlaager@pidgin.im>
parents: 13418
diff changeset
68
36623
caaadef03507 Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents: 36606
diff changeset
69 protocol = purple_connection_get_protocol(gc);
22390
d22357d5c7ba Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21175
diff changeset
70
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
71 g_return_val_if_fail(protocol != NULL, val);
39761
59c4ebe9ef67 Rename PURPLE_PROTOCOL_IS_* to PURPLE_IS_PROTOCOL_*.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
72 g_return_val_if_fail(PURPLE_IS_PROTOCOL_IM(protocol), val);
4359
cf899ee07d1d [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
73
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15808
diff changeset
74 account = purple_connection_get_account(gc);
36098
4951752ad038 Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36089
diff changeset
75 recipient = purple_message_get_recipient(msg);
4359
cf899ee07d1d [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
76
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
77 manager = purple_conversation_manager_get_default();
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
78 im = purple_conversation_manager_find_im(manager, account, recipient);
4359
cf899ee07d1d [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
79
40507
77d7bc9e5151 Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
80 /* we probably shouldn't be here if the protocol doesn't know how to send
77d7bc9e5151 Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
81 * im's... but there was a similar check here before so I just reproduced
77d7bc9e5151 Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
82 * it until we can reevaluate this function.
77d7bc9e5151 Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
83 */
77d7bc9e5151 Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
84 if(PURPLE_IS_PROTOCOL_IM(protocol)) {
77d7bc9e5151 Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
85 PurpleProtocolIM *pim = PURPLE_PROTOCOL_IM(protocol);
77d7bc9e5151 Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
86
42305
a3895b6d3621 Add the conversation as a parameter to PurpleProtocolIM->send
Gary Kramlich <grim@reaperworld.com>
parents: 42298
diff changeset
87 val = purple_protocol_im_send(pim, gc, im, msg);
40507
77d7bc9e5151 Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
88 }
94
0c6ba3d3fa90 [gaim-migrate @ 104]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 79
diff changeset
89
40885
87f6241da196 Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents: 40870
diff changeset
90 if(im && purple_im_conversation_get_send_typed_timeout(PURPLE_IM_CONVERSATION(im)))
87f6241da196 Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents: 40870
diff changeset
91 purple_im_conversation_stop_send_typed_timeout(PURPLE_IM_CONVERSATION(im));
3601
dce8ae5ad0bb [gaim-migrate @ 3703]
Nathan Walp <nwalp@pidgin.im>
parents: 3572
diff changeset
92
2123
4cfdde0aa3f1 [gaim-migrate @ 2133]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 2108
diff changeset
93 return val;
1
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
94 }
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
95
3136
8d988a6d2f4c [gaim-migrate @ 3151]
Rob Flynn <gaim@robflynn.com>
parents: 3124
diff changeset
96 /*
8d988a6d2f4c [gaim-migrate @ 3151]
Rob Flynn <gaim@robflynn.com>
parents: 3124
diff changeset
97 * Move a buddy from one group to another on server.
8d988a6d2f4c [gaim-migrate @ 3151]
Rob Flynn <gaim@robflynn.com>
parents: 3124
diff changeset
98 *
8d988a6d2f4c [gaim-migrate @ 3151]
Rob Flynn <gaim@robflynn.com>
parents: 3124
diff changeset
99 * Note: For now we'll not deal with changing gc's at the same time, but
9285
9cedf5d26577 [gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents: 9237
diff changeset
100 * it should be possible. Probably needs to be done, someday. Although,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15808
diff changeset
101 * the UI for that would be difficult, because groups are Purple-wide.
3136
8d988a6d2f4c [gaim-migrate @ 3151]
Rob Flynn <gaim@robflynn.com>
parents: 3124
diff changeset
102 */
37162
3336df05de5b Add introspection gtkdocs for server.h
Jorge Villaseñor <salinasv@pidgin.im>
parents: 37153
diff changeset
103 void purple_serv_move_buddy(PurpleBuddy *buddy, PurpleGroup *orig, PurpleGroup *dest)
3136
8d988a6d2f4c [gaim-migrate @ 3151]
Rob Flynn <gaim@robflynn.com>
parents: 3124
diff changeset
104 {
28578
74b2a6dba113 Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents: 28577
diff changeset
105 PurpleAccount *account;
74b2a6dba113 Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents: 28577
diff changeset
106 PurpleConnection *gc;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
107 PurpleProtocol *protocol;
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5170
diff changeset
108
37162
3336df05de5b Add introspection gtkdocs for server.h
Jorge Villaseñor <salinasv@pidgin.im>
parents: 37153
diff changeset
109 g_return_if_fail(buddy != NULL);
3336df05de5b Add introspection gtkdocs for server.h
Jorge Villaseñor <salinasv@pidgin.im>
parents: 37153
diff changeset
110 g_return_if_fail(orig != NULL);
3336df05de5b Add introspection gtkdocs for server.h
Jorge Villaseñor <salinasv@pidgin.im>
parents: 37153
diff changeset
111 g_return_if_fail(dest != NULL);
13418
676c3eb505dc [gaim-migrate @ 15792]
Richard Laager <rlaager@pidgin.im>
parents: 13294
diff changeset
112
37162
3336df05de5b Add introspection gtkdocs for server.h
Jorge Villaseñor <salinasv@pidgin.im>
parents: 37153
diff changeset
113 account = purple_buddy_get_account(buddy);
22390
d22357d5c7ba Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21175
diff changeset
114 gc = purple_account_get_connection(account);
d22357d5c7ba Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21175
diff changeset
115
28578
74b2a6dba113 Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents: 28577
diff changeset
116 if (gc) {
36623
caaadef03507 Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents: 36606
diff changeset
117 protocol = purple_connection_get_protocol(gc);
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40697
diff changeset
118 purple_protocol_server_group_buddy(PURPLE_PROTOCOL_SERVER(protocol),
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40697
diff changeset
119 gc, purple_buddy_get_name(buddy),
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40697
diff changeset
120 purple_group_get_name(orig),
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40697
diff changeset
121 purple_group_get_name(dest));
3136
8d988a6d2f4c [gaim-migrate @ 3151]
Rob Flynn <gaim@robflynn.com>
parents: 3124
diff changeset
122 }
8d988a6d2f4c [gaim-migrate @ 3151]
Rob Flynn <gaim@robflynn.com>
parents: 3124
diff changeset
123 }
8d988a6d2f4c [gaim-migrate @ 3151]
Rob Flynn <gaim@robflynn.com>
parents: 3124
diff changeset
124
35499
c4c5e0a670b1 Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents: 35265
diff changeset
125 void purple_serv_join_chat(PurpleConnection *gc, GHashTable *data)
1
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
126 {
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
127 PurpleProtocol *protocol;
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5170
diff changeset
128
28578
74b2a6dba113 Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents: 28577
diff changeset
129 if (gc) {
36623
caaadef03507 Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents: 36606
diff changeset
130 protocol = purple_connection_get_protocol(gc);
40697
81f81f5d2f39 Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents: 40579
diff changeset
131 purple_protocol_chat_join(PURPLE_PROTOCOL_CHAT(protocol), gc, data);
28578
74b2a6dba113 Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents: 28577
diff changeset
132 }
1
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
133 }
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
134
4359
cf899ee07d1d [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
135 /*
cf899ee07d1d [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
136 * woo. i'm actually going to comment this function. isn't that fun. make
cf899ee07d1d [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
137 * sure to follow along, kids
cf899ee07d1d [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
138 */
35499
c4c5e0a670b1 Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents: 35265
diff changeset
139 void purple_serv_got_im(PurpleConnection *gc, const char *who, const char *msg,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15808
diff changeset
140 PurpleMessageFlags flags, time_t mtime)
1
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
141 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15808
diff changeset
142 PurpleAccount *account;
40885
87f6241da196 Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents: 40870
diff changeset
143 PurpleConversation *im;
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
144 PurpleConversationManager *manager;
5136
81079a81ebc6 [gaim-migrate @ 5500]
Nathan Walp <nwalp@pidgin.im>
parents: 5073
diff changeset
145 char *message, *name;
6622
277eb0b14653 [gaim-migrate @ 7146]
Robert McQueen <robot101@debian.org>
parents: 6621
diff changeset
146 char *angel, *buffy;
277eb0b14653 [gaim-migrate @ 7146]
Robert McQueen <robot101@debian.org>
parents: 6621
diff changeset
147 int plugin_return;
36088
4c386387f6f3 Switch purple_conversation_write_message to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36078
diff changeset
148 PurpleMessage *pmsg;
2273
b7c08d737d81 [gaim-migrate @ 2283]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 2231
diff changeset
149
11903
56ae8af14a0d [gaim-migrate @ 14194]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11818
diff changeset
150 g_return_if_fail(msg != NULL);
56ae8af14a0d [gaim-migrate @ 14194]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11818
diff changeset
151
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
152 account = purple_connection_get_account(gc);
12849
052f51304ed2 [gaim-migrate @ 15199]
Jean-Yves Lefort
parents: 12797
diff changeset
153
35252
852014ae74a0 Fix a remotely-triggerable null pointer dereference.
Mark Doliner <mark@kingant.net>
parents: 28880
diff changeset
154 if (mtime < 0) {
852014ae74a0 Fix a remotely-triggerable null pointer dereference.
Mark Doliner <mark@kingant.net>
parents: 28880
diff changeset
155 purple_debug_error("server",
35499
c4c5e0a670b1 Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents: 35265
diff changeset
156 "purple_serv_got_im ignoring negative timestamp\n");
35252
852014ae74a0 Fix a remotely-triggerable null pointer dereference.
Mark Doliner <mark@kingant.net>
parents: 28880
diff changeset
157 /* TODO: Would be more appropriate to use a value that indicates
852014ae74a0 Fix a remotely-triggerable null pointer dereference.
Mark Doliner <mark@kingant.net>
parents: 28880
diff changeset
158 that the timestamp is unknown, and surface that in the UI. */
852014ae74a0 Fix a remotely-triggerable null pointer dereference.
Mark Doliner <mark@kingant.net>
parents: 28880
diff changeset
159 mtime = time(NULL);
852014ae74a0 Fix a remotely-triggerable null pointer dereference.
Mark Doliner <mark@kingant.net>
parents: 28880
diff changeset
160 }
852014ae74a0 Fix a remotely-triggerable null pointer dereference.
Mark Doliner <mark@kingant.net>
parents: 28880
diff changeset
161
25721
d49e93a18899 *** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25291
diff changeset
162 /*
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36630
diff changeset
163 * XXX: Should we be setting this here, or relying on protocols to set it?
25721
d49e93a18899 *** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25291
diff changeset
164 */
d49e93a18899 *** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25291
diff changeset
165 flags |= PURPLE_MESSAGE_RECV;
d49e93a18899 *** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25291
diff changeset
166
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
167 manager = purple_conversation_manager_get_default();
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
168
4359
cf899ee07d1d [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
169 /*
cf899ee07d1d [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
170 * We should update the conversation window buttons and menu,
cf899ee07d1d [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
171 * if it exists.
cf899ee07d1d [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
172 */
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
173 im = purple_conversation_manager_find_im(manager, account, who);
2106
ecd1bec6376c [gaim-migrate @ 2116]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 2104
diff changeset
174
4359
cf899ee07d1d [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
175 /*
20641
bb5367e64507 Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents: 20080
diff changeset
176 * Make copies of the message and the sender in case plugins want
41083
590d533cf290 Fix several typos in libpurple
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40992
diff changeset
177 * to free these strings and replace them with a modified version.
4359
cf899ee07d1d [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
178 */
20641
bb5367e64507 Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents: 20080
diff changeset
179 buffy = g_strdup(msg);
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents: 6885
diff changeset
180 angel = g_strdup(who);
1339
7154ff47dc2b [gaim-migrate @ 1349]
Rob Flynn <gaim@robflynn.com>
parents: 1336
diff changeset
181
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents: 6885
diff changeset
182 plugin_return = GPOINTER_TO_INT(
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15808
diff changeset
183 purple_signal_emit_return_1(purple_conversations_get_handle(),
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
184 "receiving-im-msg", account,
34656
adbcbe04077c Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34632
diff changeset
185 &angel, &buffy, im, &flags));
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents: 6885
diff changeset
186
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents: 6885
diff changeset
187 if (!buffy || !angel || plugin_return) {
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 13995
diff changeset
188 g_free(buffy);
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 13995
diff changeset
189 g_free(angel);
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents: 6885
diff changeset
190 return;
1100
efc7d10c7826 [gaim-migrate @ 1110]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 1089
diff changeset
191 }
8619
feb3239eb650 [gaim-migrate @ 9370]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8603
diff changeset
192
8999
dd434cfec86a [gaim-migrate @ 9774]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8950
diff changeset
193 name = angel;
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents: 6885
diff changeset
194 message = buffy;
2104
8d12ab6f798c [gaim-migrate @ 2114]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 2090
diff changeset
195
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
196 purple_signal_emit(purple_conversations_get_handle(), "received-im-msg",
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
197 account, name, message, im, flags);
8999
dd434cfec86a [gaim-migrate @ 9774]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8950
diff changeset
198
12288
d3452b226853 [gaim-migrate @ 14592]
Casey Harkins <charkins@pidgin.im>
parents: 12281
diff changeset
199 /* search for conversation again in case it was created by received-im-msg handler */
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
200 if(im == NULL) {
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
201 im = purple_conversation_manager_find_im(manager, account, name);
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
202 }
12288
d3452b226853 [gaim-migrate @ 14592]
Casey Harkins <charkins@pidgin.im>
parents: 12281
diff changeset
203
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
204 if(im == NULL) {
34656
adbcbe04077c Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34632
diff changeset
205 im = purple_im_conversation_new(account, name);
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
206 }
12949
525bbe926760 [gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12894
diff changeset
207
42298
4671ff5c65d6 Remove the unused account parameter from the message constructors
Gary Kramlich <grim@reaperworld.com>
parents: 42172
diff changeset
208 pmsg = purple_message_new_incoming(name, message, flags, mtime);
40885
87f6241da196 Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents: 40870
diff changeset
209 purple_conversation_write_message(im, pmsg);
12949
525bbe926760 [gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12894
diff changeset
210 g_free(message);
42592
6b65c0e4ba15 Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents: 42557
diff changeset
211 g_object_unref(pmsg);
12116
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12114
diff changeset
212
2104
8d12ab6f798c [gaim-migrate @ 2114]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 2090
diff changeset
213 g_free(name);
1
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
214 }

mercurial