Mon, 15 Aug 2022 02:39:09 -0500
Port PidginAddBuddyDialog to GTK4
Testing Done:
Compiled
Reviewed at https://reviews.imfreedom.org/r/1586/
| 1 | 1 | /* |
| 15884 | 2 | * purple |
| 1 | 3 | * |
| 15884 | 4 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 6 | * source distribution. | |
| 1 | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19673
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 1 | 21 | * |
| 22 | */ | |
| 16795 | 23 | |
| 24 | /* This file is the fullcrap */ | |
| 25 | ||
|
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
|
26 | #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
|
27 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
28 | #include "internal.h" |
|
34706
02cb08146888
Renamed blist.[ch] to buddylist.[ch]
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
29 | #include "buddylist.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
30 | #include "debug.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
31 | #include "notify.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
32 | #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
|
33 | #include "purpleconversation.h" |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
34 | #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
|
35 | #include "purpleprivate.h" |
|
41155
922c9e70900c
Rename protocol.[ch] to purpleprotocol.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
36 | #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
|
37 | #include "purpleprotocolchat.h" |
|
40507
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
38 | #include "purpleprotocolim.h" |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
39 | #include "purpleprotocolprivacy.h" |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
40 | #include "purpleprotocolserver.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
41 | #include "request.h" |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
42 | #include "signals.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
43 | #include "server.h" |
|
9944
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9933
diff
changeset
|
44 | #include "status.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
45 | #include "util.h" |
|
40870
e3397381fd35
Remove includes from protocol.h that weren't used there and deal with the fallout
Gary Kramlich <grim@reaperworld.com>
parents:
40853
diff
changeset
|
46 | #include "xfer.h" |
| 1 | 47 | |
|
8948
a5ec0dd1f46c
[gaim-migrate @ 9720]
Mark Doliner <markdoliner@pidgin.im>
parents:
8904
diff
changeset
|
48 | #define SECS_BEFORE_RESENDING_AUTORESPONSE 600 |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9237
diff
changeset
|
49 | #define SEX_BEFORE_RESENDING_AUTORESPONSE "Only after you're married" |
|
8948
a5ec0dd1f46c
[gaim-migrate @ 9720]
Mark Doliner <markdoliner@pidgin.im>
parents:
8904
diff
changeset
|
50 | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
51 | unsigned int |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
52 | 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
|
53 | { |
|
40507
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
54 | if(gc) { |
|
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
55 | PurpleProtocol *protocol = purple_connection_get_protocol(gc); |
|
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
56 | PurpleProtocolIM *im = PURPLE_PROTOCOL_IM(protocol); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
57 | |
|
40507
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
58 | 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
|
59 | } |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
60 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
61 | return 0; |
| 2993 | 62 | } |
| 1 | 63 | |
|
10871
c0282a4f2250
[gaim-migrate @ 12558]
Mark Doliner <markdoliner@pidgin.im>
parents:
10853
diff
changeset
|
64 | static GSList *last_auto_responses = NULL; |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
65 | struct last_auto_response { |
| 15884 | 66 | PurpleConnection *gc; |
|
3815
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
67 | char name[80]; |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
68 | time_t sent; |
|
3815
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
69 | }; |
|
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
70 | |
|
10850
6889f793b918
[gaim-migrate @ 12522]
Mark Doliner <markdoliner@pidgin.im>
parents:
10827
diff
changeset
|
71 | static gboolean |
|
6889f793b918
[gaim-migrate @ 12522]
Mark Doliner <markdoliner@pidgin.im>
parents:
10827
diff
changeset
|
72 | expire_last_auto_responses(gpointer data) |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
73 | { |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
74 | GSList *tmp, *cur; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
75 | struct last_auto_response *lar; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
76 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
77 | tmp = last_auto_responses; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
78 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
79 | while (tmp) { |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
80 | cur = tmp; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
81 | tmp = tmp->next; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
82 | lar = (struct last_auto_response *)cur->data; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
83 | |
|
8948
a5ec0dd1f46c
[gaim-migrate @ 9720]
Mark Doliner <markdoliner@pidgin.im>
parents:
8904
diff
changeset
|
84 | if ((time(NULL) - lar->sent) > SECS_BEFORE_RESENDING_AUTORESPONSE) { |
|
40079
a37a1e349491
Replace g_[s]list_remove with g_[s]list_delete_link.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39918
diff
changeset
|
85 | last_auto_responses = g_slist_delete_link(last_auto_responses, cur); |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
86 | g_free(lar); |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
87 | } |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
88 | } |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
89 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
90 | return FALSE; /* do not run again */ |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
91 | } |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
92 | |
|
10850
6889f793b918
[gaim-migrate @ 12522]
Mark Doliner <markdoliner@pidgin.im>
parents:
10827
diff
changeset
|
93 | static struct last_auto_response * |
| 15884 | 94 | get_last_auto_response(PurpleConnection *gc, const char *name) |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
95 | { |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
96 | GSList *tmp; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
97 | struct last_auto_response *lar; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
98 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
99 | /* because we're modifying or creating a lar, schedule the |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
100 | * function to expire them as the pref dictates */ |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
37428
diff
changeset
|
101 | g_timeout_add_seconds((SECS_BEFORE_RESENDING_AUTORESPONSE + 1), expire_last_auto_responses, NULL); |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
102 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
103 | tmp = last_auto_responses; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
104 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
105 | while (tmp) { |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
106 | lar = (struct last_auto_response *)tmp->data; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
107 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
108 | if (gc == lar->gc && !strncmp(name, lar->name, sizeof(lar->name))) |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
109 | return lar; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
110 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
111 | tmp = tmp->next; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
112 | } |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
113 | |
|
37428
9e56dcafff40
Remove needless allocation casts
Michael McConville <mmcco@mykolab.com>
parents:
37201
diff
changeset
|
114 | lar = g_new0(struct last_auto_response, 1); |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
115 | g_snprintf(lar->name, sizeof(lar->name), "%s", name); |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
116 | lar->gc = gc; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
117 | lar->sent = 0; |
|
13791
df2a8738c602
[gaim-migrate @ 16201]
Richard Laager <rlaager@pidgin.im>
parents:
13664
diff
changeset
|
118 | last_auto_responses = g_slist_prepend(last_auto_responses, lar); |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
119 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
120 | return lar; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
121 | } |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
122 | |
|
36076
a0e5b68ff4ef
Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35501
diff
changeset
|
123 | int purple_serv_send_im(PurpleConnection *gc, PurpleMessage *msg) |
| 1 | 124 | { |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
125 | PurpleAccount *account = NULL; |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
126 | PurpleConversation *im = NULL; |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
127 | PurpleConversationManager *manager = NULL; |
|
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
|
128 | PurplePresence *presence = NULL; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
129 | PurpleProtocol *protocol = NULL; |
|
2123
4cfdde0aa3f1
[gaim-migrate @ 2133]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2108
diff
changeset
|
130 | int val = -EINVAL; |
|
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
|
131 | const gchar *auto_reply_pref = NULL; |
|
36098
4951752ad038
Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36089
diff
changeset
|
132 | const gchar *recipient; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
133 | |
|
13422
0221ca926ebe
[gaim-migrate @ 15796]
Richard Laager <rlaager@pidgin.im>
parents:
13418
diff
changeset
|
134 | 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
|
135 | g_return_val_if_fail(msg != NULL, val); |
|
13422
0221ca926ebe
[gaim-migrate @ 15796]
Richard Laager <rlaager@pidgin.im>
parents:
13418
diff
changeset
|
136 | |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
137 | 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
|
138 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
139 | 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
|
140 | 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
|
141 | |
| 15884 | 142 | account = purple_connection_get_account(gc); |
| 143 | presence = purple_account_get_presence(account); | |
|
36098
4951752ad038
Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36089
diff
changeset
|
144 | recipient = purple_message_get_recipient(msg); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
145 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
146 | manager = purple_conversation_manager_get_default(); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
147 | im = purple_conversation_manager_find_im(manager, account, recipient); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
148 | |
|
40507
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
149 | /* 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
|
150 | * 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
|
151 | * it until we can reevaluate this function. |
|
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
152 | */ |
|
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
153 | if(PURPLE_IS_PROTOCOL_IM(protocol)) { |
|
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
154 | PurpleProtocolIM *pim = PURPLE_PROTOCOL_IM(protocol); |
|
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
155 | |
|
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
156 | val = purple_protocol_im_send(pim, gc, msg); |
|
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
157 | } |
|
94
0c6ba3d3fa90
[gaim-migrate @ 104]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
79
diff
changeset
|
158 | |
|
9594
7a1f902b9494
[gaim-migrate @ 10437]
Mark Doliner <markdoliner@pidgin.im>
parents:
9584
diff
changeset
|
159 | /* |
|
7a1f902b9494
[gaim-migrate @ 10437]
Mark Doliner <markdoliner@pidgin.im>
parents:
9584
diff
changeset
|
160 | * XXX - If "only auto-reply when away & idle" is set, then shouldn't |
|
7a1f902b9494
[gaim-migrate @ 10437]
Mark Doliner <markdoliner@pidgin.im>
parents:
9584
diff
changeset
|
161 | * this only reset lar->sent if we're away AND idle? |
|
7a1f902b9494
[gaim-migrate @ 10437]
Mark Doliner <markdoliner@pidgin.im>
parents:
9584
diff
changeset
|
162 | */ |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
163 | auto_reply_pref = purple_prefs_get_string("/purple/away/auto_reply"); |
|
34746
dc9c911dbd35
Started GObjectification of PurpleConnection.
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
164 | if((purple_connection_get_flags(gc) & PURPLE_CONNECTION_FLAG_AUTO_RESP) && |
| 15884 | 165 | !purple_presence_is_available(presence) && |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
25854
diff
changeset
|
166 | !purple_strequal(auto_reply_pref, "never")) { |
|
5545
a8b1a1262402
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
167 | |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
168 | struct last_auto_response *lar; |
|
36098
4951752ad038
Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36089
diff
changeset
|
169 | lar = get_last_auto_response(gc, recipient); |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
170 | lar->sent = time(NULL); |
|
3815
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
171 | } |
|
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
172 | |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
173 | 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
|
174 | purple_im_conversation_stop_send_typed_timeout(PURPLE_IM_CONVERSATION(im)); |
| 3601 | 175 | |
|
2123
4cfdde0aa3f1
[gaim-migrate @ 2133]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2108
diff
changeset
|
176 | return val; |
| 1 | 177 | } |
| 178 | ||
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
179 | void purple_serv_get_info(PurpleConnection *gc, const char *name) |
| 1 | 180 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
181 | PurpleProtocol *protocol; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
182 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
183 | if (gc) { |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
184 | 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
|
185 | purple_protocol_server_get_info(PURPLE_PROTOCOL_SERVER(protocol), gc, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
186 | name); |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
187 | } |
|
249
14b7e4f943ff
[gaim-migrate @ 259]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
248
diff
changeset
|
188 | } |
|
14b7e4f943ff
[gaim-migrate @ 259]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
248
diff
changeset
|
189 | |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
190 | void purple_serv_set_info(PurpleConnection *gc, const char *info) |
| 1 | 191 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
192 | PurpleProtocol *protocol; |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
193 | PurpleAccount *account; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
194 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
195 | if (gc) { |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
196 | protocol = purple_connection_get_protocol(gc); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
197 | |
|
39759
ea1401483849
Rename *_GET_*_IFACE to more standard *_GET_IFACE.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39758
diff
changeset
|
198 | if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER, set_info)) { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
199 | account = purple_connection_get_account(gc); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
200 | |
|
35007
98c8b4f434b8
"account-setting-info" signal does not return anything
Ankit Vani <a@nevitus.org>
parents:
34940
diff
changeset
|
201 | purple_signal_emit(purple_accounts_get_handle(), |
|
98c8b4f434b8
"account-setting-info" signal does not return anything
Ankit Vani <a@nevitus.org>
parents:
34940
diff
changeset
|
202 | "account-setting-info", account, info); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
203 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
204 | purple_protocol_server_set_info(PURPLE_PROTOCOL_SERVER(protocol), |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
205 | gc, info); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
206 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
207 | purple_signal_emit(purple_accounts_get_handle(), |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
208 | "account-set-info", account, info); |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
209 | } |
| 1749 | 210 | } |
|
237
83ff5f92ee7e
[gaim-migrate @ 247]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
200
diff
changeset
|
211 | } |
|
83ff5f92ee7e
[gaim-migrate @ 247]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
200
diff
changeset
|
212 | |
| 3136 | 213 | /* |
| 214 | * Set buddy's alias on server roster/list | |
| 215 | */ | |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
216 | void purple_serv_alias_buddy(PurpleBuddy *b) |
| 3136 | 217 | { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
218 | 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
|
219 | PurpleConnection *gc; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
220 | PurpleProtocol *protocol; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
221 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
222 | if (b) { |
|
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
|
223 | account = purple_buddy_get_account(b); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
224 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
225 | if (account) { |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
226 | gc = purple_account_get_connection(account); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
227 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
228 | if(gc) { |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
229 | 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
|
230 | purple_protocol_server_alias_buddy(PURPLE_PROTOCOL_SERVER(protocol), |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
231 | gc, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
232 | purple_buddy_get_name(b), |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
233 | purple_buddy_get_local_alias(b)); |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
234 | } |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
235 | } |
| 3136 | 236 | } |
| 237 | } | |
| 238 | ||
| 9135 | 239 | void |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
240 | purple_serv_got_alias(PurpleConnection *gc, const char *who, const char *alias) |
| 9135 | 241 | { |
|
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
|
242 | PurpleAccount *account; |
| 15884 | 243 | PurpleBuddy *b; |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
244 | PurpleConversation *im; |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
245 | PurpleConversationManager *manager; |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
246 | GSList *buddies; |
|
6058
0d5c66a5da5d
[gaim-migrate @ 6508]
Mark Doliner <markdoliner@pidgin.im>
parents:
6019
diff
changeset
|
247 | |
|
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
|
248 | account = purple_connection_get_account(gc); |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34717
diff
changeset
|
249 | buddies = purple_blist_find_buddies(account, who); |
|
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
|
250 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
251 | manager = purple_conversation_manager_get_default(); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
252 | |
|
16863
b98303c15033
Change a few functions to free a linked list while iterating through
Mark Doliner <markdoliner@pidgin.im>
parents:
16795
diff
changeset
|
253 | while (buddies != NULL) |
| 9135 | 254 | { |
|
24957
647853a842da
A couple of minor fixes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24955
diff
changeset
|
255 | const char *server_alias; |
|
24955
77727fac30c6
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24526
diff
changeset
|
256 | |
|
16863
b98303c15033
Change a few functions to free a linked list while iterating through
Mark Doliner <markdoliner@pidgin.im>
parents:
16795
diff
changeset
|
257 | b = buddies->data; |
|
b98303c15033
Change a few functions to free a linked list while iterating through
Mark Doliner <markdoliner@pidgin.im>
parents:
16795
diff
changeset
|
258 | buddies = g_slist_delete_link(buddies, buddies); |
|
b98303c15033
Change a few functions to free a linked list while iterating through
Mark Doliner <markdoliner@pidgin.im>
parents:
16795
diff
changeset
|
259 | |
|
24957
647853a842da
A couple of minor fixes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24955
diff
changeset
|
260 | server_alias = purple_buddy_get_server_alias(b); |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
25854
diff
changeset
|
261 | |
|
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
25854
diff
changeset
|
262 | if (purple_strequal(server_alias, alias)) |
| 14546 | 263 | continue; |
|
16863
b98303c15033
Change a few functions to free a linked list while iterating through
Mark Doliner <markdoliner@pidgin.im>
parents:
16795
diff
changeset
|
264 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34717
diff
changeset
|
265 | purple_buddy_set_server_alias(b, alias); |
| 9135 | 266 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
267 | im = purple_conversation_manager_find_im(manager, account, |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
268 | purple_buddy_get_name(b)); |
|
34656
adbcbe04077c
Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34632
diff
changeset
|
269 | if (im != NULL && alias != NULL && !purple_strequal(alias, who)) |
| 9135 | 270 | { |
|
24526
c302510b1137
escape nick change message
Ka-Hing Cheung <khc@pidgin.im>
parents:
23875
diff
changeset
|
271 | char *escaped = g_markup_escape_text(who, -1); |
|
c302510b1137
escape nick change message
Ka-Hing Cheung <khc@pidgin.im>
parents:
23875
diff
changeset
|
272 | char *escaped2 = g_markup_escape_text(alias, -1); |
| 9135 | 273 | char *tmp = g_strdup_printf(_("%s is now known as %s.\n"), |
|
24526
c302510b1137
escape nick change message
Ka-Hing Cheung <khc@pidgin.im>
parents:
23875
diff
changeset
|
274 | escaped, escaped2); |
| 9135 | 275 | |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36088
diff
changeset
|
276 | purple_conversation_write_system_message( |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
277 | im, tmp, |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36088
diff
changeset
|
278 | PURPLE_MESSAGE_NO_LINKIFY); |
| 9135 | 279 | |
| 280 | g_free(tmp); | |
|
24526
c302510b1137
escape nick change message
Ka-Hing Cheung <khc@pidgin.im>
parents:
23875
diff
changeset
|
281 | g_free(escaped2); |
|
c302510b1137
escape nick change message
Ka-Hing Cheung <khc@pidgin.im>
parents:
23875
diff
changeset
|
282 | g_free(escaped); |
| 9135 | 283 | } |
| 8870 | 284 | } |
| 4227 | 285 | } |
| 286 | ||
|
22474
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
287 | void |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
288 | purple_serv_got_private_alias(PurpleConnection *gc, const char *who, const char *alias) |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
289 | { |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
290 | PurpleAccount *account = NULL; |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
291 | GSList *buddies = NULL; |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
292 | PurpleBuddy *b = NULL; |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
293 | |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
294 | account = purple_connection_get_account(gc); |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34717
diff
changeset
|
295 | buddies = purple_blist_find_buddies(account, who); |
|
22474
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
296 | |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
297 | while(buddies != NULL) { |
|
24957
647853a842da
A couple of minor fixes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24955
diff
changeset
|
298 | const char *balias; |
|
22474
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
299 | b = buddies->data; |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
300 | |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
301 | buddies = g_slist_delete_link(buddies, buddies); |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
302 | |
|
34717
b3e588adef5a
Global replace purple_buddy_get_local_buddy_alias() with purple_buddy_get_local_alias()
Ankit Vani <a@nevitus.org>
parents:
34706
diff
changeset
|
303 | balias = purple_buddy_get_local_alias(b); |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
25854
diff
changeset
|
304 | if (purple_strequal(balias, alias)) |
|
22474
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
305 | continue; |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
306 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34717
diff
changeset
|
307 | purple_buddy_set_local_alias(b, alias); |
|
22474
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
308 | } |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
309 | } |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
310 | |
| 3136 | 311 | /* |
| 312 | * Move a buddy from one group to another on server. | |
| 313 | * | |
| 314 | * 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
|
315 | * it should be possible. Probably needs to be done, someday. Although, |
| 15884 | 316 | * the UI for that would be difficult, because groups are Purple-wide. |
| 3136 | 317 | */ |
|
37162
3336df05de5b
Add introspection gtkdocs for server.h
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37153
diff
changeset
|
318 | void purple_serv_move_buddy(PurpleBuddy *buddy, PurpleGroup *orig, PurpleGroup *dest) |
| 3136 | 319 | { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
320 | 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
|
321 | PurpleConnection *gc; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
322 | PurpleProtocol *protocol; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
323 | |
|
37162
3336df05de5b
Add introspection gtkdocs for server.h
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37153
diff
changeset
|
324 | g_return_if_fail(buddy != NULL); |
|
3336df05de5b
Add introspection gtkdocs for server.h
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37153
diff
changeset
|
325 | g_return_if_fail(orig != NULL); |
|
3336df05de5b
Add introspection gtkdocs for server.h
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37153
diff
changeset
|
326 | g_return_if_fail(dest != NULL); |
|
13418
676c3eb505dc
[gaim-migrate @ 15792]
Richard Laager <rlaager@pidgin.im>
parents:
13294
diff
changeset
|
327 | |
|
37162
3336df05de5b
Add introspection gtkdocs for server.h
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37153
diff
changeset
|
328 | 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
|
329 | 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
|
330 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
331 | if (gc) { |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
332 | 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
|
333 | 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
|
334 | gc, purple_buddy_get_name(buddy), |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
335 | purple_group_get_name(orig), |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
336 | purple_group_get_name(dest)); |
| 3136 | 337 | } |
| 338 | } | |
| 339 | ||
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
340 | void purple_serv_add_permit(PurpleConnection *gc, const char *name) |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
341 | { |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
342 | if (gc) { |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
343 | PurpleProtocol *protocol = purple_connection_get_protocol(gc); |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
344 | PurpleProtocolPrivacy *privacy = PURPLE_PROTOCOL_PRIVACY(protocol); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
345 | |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
346 | purple_protocol_privacy_add_permit(privacy, gc, name); |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
347 | } |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
348 | } |
|
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
349 | |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
350 | void purple_serv_add_deny(PurpleConnection *gc, const char *name) |
| 1 | 351 | { |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
352 | if (gc) { |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
353 | PurpleProtocol *protocol = purple_connection_get_protocol(gc); |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
354 | PurpleProtocolPrivacy *privacy = PURPLE_PROTOCOL_PRIVACY(protocol); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
355 | |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
356 | purple_protocol_privacy_add_deny(privacy, gc, name); |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
357 | } |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
358 | } |
|
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
359 | |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
360 | void purple_serv_remove_permit(PurpleConnection *gc, const char *name) |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
361 | { |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
362 | if (gc) { |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
363 | PurpleProtocol *protocol = purple_connection_get_protocol(gc); |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
364 | PurpleProtocolPrivacy *privacy = PURPLE_PROTOCOL_PRIVACY(protocol); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
365 | |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
366 | purple_protocol_privacy_remove_permit(privacy, gc, name); |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
367 | } |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
368 | } |
| 1 | 369 | |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
370 | void purple_serv_remove_deny(PurpleConnection *gc, const char *name) |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
371 | { |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
372 | if (gc) { |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
373 | PurpleProtocol *protocol = purple_connection_get_protocol(gc); |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
374 | PurpleProtocolPrivacy *privacy = PURPLE_PROTOCOL_PRIVACY(protocol); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
375 | |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
376 | purple_protocol_privacy_remove_deny(privacy, gc, name); |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
377 | } |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
378 | } |
|
678
6e2cb341573a
[gaim-migrate @ 688]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
660
diff
changeset
|
379 | |
|
40710
355aff4da4af
Fix a few things that were throwing g_warning's during startup
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
380 | void |
|
355aff4da4af
Fix a few things that were throwing g_warning's during startup
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
381 | purple_serv_set_permit_deny(PurpleConnection *gc) { |
|
355aff4da4af
Fix a few things that were throwing g_warning's during startup
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
382 | if(gc) { |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
383 | PurpleProtocol *protocol = purple_connection_get_protocol(gc); |
|
40710
355aff4da4af
Fix a few things that were throwing g_warning's during startup
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
384 | |
|
355aff4da4af
Fix a few things that were throwing g_warning's during startup
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
385 | if(PURPLE_IS_PROTOCOL_PRIVACY(protocol)) { |
|
355aff4da4af
Fix a few things that were throwing g_warning's during startup
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
386 | PurpleProtocolPrivacy *privacy = PURPLE_PROTOCOL_PRIVACY(protocol); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
387 | |
|
40710
355aff4da4af
Fix a few things that were throwing g_warning's during startup
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
388 | /* |
|
355aff4da4af
Fix a few things that were throwing g_warning's during startup
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
389 | * this is called when either you import a buddy list, and make lots |
|
355aff4da4af
Fix a few things that were throwing g_warning's during startup
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
390 | * of changes that way, or when the user toggles the permit/deny mode |
|
355aff4da4af
Fix a few things that were throwing g_warning's during startup
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
391 | * in the prefs. In either case you should probably be resetting and |
|
355aff4da4af
Fix a few things that were throwing g_warning's during startup
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
392 | * resending the permit/deny info when you get this. |
|
355aff4da4af
Fix a few things that were throwing g_warning's during startup
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
393 | */ |
|
355aff4da4af
Fix a few things that were throwing g_warning's during startup
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
394 | purple_protocol_privacy_set_permit_deny(privacy, gc); |
|
355aff4da4af
Fix a few things that were throwing g_warning's during startup
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
395 | } |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
396 | } |
| 1 | 397 | } |
| 398 | ||
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
399 | void purple_serv_join_chat(PurpleConnection *gc, GHashTable *data) |
| 1 | 400 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
401 | PurpleProtocol *protocol; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
402 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
403 | if (gc) { |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
404 | 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
|
405 | 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
|
406 | } |
| 1 | 407 | } |
| 408 | ||
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
409 | |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
410 | void purple_serv_reject_chat(PurpleConnection *gc, GHashTable *data) |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
411 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
412 | PurpleProtocol *protocol; |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
413 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
414 | if (gc) { |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
415 | 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
|
416 | purple_protocol_chat_reject(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
|
417 | } |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
418 | } |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
419 | |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
420 | void purple_serv_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name) |
| 1 | 421 | { |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
422 | PurpleAccount *account; |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
423 | PurpleConversation *chat; |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
424 | PurpleConversationManager *manager; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
425 | PurpleProtocol *protocol = NULL; |
|
39918
1c8e11f9274f
Fix several memory leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39761
diff
changeset
|
426 | char *buffy; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
427 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
428 | account = purple_connection_get_account(gc); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
429 | manager = purple_conversation_manager_get_default(); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
430 | chat = purple_conversation_manager_find_chat_by_id(manager, account, id); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
431 | |
|
34656
adbcbe04077c
Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34632
diff
changeset
|
432 | if(chat == NULL) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
433 | return; |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
434 | |
|
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
|
435 | if(gc) |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
436 | protocol = purple_connection_get_protocol(gc); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
437 | |
|
39918
1c8e11f9274f
Fix several memory leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39761
diff
changeset
|
438 | buffy = message && *message ? g_strdup(message) : NULL; |
| 15884 | 439 | purple_signal_emit(purple_conversations_get_handle(), "chat-inviting-user", |
|
34656
adbcbe04077c
Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34632
diff
changeset
|
440 | chat, name, &buffy); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
441 | |
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40579
diff
changeset
|
442 | if(protocol) { |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40579
diff
changeset
|
443 | purple_protocol_chat_invite(PURPLE_PROTOCOL_CHAT(protocol), gc, id, |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40579
diff
changeset
|
444 | buffy, name); |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40579
diff
changeset
|
445 | } |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
446 | |
| 15884 | 447 | purple_signal_emit(purple_conversations_get_handle(), "chat-invited-user", |
|
34656
adbcbe04077c
Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34632
diff
changeset
|
448 | chat, name, buffy); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
449 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13995
diff
changeset
|
450 | g_free(buffy); |
| 1 | 451 | } |
| 452 | ||
|
35163
95ca5df22ddd
Update function name in a comment
Ankit Vani <a@nevitus.org>
parents:
35089
diff
changeset
|
453 | /* Ya know, nothing uses this except purple_chat_conversation_finalize(), |
| 8256 | 454 | * I think I'll just merge it into that later... |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36630
diff
changeset
|
455 | * Then again, something might want to use this, from outside protocol-land |
| 8256 | 456 | * to leave a chat without destroying the conversation. |
| 457 | */ | |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
458 | void purple_serv_chat_leave(PurpleConnection *gc, int id) |
| 1 | 459 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
460 | PurpleProtocol *protocol; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
461 | |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
462 | 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
|
463 | purple_protocol_chat_leave(PURPLE_PROTOCOL_CHAT(protocol), gc, id); |
| 1 | 464 | } |
| 465 | ||
|
36077
b7328f4317c7
Switch purple_serv_chat_send to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36076
diff
changeset
|
466 | int purple_serv_chat_send(PurpleConnection *gc, int id, PurpleMessage *msg) |
| 1 | 467 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
468 | PurpleProtocol *protocol; |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
469 | 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
|
470 | |
|
36077
b7328f4317c7
Switch purple_serv_chat_send to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36076
diff
changeset
|
471 | g_return_val_if_fail(msg != NULL, -EINVAL); |
| 1 | 472 | |
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40579
diff
changeset
|
473 | if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT, send)) { |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40579
diff
changeset
|
474 | return purple_protocol_chat_send(PURPLE_PROTOCOL_CHAT(protocol), gc, |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40579
diff
changeset
|
475 | id, msg); |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40579
diff
changeset
|
476 | } |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
477 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
478 | return -EINVAL; |
| 1 | 479 | } |
| 480 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
481 | /* |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
482 | * 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
|
483 | * sure to follow along, kids |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
484 | */ |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
485 | void purple_serv_got_im(PurpleConnection *gc, const char *who, const char *msg, |
| 15884 | 486 | PurpleMessageFlags flags, time_t mtime) |
| 1 | 487 | { |
| 15884 | 488 | PurpleAccount *account; |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
489 | PurpleConversation *im; |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
490 | PurpleConversationManager *manager; |
| 5136 | 491 | char *message, *name; |
|
6622
277eb0b14653
[gaim-migrate @ 7146]
Robert McQueen <robot101@debian.org>
parents:
6621
diff
changeset
|
492 | char *angel, *buffy; |
|
277eb0b14653
[gaim-migrate @ 7146]
Robert McQueen <robot101@debian.org>
parents:
6621
diff
changeset
|
493 | int plugin_return; |
|
36088
4c386387f6f3
Switch purple_conversation_write_message to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36078
diff
changeset
|
494 | PurpleMessage *pmsg; |
|
2273
b7c08d737d81
[gaim-migrate @ 2283]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2231
diff
changeset
|
495 | |
|
11903
56ae8af14a0d
[gaim-migrate @ 14194]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11818
diff
changeset
|
496 | g_return_if_fail(msg != NULL); |
|
56ae8af14a0d
[gaim-migrate @ 14194]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11818
diff
changeset
|
497 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
498 | account = purple_connection_get_account(gc); |
| 12849 | 499 | |
|
35252
852014ae74a0
Fix a remotely-triggerable null pointer dereference.
Mark Doliner <mark@kingant.net>
parents:
28880
diff
changeset
|
500 | if (mtime < 0) { |
|
852014ae74a0
Fix a remotely-triggerable null pointer dereference.
Mark Doliner <mark@kingant.net>
parents:
28880
diff
changeset
|
501 | purple_debug_error("server", |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
502 | "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
|
503 | /* 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
|
504 | 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
|
505 | mtime = time(NULL); |
|
852014ae74a0
Fix a remotely-triggerable null pointer dereference.
Mark Doliner <mark@kingant.net>
parents:
28880
diff
changeset
|
506 | } |
|
852014ae74a0
Fix a remotely-triggerable null pointer dereference.
Mark Doliner <mark@kingant.net>
parents:
28880
diff
changeset
|
507 | |
|
25721
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
508 | /* |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36630
diff
changeset
|
509 | * 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
|
510 | */ |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
511 | flags |= PURPLE_MESSAGE_RECV; |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
512 | |
|
34583
476c39afcaae
Refactored the libpurple core to use the GObject-based PurpleAccount
Ankit Vani <a@nevitus.org>
parents:
32678
diff
changeset
|
513 | if (!purple_account_privacy_check(account, who)) { |
|
28236
3827fe6f94e0
Check in a change that does dumb client-side blocking of people
Mark Doliner <markdoliner@pidgin.im>
parents:
27935
diff
changeset
|
514 | purple_signal_emit(purple_conversations_get_handle(), "blocked-im-msg", |
|
3827fe6f94e0
Check in a change that does dumb client-side blocking of people
Mark Doliner <markdoliner@pidgin.im>
parents:
27935
diff
changeset
|
515 | account, who, msg, flags, (unsigned int)mtime); |
|
3827fe6f94e0
Check in a change that does dumb client-side blocking of people
Mark Doliner <markdoliner@pidgin.im>
parents:
27935
diff
changeset
|
516 | return; |
| 12849 | 517 | } |
| 518 | ||
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
519 | manager = purple_conversation_manager_get_default(); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
520 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
521 | /* |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
522 | * We should update the conversation window buttons and menu, |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
523 | * if it exists. |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
524 | */ |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
525 | im = purple_conversation_manager_find_im(manager, account, who); |
|
2106
ecd1bec6376c
[gaim-migrate @ 2116]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2104
diff
changeset
|
526 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
527 | /* |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
528 | * 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
|
529 | * 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
|
530 | */ |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
531 | buffy = g_strdup(msg); |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
532 | angel = g_strdup(who); |
| 1339 | 533 | |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
534 | plugin_return = GPOINTER_TO_INT( |
| 15884 | 535 | 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
|
536 | "receiving-im-msg", account, |
|
34656
adbcbe04077c
Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34632
diff
changeset
|
537 | &angel, &buffy, im, &flags)); |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
538 | |
|
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
539 | if (!buffy || !angel || plugin_return) { |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13995
diff
changeset
|
540 | g_free(buffy); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13995
diff
changeset
|
541 | g_free(angel); |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
542 | return; |
|
1100
efc7d10c7826
[gaim-migrate @ 1110]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1089
diff
changeset
|
543 | } |
| 8619 | 544 | |
| 8999 | 545 | name = angel; |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
546 | message = buffy; |
|
2104
8d12ab6f798c
[gaim-migrate @ 2114]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2090
diff
changeset
|
547 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
548 | 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
|
549 | account, name, message, im, flags); |
| 8999 | 550 | |
|
12288
d3452b226853
[gaim-migrate @ 14592]
Casey Harkins <charkins@pidgin.im>
parents:
12281
diff
changeset
|
551 | /* 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
|
552 | if(im == NULL) { |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
553 | 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
|
554 | } |
|
12288
d3452b226853
[gaim-migrate @ 14592]
Casey Harkins <charkins@pidgin.im>
parents:
12281
diff
changeset
|
555 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
556 | if(im == NULL) { |
|
34656
adbcbe04077c
Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34632
diff
changeset
|
557 | im = purple_im_conversation_new(account, name); |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
558 | } |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
559 | |
|
36098
4951752ad038
Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36089
diff
changeset
|
560 | 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
|
561 | purple_conversation_write_message(im, pmsg); |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
562 | g_free(message); |
|
40541
9ceb8d25d4d9
PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
563 | g_object_unref(G_OBJECT(pmsg)); |
|
12116
17bf39d2678f
[gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents:
12114
diff
changeset
|
564 | |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
565 | /* |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
566 | * Don't autorespond if: |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
567 | * |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
568 | * - it's not supported on this connection |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
569 | * - we are available |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
570 | * - or it's disabled |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
571 | * - or we're not idle and the 'only auto respond if idle' pref |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
572 | * is set |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
573 | */ |
|
34746
dc9c911dbd35
Started GObjectification of PurpleConnection.
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
574 | if (purple_connection_get_flags(gc) & PURPLE_CONNECTION_FLAG_AUTO_RESP) |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
575 | { |
| 15884 | 576 | PurplePresence *presence; |
| 577 | PurpleStatus *status; | |
| 578 | PurpleStatusType *status_type; | |
| 579 | PurpleStatusPrimitive primitive; | |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
580 | const gchar *auto_reply_pref; |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
581 | const char *away_msg = NULL; |
|
23523
43487fb86f1e
Mobile status are created as independant statuses, which cannot be the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23436
diff
changeset
|
582 | gboolean mobile = FALSE; |
|
1775
16de02b8c378
[gaim-migrate @ 1785]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1774
diff
changeset
|
583 | |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
584 | auto_reply_pref = purple_prefs_get_string("/purple/away/auto_reply"); |
|
10052
329dad7e2da3
[gaim-migrate @ 11013]
Dave West <kat@users.sourceforge.net>
parents:
10011
diff
changeset
|
585 | |
| 15884 | 586 | presence = purple_account_get_presence(account); |
| 587 | status = purple_presence_get_active_status(presence); | |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34821
diff
changeset
|
588 | status_type = purple_status_get_status_type(status); |
| 15884 | 589 | primitive = purple_status_type_get_primitive(status_type); |
|
23523
43487fb86f1e
Mobile status are created as independant statuses, which cannot be the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23436
diff
changeset
|
590 | mobile = purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOBILE); |
| 15884 | 591 | if ((primitive == PURPLE_STATUS_AVAILABLE) || |
| 592 | (primitive == PURPLE_STATUS_INVISIBLE) || | |
|
23523
43487fb86f1e
Mobile status are created as independant statuses, which cannot be the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23436
diff
changeset
|
593 | mobile || |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
25854
diff
changeset
|
594 | purple_strequal(auto_reply_pref, "never") || |
|
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
25854
diff
changeset
|
595 | (!purple_presence_is_idle(presence) && purple_strequal(auto_reply_pref, "awayidle"))) |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
596 | { |
|
2104
8d12ab6f798c
[gaim-migrate @ 2114]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2090
diff
changeset
|
597 | g_free(name); |
|
1775
16de02b8c378
[gaim-migrate @ 1785]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1774
diff
changeset
|
598 | return; |
|
2104
8d12ab6f798c
[gaim-migrate @ 2114]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2090
diff
changeset
|
599 | } |
|
1775
16de02b8c378
[gaim-migrate @ 1785]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1774
diff
changeset
|
600 | |
|
34821
0e27ec95be63
Refactored plugin, savedstatuses and server to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34755
diff
changeset
|
601 | away_msg = g_value_get_string( |
| 15884 | 602 | purple_status_get_attr_value(status, "message")); |
|
1775
16de02b8c378
[gaim-migrate @ 1785]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1774
diff
changeset
|
603 | |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
604 | if ((away_msg != NULL) && (*away_msg != '\0')) { |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
605 | struct last_auto_response *lar; |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
606 | time_t now = time(NULL); |
|
10052
329dad7e2da3
[gaim-migrate @ 11013]
Dave West <kat@users.sourceforge.net>
parents:
10011
diff
changeset
|
607 | |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
608 | /* |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
609 | * This used to be based on the conversation window. But um, if |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
610 | * you went away, and someone sent you a message and got your |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
611 | * auto-response, and then you closed the window, and then they |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
612 | * sent you another one, they'd get the auto-response back too |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
613 | * soon. Besides that, we need to keep track of this even if we've |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
614 | * got a queue. So the rest of this block is just the auto-response, |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
615 | * if necessary. |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
616 | */ |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
617 | lar = get_last_auto_response(gc, name); |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
618 | if ((now - lar->sent) >= SECS_BEFORE_RESENDING_AUTORESPONSE) |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
619 | { |
|
13995
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
620 | /* |
|
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
621 | * We don't want to send an autoresponse in response to the other user's |
|
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
622 | * autoresponse. We do, however, not want to then send one in response to the |
|
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
623 | * _next_ message, so we still set lar->sent to now. |
|
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
624 | */ |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
625 | lar->sent = now; |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13995
diff
changeset
|
626 | |
| 15884 | 627 | if (!(flags & PURPLE_MESSAGE_AUTO_RESP)) |
|
13995
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
628 | { |
|
36076
a0e5b68ff4ef
Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35501
diff
changeset
|
629 | PurpleMessage *msg; |
|
40541
9ceb8d25d4d9
PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
630 | const gchar *me = purple_account_get_name_for_display(account); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
631 | |
|
40541
9ceb8d25d4d9
PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
632 | msg = purple_message_new_outgoing(me, name, |
|
36098
4951752ad038
Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36089
diff
changeset
|
633 | away_msg, PURPLE_MESSAGE_AUTO_RESP); |
|
36076
a0e5b68ff4ef
Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35501
diff
changeset
|
634 | |
|
a0e5b68ff4ef
Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35501
diff
changeset
|
635 | purple_serv_send_im(gc, msg); |
|
36088
4c386387f6f3
Switch purple_conversation_write_message to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36078
diff
changeset
|
636 | purple_conversation_write_message(PURPLE_CONVERSATION(im), msg); |
|
40541
9ceb8d25d4d9
PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
637 | |
|
9ceb8d25d4d9
PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
638 | g_object_unref(G_OBJECT(msg)); |
|
13995
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
639 | } |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
640 | } |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
641 | } |
| 1 | 642 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
643 | |
|
2104
8d12ab6f798c
[gaim-migrate @ 2114]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2090
diff
changeset
|
644 | g_free(name); |
| 1 | 645 | } |
| 646 | ||
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
647 | void |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
648 | purple_serv_got_typing(PurpleConnection *gc, const char *name, int timeout, |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
649 | PurpleIMTypingState state) |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
650 | { |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
651 | PurpleAccount *account; |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
652 | PurpleConversation *conv; |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
653 | PurpleConversationManager *manager; |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
654 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
655 | account = purple_connection_get_account(gc); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
656 | |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
657 | manager = purple_conversation_manager_get_default(); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
658 | conv = purple_conversation_manager_find_im(manager, account, name); |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
659 | if(PURPLE_IS_IM_CONVERSATION(conv)) { |
|
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
660 | PurpleIMConversation *im = PURPLE_IM_CONVERSATION(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
661 | |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
662 | purple_im_conversation_set_typing_state(im, state); |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
663 | |
|
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
664 | if(timeout > 0) { |
|
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
665 | purple_im_conversation_start_typing_timeout(im, timeout); |
|
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
666 | } |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12677
diff
changeset
|
667 | } else { |
|
17107
fbdf9f73f9f8
Emit the buddy-typing-stopped signal even if we don't have a conversation, and use swtich rather than if
Evan Schoenberg <evands@pidgin.im>
parents:
16863
diff
changeset
|
668 | switch (state) |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12677
diff
changeset
|
669 | { |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34656
diff
changeset
|
670 | case PURPLE_IM_TYPING: |
|
17107
fbdf9f73f9f8
Emit the buddy-typing-stopped signal even if we don't have a conversation, and use swtich rather than if
Evan Schoenberg <evands@pidgin.im>
parents:
16863
diff
changeset
|
671 | purple_signal_emit(purple_conversations_get_handle(), |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
672 | "buddy-typing", account, name); |
|
17107
fbdf9f73f9f8
Emit the buddy-typing-stopped signal even if we don't have a conversation, and use swtich rather than if
Evan Schoenberg <evands@pidgin.im>
parents:
16863
diff
changeset
|
673 | break; |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34656
diff
changeset
|
674 | case PURPLE_IM_TYPED: |
|
17107
fbdf9f73f9f8
Emit the buddy-typing-stopped signal even if we don't have a conversation, and use swtich rather than if
Evan Schoenberg <evands@pidgin.im>
parents:
16863
diff
changeset
|
675 | purple_signal_emit(purple_conversations_get_handle(), |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
676 | "buddy-typed", account, name); |
|
17107
fbdf9f73f9f8
Emit the buddy-typing-stopped signal even if we don't have a conversation, and use swtich rather than if
Evan Schoenberg <evands@pidgin.im>
parents:
16863
diff
changeset
|
677 | break; |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34656
diff
changeset
|
678 | case PURPLE_IM_NOT_TYPING: |
|
17107
fbdf9f73f9f8
Emit the buddy-typing-stopped signal even if we don't have a conversation, and use swtich rather than if
Evan Schoenberg <evands@pidgin.im>
parents:
16863
diff
changeset
|
679 | purple_signal_emit(purple_conversations_get_handle(), |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
680 | "buddy-typing-stopped", account, name); |
|
17107
fbdf9f73f9f8
Emit the buddy-typing-stopped signal even if we don't have a conversation, and use swtich rather than if
Evan Schoenberg <evands@pidgin.im>
parents:
16863
diff
changeset
|
681 | break; |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12677
diff
changeset
|
682 | } |
|
11706
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
683 | } |
| 2993 | 684 | } |
| 1 | 685 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
686 | void |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
687 | purple_serv_got_typing_stopped(PurpleConnection *gc, const char *name) { |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
688 | PurpleAccount *account; |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
689 | PurpleConversation *conv; |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
690 | PurpleConversationManager *manager; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
691 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
692 | account = purple_connection_get_account(gc); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
693 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
694 | manager = purple_conversation_manager_get_default(); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
695 | conv = purple_conversation_manager_find_im(manager, account, name); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
696 | if(conv != NULL) { |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
697 | PurpleIMConversation *im = PURPLE_IM_CONVERSATION(conv); |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
698 | if(purple_im_conversation_get_typing_state(im) == PURPLE_IM_NOT_TYPING) { |
|
11706
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
699 | return; |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
700 | } |
|
5032
2276c67b0243
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
701 | |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
702 | purple_im_conversation_stop_typing_timeout(im); |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34656
diff
changeset
|
703 | purple_im_conversation_set_typing_state(im, PURPLE_IM_NOT_TYPING); |
|
11706
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
704 | } |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
705 | else |
|
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
706 | { |
| 15884 | 707 | purple_signal_emit(purple_conversations_get_handle(), |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
708 | "buddy-typing-stopped", account, name); |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
709 | } |
| 2993 | 710 | } |
| 1 | 711 | |
| 4487 | 712 | struct chat_invite_data { |
| 15884 | 713 | PurpleConnection *gc; |
| 5234 | 714 | GHashTable *components; |
| 4487 | 715 | }; |
| 1723 | 716 | |
| 4487 | 717 | static void chat_invite_data_free(struct chat_invite_data *cid) |
| 1 | 718 | { |
| 5234 | 719 | if (cid->components) |
| 720 | g_hash_table_destroy(cid->components); | |
| 4487 | 721 | g_free(cid); |
| 722 | } | |
| 1723 | 723 | |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
724 | |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
725 | static void chat_invite_reject(struct chat_invite_data *cid) |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
726 | { |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
727 | purple_serv_reject_chat(cid->gc, cid->components); |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
728 | chat_invite_data_free(cid); |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
729 | } |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
730 | |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
731 | |
| 4487 | 732 | static void chat_invite_accept(struct chat_invite_data *cid) |
| 733 | { | |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
734 | purple_serv_join_chat(cid->gc, cid->components); |
| 4487 | 735 | chat_invite_data_free(cid); |
| 1 | 736 | } |
| 737 | ||
| 738 | ||
| 739 | ||
| 35501 | 740 | void purple_serv_got_chat_invite(PurpleConnection *gc, const char *name, |
|
5630
a05d97d87690
[gaim-migrate @ 6037]
Mark Doliner <markdoliner@pidgin.im>
parents:
5602
diff
changeset
|
741 | const char *who, const char *message, GHashTable *data) |
| 1 | 742 | { |
| 15884 | 743 | PurpleAccount *account; |
|
25291
52482ea6d188
Fix a potential leak "KuSh" discovered using "cppcheck". Fixes #7863.
Daniel Atallah <datallah@pidgin.im>
parents:
24640
diff
changeset
|
744 | struct chat_invite_data *cid; |
| 11064 | 745 | int plugin_return; |
| 1 | 746 | |
|
28724
bbe9259aebaa
Make sure the room name and the buddy who invited you are non-null
Mark Doliner <markdoliner@pidgin.im>
parents:
28723
diff
changeset
|
747 | g_return_if_fail(name != NULL); |
|
bbe9259aebaa
Make sure the room name and the buddy who invited you are non-null
Mark Doliner <markdoliner@pidgin.im>
parents:
28723
diff
changeset
|
748 | g_return_if_fail(who != NULL); |
|
bbe9259aebaa
Make sure the room name and the buddy who invited you are non-null
Mark Doliner <markdoliner@pidgin.im>
parents:
28723
diff
changeset
|
749 | |
| 15884 | 750 | account = purple_connection_get_account(gc); |
|
34583
476c39afcaae
Refactored the libpurple core to use the GObject-based PurpleAccount
Ankit Vani <a@nevitus.org>
parents:
32678
diff
changeset
|
751 | if (!purple_account_privacy_check(account, who)) { |
|
28723
93de66f644a9
Call purple_privacy_check() even when the protocol has some privacy
Mark Doliner <markdoliner@pidgin.im>
parents:
28578
diff
changeset
|
752 | purple_signal_emit(purple_conversations_get_handle(), "chat-invite-blocked", |
|
93de66f644a9
Call purple_privacy_check() even when the protocol has some privacy
Mark Doliner <markdoliner@pidgin.im>
parents:
28578
diff
changeset
|
753 | account, who, name, message, data); |
|
93de66f644a9
Call purple_privacy_check() even when the protocol has some privacy
Mark Doliner <markdoliner@pidgin.im>
parents:
28578
diff
changeset
|
754 | return; |
| 12849 | 755 | } |
| 1 | 756 | |
|
25291
52482ea6d188
Fix a potential leak "KuSh" discovered using "cppcheck". Fixes #7863.
Daniel Atallah <datallah@pidgin.im>
parents:
24640
diff
changeset
|
757 | cid = g_new0(struct chat_invite_data, 1); |
|
52482ea6d188
Fix a potential leak "KuSh" discovered using "cppcheck". Fixes #7863.
Daniel Atallah <datallah@pidgin.im>
parents:
24640
diff
changeset
|
758 | |
| 15884 | 759 | plugin_return = GPOINTER_TO_INT(purple_signal_emit_return_1( |
| 760 | purple_conversations_get_handle(), | |
| 11064 | 761 | "chat-invited", account, who, name, message, data)); |
| 1 | 762 | |
| 4487 | 763 | cid->gc = gc; |
| 5234 | 764 | cid->components = data; |
| 1 | 765 | |
| 11064 | 766 | if (plugin_return == 0) |
| 767 | { | |
|
38916
a2c4e6a21e21
Fix potential utf8 truncation on incoming invites (may result in crashes)
dx <dx@dxzone.com.ar>
parents:
37486
diff
changeset
|
768 | char *buf2; |
|
a2c4e6a21e21
Fix potential utf8 truncation on incoming invites (may result in crashes)
dx <dx@dxzone.com.ar>
parents:
37486
diff
changeset
|
769 | |
| 11064 | 770 | if (message != NULL) |
| 771 | { | |
|
38916
a2c4e6a21e21
Fix potential utf8 truncation on incoming invites (may result in crashes)
dx <dx@dxzone.com.ar>
parents:
37486
diff
changeset
|
772 | buf2 = g_strdup_printf( |
| 11064 | 773 | _("%s has invited %s to the chat room %s:\n%s"), |
| 15884 | 774 | who, purple_account_get_username(account), name, message); |
| 11064 | 775 | } |
| 776 | else | |
|
38916
a2c4e6a21e21
Fix potential utf8 truncation on incoming invites (may result in crashes)
dx <dx@dxzone.com.ar>
parents:
37486
diff
changeset
|
777 | buf2 = g_strdup_printf( |
| 11064 | 778 | _("%s has invited %s to the chat room %s\n"), |
| 15884 | 779 | who, purple_account_get_username(account), name); |
| 11064 | 780 | |
| 781 | ||
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
32678
diff
changeset
|
782 | purple_request_accept_cancel(gc, NULL, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
32678
diff
changeset
|
783 | _("Accept chat invitation?"), buf2, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
32678
diff
changeset
|
784 | PURPLE_DEFAULT_ACTION_NONE, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
32678
diff
changeset
|
785 | purple_request_cpar_from_connection(gc), cid, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
32678
diff
changeset
|
786 | G_CALLBACK(chat_invite_accept), |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
32678
diff
changeset
|
787 | G_CALLBACK(chat_invite_reject)); |
|
38916
a2c4e6a21e21
Fix potential utf8 truncation on incoming invites (may result in crashes)
dx <dx@dxzone.com.ar>
parents:
37486
diff
changeset
|
788 | g_free(buf2); |
| 11064 | 789 | } |
| 790 | else if (plugin_return > 0) | |
| 791 | chat_invite_accept(cid); | |
| 792 | else | |
| 793 | chat_invite_reject(cid); | |
| 1 | 794 | } |
| 795 | ||
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
796 | PurpleConversation *purple_serv_got_joined_chat(PurpleConnection *gc, |
|
5630
a05d97d87690
[gaim-migrate @ 6037]
Mark Doliner <markdoliner@pidgin.im>
parents:
5602
diff
changeset
|
797 | int id, const char *name) |
| 1 | 798 | { |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
799 | PurpleConversation *chat; |
| 15884 | 800 | PurpleAccount *account; |
| 1 | 801 | |
| 15884 | 802 | account = purple_connection_get_account(gc); |
| 1 | 803 | |
|
27789
5862eda3c24d
Commit the QQ null chat room name crash on the *right* branch.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
804 | g_return_val_if_fail(account != NULL, NULL); |
|
5862eda3c24d
Commit the QQ null chat room name crash on the *right* branch.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
805 | g_return_val_if_fail(name != NULL, NULL); |
|
5862eda3c24d
Commit the QQ null chat room name crash on the *right* branch.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
806 | |
|
37201
7fb8821cba5f
Backed out 50884c0b222a because it breaks rejoining XMPP MUCs (maybe others) upon reconnection
Kevin Stange <kstange@pidgin.im>
parents:
37193
diff
changeset
|
807 | chat = purple_chat_conversation_new(account, name); |
|
34632
ebe6b2a60305
Changed all arguments and return types of Chat and IMs to PurpleChatConversation and PurpleIMConversation.
Ankit Vani <a@nevitus.org>
parents:
34627
diff
changeset
|
808 | g_return_val_if_fail(chat != NULL, NULL); |
|
27789
5862eda3c24d
Commit the QQ null chat room name crash on the *right* branch.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
809 | |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
810 | if (!g_slist_find(purple_connection_get_active_chats(gc), chat)) |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
811 | _purple_connection_add_active_chat(gc, PURPLE_CHAT_CONVERSATION(chat)); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
812 | |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
813 | purple_chat_conversation_set_id(PURPLE_CHAT_CONVERSATION(chat), id); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
814 | |
|
34632
ebe6b2a60305
Changed all arguments and return types of Chat and IMs to PurpleChatConversation and PurpleIMConversation.
Ankit Vani <a@nevitus.org>
parents:
34627
diff
changeset
|
815 | purple_signal_emit(purple_conversations_get_handle(), "chat-joined", chat); |
|
4476
bf88170ba269
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4440
diff
changeset
|
816 | |
|
34632
ebe6b2a60305
Changed all arguments and return types of Chat and IMs to PurpleChatConversation and PurpleIMConversation.
Ankit Vani <a@nevitus.org>
parents:
34627
diff
changeset
|
817 | return chat; |
| 1 | 818 | } |
| 819 | ||
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
820 | void purple_serv_got_chat_left(PurpleConnection *g, int id) |
| 1 | 821 | { |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
822 | GSList *bcs; |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
823 | PurpleChatConversation *chat = NULL; |
| 1 | 824 | |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
825 | for (bcs = purple_connection_get_active_chats(g); bcs != NULL; bcs = bcs->next) { |
|
35089
c1981c52befb
Do nothing if serv_got_chat_in, serv_got_chat_left are called with non-existant chat ID
Ankit Vani <a@nevitus.org>
parents:
35007
diff
changeset
|
826 | if (purple_chat_conversation_get_id( |
|
c1981c52befb
Do nothing if serv_got_chat_in, serv_got_chat_left are called with non-existant chat ID
Ankit Vani <a@nevitus.org>
parents:
35007
diff
changeset
|
827 | PURPLE_CHAT_CONVERSATION(bcs->data)) == id) { |
|
c1981c52befb
Do nothing if serv_got_chat_in, serv_got_chat_left are called with non-existant chat ID
Ankit Vani <a@nevitus.org>
parents:
35007
diff
changeset
|
828 | chat = (PurpleChatConversation *)bcs->data; |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
829 | break; |
|
35089
c1981c52befb
Do nothing if serv_got_chat_in, serv_got_chat_left are called with non-existant chat ID
Ankit Vani <a@nevitus.org>
parents:
35007
diff
changeset
|
830 | } |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
831 | } |
| 1 | 832 | |
|
35089
c1981c52befb
Do nothing if serv_got_chat_in, serv_got_chat_left are called with non-existant chat ID
Ankit Vani <a@nevitus.org>
parents:
35007
diff
changeset
|
833 | if (!chat) |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
834 | return; |
| 1 | 835 | |
|
40765
a5381c20e802
Use specific purple_debug_* functions
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40710
diff
changeset
|
836 | purple_debug_info("server", "Leaving room: %s", |
|
a5381c20e802
Use specific purple_debug_* functions
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40710
diff
changeset
|
837 | purple_conversation_get_name(PURPLE_CONVERSATION(chat))); |
| 1 | 838 | |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
839 | _purple_connection_remove_active_chat(g, chat); |
| 1 | 840 | |
|
34656
adbcbe04077c
Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34632
diff
changeset
|
841 | purple_chat_conversation_leave(chat); |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12677
diff
changeset
|
842 | |
|
34656
adbcbe04077c
Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34632
diff
changeset
|
843 | purple_signal_emit(purple_conversations_get_handle(), "chat-left", chat); |
| 1 | 844 | } |
| 845 | ||
|
23270
2b7db16e721a
As discussed on the devel list, purple_serv_got_join_chat_failed() and the
Evan Schoenberg <evands@pidgin.im>
parents:
22920
diff
changeset
|
846 | void purple_serv_got_join_chat_failed(PurpleConnection *gc, GHashTable *data) |
|
22920
6681f6f71dfc
applied changes from feb2303b4209e0eeb4e20beaf151b1e4368c4e03
Evan Schoenberg <evands@pidgin.im>
parents:
22919
diff
changeset
|
847 | { |
|
6681f6f71dfc
applied changes from feb2303b4209e0eeb4e20beaf151b1e4368c4e03
Evan Schoenberg <evands@pidgin.im>
parents:
22919
diff
changeset
|
848 | purple_signal_emit(purple_conversations_get_handle(), "chat-join-failed", |
|
23270
2b7db16e721a
As discussed on the devel list, purple_serv_got_join_chat_failed() and the
Evan Schoenberg <evands@pidgin.im>
parents:
22920
diff
changeset
|
849 | gc, data); |
|
22920
6681f6f71dfc
applied changes from feb2303b4209e0eeb4e20beaf151b1e4368c4e03
Evan Schoenberg <evands@pidgin.im>
parents:
22919
diff
changeset
|
850 | } |
|
6681f6f71dfc
applied changes from feb2303b4209e0eeb4e20beaf151b1e4368c4e03
Evan Schoenberg <evands@pidgin.im>
parents:
22919
diff
changeset
|
851 | |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
852 | void purple_serv_got_chat_in(PurpleConnection *g, int id, const char *who, |
| 15884 | 853 | PurpleMessageFlags flags, const char *message, time_t mtime) |
| 1 | 854 | { |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
855 | GSList *bcs; |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
856 | PurpleChatConversation *chat = NULL; |
| 3163 | 857 | char *buffy, *angel; |
| 858 | int plugin_return; | |
|
36088
4c386387f6f3
Switch purple_conversation_write_message to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36078
diff
changeset
|
859 | PurpleMessage *pmsg; |
| 1 | 860 | |
|
12894
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
861 | g_return_if_fail(who != NULL); |
|
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
862 | g_return_if_fail(message != NULL); |
|
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
863 | |
|
35252
852014ae74a0
Fix a remotely-triggerable null pointer dereference.
Mark Doliner <mark@kingant.net>
parents:
28880
diff
changeset
|
864 | if (mtime < 0) { |
|
852014ae74a0
Fix a remotely-triggerable null pointer dereference.
Mark Doliner <mark@kingant.net>
parents:
28880
diff
changeset
|
865 | purple_debug_error("server", |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
866 | "purple_serv_got_chat_in ignoring negative timestamp\n"); |
|
35252
852014ae74a0
Fix a remotely-triggerable null pointer dereference.
Mark Doliner <mark@kingant.net>
parents:
28880
diff
changeset
|
867 | /* 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
|
868 | 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
|
869 | mtime = time(NULL); |
|
852014ae74a0
Fix a remotely-triggerable null pointer dereference.
Mark Doliner <mark@kingant.net>
parents:
28880
diff
changeset
|
870 | } |
|
852014ae74a0
Fix a remotely-triggerable null pointer dereference.
Mark Doliner <mark@kingant.net>
parents:
28880
diff
changeset
|
871 | |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
872 | for (bcs = purple_connection_get_active_chats(g); bcs != NULL; bcs = bcs->next) { |
|
35089
c1981c52befb
Do nothing if serv_got_chat_in, serv_got_chat_left are called with non-existant chat ID
Ankit Vani <a@nevitus.org>
parents:
35007
diff
changeset
|
873 | if (purple_chat_conversation_get_id( |
|
c1981c52befb
Do nothing if serv_got_chat_in, serv_got_chat_left are called with non-existant chat ID
Ankit Vani <a@nevitus.org>
parents:
35007
diff
changeset
|
874 | PURPLE_CHAT_CONVERSATION(bcs->data)) == id) { |
|
c1981c52befb
Do nothing if serv_got_chat_in, serv_got_chat_left are called with non-existant chat ID
Ankit Vani <a@nevitus.org>
parents:
35007
diff
changeset
|
875 | chat = (PurpleChatConversation *)bcs->data; |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
876 | break; |
|
35089
c1981c52befb
Do nothing if serv_got_chat_in, serv_got_chat_left are called with non-existant chat ID
Ankit Vani <a@nevitus.org>
parents:
35007
diff
changeset
|
877 | } |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
878 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
879 | |
|
35089
c1981c52befb
Do nothing if serv_got_chat_in, serv_got_chat_left are called with non-existant chat ID
Ankit Vani <a@nevitus.org>
parents:
35007
diff
changeset
|
880 | if (!chat) |
|
1100
efc7d10c7826
[gaim-migrate @ 1110]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1089
diff
changeset
|
881 | return; |
|
391
677e4414a83f
[gaim-migrate @ 401]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
368
diff
changeset
|
882 | |
|
25721
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
883 | /* Did I send the message? */ |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
884 | if (purple_strequal(purple_chat_conversation_get_nick(chat), |
|
34656
adbcbe04077c
Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34632
diff
changeset
|
885 | purple_normalize(purple_conversation_get_account( |
|
adbcbe04077c
Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34632
diff
changeset
|
886 | PURPLE_CONVERSATION(chat)), who))) { |
|
25721
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
887 | flags |= PURPLE_MESSAGE_SEND; |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36630
diff
changeset
|
888 | flags &= ~PURPLE_MESSAGE_RECV; /* Just in case some protocol sets it! */ |
|
25721
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
889 | } else { |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
890 | flags |= PURPLE_MESSAGE_RECV; |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
891 | } |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
892 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
893 | /* |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
894 | * 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
|
895 | * 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
|
896 | */ |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
897 | buffy = g_strdup(message); |
| 3163 | 898 | angel = g_strdup(who); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
899 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
900 | plugin_return = GPOINTER_TO_INT( |
| 15884 | 901 | purple_signal_emit_return_1(purple_conversations_get_handle(), |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
902 | "receiving-chat-msg", purple_connection_get_account(g), |
|
34656
adbcbe04077c
Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34632
diff
changeset
|
903 | &angel, &buffy, chat, &flags)); |
| 3163 | 904 | |
| 905 | if (!buffy || !angel || plugin_return) { | |
|
12894
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
906 | g_free(buffy); |
|
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
907 | g_free(angel); |
|
2372
c24942700dfd
[gaim-migrate @ 2385]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2359
diff
changeset
|
908 | return; |
| 3163 | 909 | } |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
910 | |
| 3163 | 911 | who = angel; |
| 912 | message = buffy; | |
| 1 | 913 | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
914 | purple_signal_emit(purple_conversations_get_handle(), "received-chat-msg", purple_connection_get_account(g), |
|
34656
adbcbe04077c
Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34632
diff
changeset
|
915 | who, message, chat, flags); |
| 8999 | 916 | |
|
40541
9ceb8d25d4d9
PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
917 | if (flags & PURPLE_MESSAGE_RECV) { |
|
36108
69b4fce85ffa
Switch _purple_conversation_write_common and (writing|wrote)-(chat|im)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36098
diff
changeset
|
918 | pmsg = purple_message_new_incoming(who, message, flags, mtime); |
|
40541
9ceb8d25d4d9
PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
919 | } else { |
|
9ceb8d25d4d9
PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
920 | PurpleAccount *account = purple_connection_get_account(g); |
|
9ceb8d25d4d9
PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
921 | GDateTime *dt = g_date_time_new_from_unix_local((gint64)mtime); |
|
9ceb8d25d4d9
PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
922 | const gchar *me = purple_account_get_name_for_display(account); |
|
9ceb8d25d4d9
PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
923 | |
|
9ceb8d25d4d9
PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
924 | pmsg = purple_message_new_outgoing(me, who, message, flags); |
|
9ceb8d25d4d9
PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
925 | purple_message_set_timestamp(pmsg, dt); |
|
9ceb8d25d4d9
PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
926 | g_date_time_unref(dt); |
|
36108
69b4fce85ffa
Switch _purple_conversation_write_common and (writing|wrote)-(chat|im)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36098
diff
changeset
|
927 | } |
|
36088
4c386387f6f3
Switch purple_conversation_write_message to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36078
diff
changeset
|
928 | purple_conversation_write_message(PURPLE_CONVERSATION(chat), pmsg); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
929 | |
| 6350 | 930 | g_free(angel); |
|
6062
a292fd631fdb
[gaim-migrate @ 6512]
Mark Doliner <markdoliner@pidgin.im>
parents:
6059
diff
changeset
|
931 | g_free(buffy); |
|
40541
9ceb8d25d4d9
PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
932 | |
|
9ceb8d25d4d9
PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
933 | g_object_unref(G_OBJECT(pmsg)); |
| 1 | 934 | } |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9453
diff
changeset
|
935 | |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
936 | void purple_serv_send_file(PurpleConnection *gc, const char *who, const char *file) |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9453
diff
changeset
|
937 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
938 | PurpleProtocol *protocol; |
|
10751
e15f4f5927ce
[gaim-migrate @ 12354]
Mark Doliner <markdoliner@pidgin.im>
parents:
10745
diff
changeset
|
939 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
940 | if (gc) { |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
941 | protocol = purple_connection_get_protocol(gc); |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9453
diff
changeset
|
942 | |
|
38827
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38433
diff
changeset
|
943 | if(PURPLE_IS_PROTOCOL_XFER(protocol)) { |
|
38835
737f25ddbf02
A bunch more work on this, still have jabber to update and more unit tests to write
Gary Kramlich <grim@reaperworld.com>
parents:
38827
diff
changeset
|
944 | PurpleProtocolXfer *xfer = PURPLE_PROTOCOL_XFER(protocol); |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9453
diff
changeset
|
945 | |
|
38835
737f25ddbf02
A bunch more work on this, still have jabber to update and more unit tests to write
Gary Kramlich <grim@reaperworld.com>
parents:
38827
diff
changeset
|
946 | if(purple_protocol_xfer_can_receive(xfer, gc, who)) { |
|
39005
6a56e1366809
xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38929
diff
changeset
|
947 | purple_protocol_xfer_send_file(xfer, |
|
6a56e1366809
xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38929
diff
changeset
|
948 | gc, who, file); |
|
38827
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38433
diff
changeset
|
949 | } |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38433
diff
changeset
|
950 | } |
|
9647
7ae5b5933b5a
[gaim-migrate @ 10495]
Daniel Atallah <datallah@pidgin.im>
parents:
9620
diff
changeset
|
951 | } |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9453
diff
changeset
|
952 | } |