Sat, 09 Aug 2008 02:24:38 +0000
propagate from branch 'im.pidgin.pidgin' (head 0cff24bf7dbab39c8efd9ae15752966bda375780)
to branch 'im.pidgin.soc.2008.vv' (head 7647c0dcf202ccea4fa139cc734aeffb143254b5)
| 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 | ||
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
26 | #include "internal.h" |
|
9944
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9933
diff
changeset
|
27 | #include "blist.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
28 | #include "conversation.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
29 | #include "debug.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
30 | #include "log.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" |
| 12849 | 33 | #include "privacy.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
34 | #include "prpl.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
35 | #include "request.h" |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
36 | #include "signals.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
37 | #include "server.h" |
|
9944
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9933
diff
changeset
|
38 | #include "status.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
39 | #include "util.h" |
|
23704
9b88c9b23aed
Use USE_VV instead of USE_FARSIGHT.
Michael Ruprecht <maiku@pidgin.im>
parents:
23700
diff
changeset
|
40 | #ifdef USE_VV |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22474
diff
changeset
|
41 | #include "media.h" |
|
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22474
diff
changeset
|
42 | #endif |
| 1 | 43 | |
|
8948
a5ec0dd1f46c
[gaim-migrate @ 9720]
Mark Doliner <markdoliner@pidgin.im>
parents:
8904
diff
changeset
|
44 | #define SECS_BEFORE_RESENDING_AUTORESPONSE 600 |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9237
diff
changeset
|
45 | #define SEX_BEFORE_RESENDING_AUTORESPONSE "Only after you're married" |
|
8948
a5ec0dd1f46c
[gaim-migrate @ 9720]
Mark Doliner <markdoliner@pidgin.im>
parents:
8904
diff
changeset
|
46 | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
47 | unsigned int |
| 15884 | 48 | serv_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state) |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
49 | { |
|
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
|
50 | PurplePlugin *prpl = NULL; |
| 15884 | 51 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
52 | |
|
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
|
53 | if(gc) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
54 | prpl = purple_connection_get_prpl(gc); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
55 | |
|
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
|
56 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
57 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
58 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
59 | if(prpl_info && prpl_info->send_typing) |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
60 | return prpl_info->send_typing(gc, name, state); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
61 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
62 | return 0; |
| 2993 | 63 | } |
| 1 | 64 | |
|
10871
c0282a4f2250
[gaim-migrate @ 12558]
Mark Doliner <markdoliner@pidgin.im>
parents:
10853
diff
changeset
|
65 | static GSList *last_auto_responses = NULL; |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
66 | struct last_auto_response { |
| 15884 | 67 | PurpleConnection *gc; |
|
3815
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
68 | char name[80]; |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
69 | time_t sent; |
|
3815
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
70 | }; |
|
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
71 | |
|
10850
6889f793b918
[gaim-migrate @ 12522]
Mark Doliner <markdoliner@pidgin.im>
parents:
10827
diff
changeset
|
72 | static gboolean |
|
6889f793b918
[gaim-migrate @ 12522]
Mark Doliner <markdoliner@pidgin.im>
parents:
10827
diff
changeset
|
73 | expire_last_auto_responses(gpointer data) |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
74 | { |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
75 | GSList *tmp, *cur; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
76 | struct last_auto_response *lar; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
77 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
78 | tmp = last_auto_responses; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
79 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
80 | while (tmp) { |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
81 | cur = tmp; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
82 | tmp = tmp->next; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
83 | lar = (struct last_auto_response *)cur->data; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
84 | |
|
8948
a5ec0dd1f46c
[gaim-migrate @ 9720]
Mark Doliner <markdoliner@pidgin.im>
parents:
8904
diff
changeset
|
85 | if ((time(NULL) - lar->sent) > SECS_BEFORE_RESENDING_AUTORESPONSE) { |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
86 | last_auto_responses = g_slist_remove(last_auto_responses, lar); |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
87 | g_free(lar); |
|
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 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
91 | return FALSE; /* do not run again */ |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
92 | } |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
93 | |
|
10850
6889f793b918
[gaim-migrate @ 12522]
Mark Doliner <markdoliner@pidgin.im>
parents:
10827
diff
changeset
|
94 | static struct last_auto_response * |
| 15884 | 95 | get_last_auto_response(PurpleConnection *gc, const char *name) |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
96 | { |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
97 | GSList *tmp; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
98 | struct last_auto_response *lar; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
99 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
100 | /* because we're modifying or creating a lar, schedule the |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
101 | * function to expire them as the pref dictates */ |
|
18068
b6554e3c8224
merge of '1442df274a24edc9a31194327bd00dfbcf478720'
Richard Laager <rlaager@pidgin.im>
diff
changeset
|
102 | purple_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
|
103 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
104 | tmp = last_auto_responses; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
105 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
106 | while (tmp) { |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
107 | lar = (struct last_auto_response *)tmp->data; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
108 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
109 | if (gc == lar->gc && !strncmp(name, lar->name, sizeof(lar->name))) |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
110 | return lar; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
111 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
112 | tmp = tmp->next; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
113 | } |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
114 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
115 | lar = (struct last_auto_response *)g_new0(struct last_auto_response, 1); |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
116 | g_snprintf(lar->name, sizeof(lar->name), "%s", name); |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
117 | lar->gc = gc; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
118 | lar->sent = 0; |
|
13791
df2a8738c602
[gaim-migrate @ 16201]
Richard Laager <rlaager@pidgin.im>
parents:
13664
diff
changeset
|
119 | last_auto_responses = g_slist_prepend(last_auto_responses, lar); |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
120 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
121 | return lar; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
122 | } |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
123 | |
| 15884 | 124 | int serv_send_im(PurpleConnection *gc, const char *name, const char *message, |
| 125 | PurpleMessageFlags flags) | |
| 1 | 126 | { |
|
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
|
127 | PurpleConversation *conv = NULL; |
|
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 | PurpleAccount *account = NULL; |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
129 | PurplePresence *presence = NULL; |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
130 | PurplePlugin *prpl = NULL; |
|
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 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
2123
4cfdde0aa3f1
[gaim-migrate @ 2133]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2108
diff
changeset
|
132 | 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
|
133 | const gchar *auto_reply_pref = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
134 | |
|
13422
0221ca926ebe
[gaim-migrate @ 15796]
Richard Laager <rlaager@pidgin.im>
parents:
13418
diff
changeset
|
135 | g_return_val_if_fail(gc != NULL, val); |
|
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
|
136 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
137 | prpl = purple_connection_get_prpl(gc); |
|
13422
0221ca926ebe
[gaim-migrate @ 15796]
Richard Laager <rlaager@pidgin.im>
parents:
13418
diff
changeset
|
138 | |
|
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
|
139 | g_return_val_if_fail(prpl != NULL, val); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
140 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
141 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
142 | |
| 15884 | 143 | account = purple_connection_get_account(gc); |
| 144 | presence = purple_account_get_presence(account); | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
145 | |
|
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
|
146 | conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, account); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
147 | |
|
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
|
148 | if(prpl_info && prpl_info->send_im) |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12116
diff
changeset
|
149 | val = prpl_info->send_im(gc, name, message, flags); |
|
94
0c6ba3d3fa90
[gaim-migrate @ 104]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
79
diff
changeset
|
150 | |
|
9594
7a1f902b9494
[gaim-migrate @ 10437]
Mark Doliner <markdoliner@pidgin.im>
parents:
9584
diff
changeset
|
151 | /* |
|
7a1f902b9494
[gaim-migrate @ 10437]
Mark Doliner <markdoliner@pidgin.im>
parents:
9584
diff
changeset
|
152 | * 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
|
153 | * this only reset lar->sent if we're away AND idle? |
|
7a1f902b9494
[gaim-migrate @ 10437]
Mark Doliner <markdoliner@pidgin.im>
parents:
9584
diff
changeset
|
154 | */ |
|
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
|
155 | auto_reply_pref = purple_prefs_get_string("/purple/away/auto_reply"); |
|
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
|
156 | if((gc->flags & PURPLE_CONNECTION_AUTO_RESP) && |
| 15884 | 157 | !purple_presence_is_available(presence) && |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
158 | strcmp(auto_reply_pref, "never")) { |
|
5545
a8b1a1262402
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
159 | |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
160 | struct last_auto_response *lar; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
161 | lar = get_last_auto_response(gc, name); |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
162 | lar->sent = time(NULL); |
|
3815
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
163 | } |
|
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
164 | |
|
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
|
165 | if(conv && purple_conv_im_get_send_typed_timeout(PURPLE_CONV_IM(conv))) |
| 15884 | 166 | purple_conv_im_stop_send_typed_timeout(PURPLE_CONV_IM(conv)); |
| 3601 | 167 | |
|
2123
4cfdde0aa3f1
[gaim-migrate @ 2133]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2108
diff
changeset
|
168 | return val; |
| 1 | 169 | } |
| 170 | ||
| 15884 | 171 | void serv_get_info(PurpleConnection *gc, const char *name) |
| 1 | 172 | { |
|
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
|
173 | PurplePlugin *prpl = NULL; |
| 15884 | 174 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
175 | |
|
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
|
176 | if(gc) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
177 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
178 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
179 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
180 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
181 | |
|
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
|
182 | if(gc && prpl_info && prpl_info->get_info) |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9237
diff
changeset
|
183 | prpl_info->get_info(gc, name); |
|
249
14b7e4f943ff
[gaim-migrate @ 259]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
248
diff
changeset
|
184 | } |
|
14b7e4f943ff
[gaim-migrate @ 259]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
248
diff
changeset
|
185 | |
| 15884 | 186 | void serv_set_info(PurpleConnection *gc, const char *info) |
| 1 | 187 | { |
|
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
|
188 | PurplePlugin *prpl = NULL; |
| 15884 | 189 | PurplePluginProtocolInfo *prpl_info = 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
|
190 | PurpleAccount *account = NULL;; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
191 | |
|
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
|
192 | if(gc) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
193 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
194 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
195 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
196 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
197 | |
|
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
|
198 | if(prpl_info && prpl_info->set_info) { |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
199 | |
| 15884 | 200 | account = purple_connection_get_account(gc); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
201 | |
|
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
|
202 | if(purple_signal_emit_return_1(purple_accounts_get_handle(), |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
203 | "account-setting-info", account, info)) |
| 3456 | 204 | return; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
205 | |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9237
diff
changeset
|
206 | prpl_info->set_info(gc, info); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
207 | |
| 15884 | 208 | purple_signal_emit(purple_accounts_get_handle(), |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
209 | "account-set-info", account, info); |
| 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 | */ | |
| 15884 | 216 | void serv_alias_buddy(PurpleBuddy *b) |
| 3136 | 217 | { |
|
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
|
218 | PurpleAccount *account = NULL; |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
219 | PurpleConnection *gc = NULL; |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
220 | PurplePlugin *prpl = NULL; |
| 15884 | 221 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
222 | |
|
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 | if(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 | 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
|
225 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
226 | if(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
|
227 | gc = purple_account_get_connection(account); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
228 | |
|
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
|
229 | if(gc) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
230 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
231 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
232 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
233 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
234 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
235 | if(b && prpl_info && prpl_info->alias_buddy) { |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
236 | prpl_info->alias_buddy(gc, b->name, b->alias); |
| 3136 | 237 | } |
| 238 | } | |
| 239 | ||
| 9135 | 240 | void |
| 15884 | 241 | serv_got_alias(PurpleConnection *gc, const char *who, const char *alias) |
| 9135 | 242 | { |
|
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
|
243 | PurpleAccount *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
|
244 | GSList *buddies; |
| 15884 | 245 | PurpleBuddy *b; |
| 246 | PurpleConversation *conv; | |
|
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); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
249 | buddies = purple_find_buddies(account, who); |
|
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 | |
|
16863
b98303c15033
Change a few functions to free a linked list while iterating through
Mark Doliner <markdoliner@pidgin.im>
parents:
16795
diff
changeset
|
251 | while (buddies != NULL) |
| 9135 | 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 | 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
|
254 | 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
|
255 | |
|
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
|
256 | if((b->server_alias == NULL && alias == NULL) || |
|
14558
41176168ddab
[gaim-migrate @ 17215]
Richard Laager <rlaager@pidgin.im>
parents:
14546
diff
changeset
|
257 | (b->server_alias && alias && !strcmp(b->server_alias, alias))) |
|
41176168ddab
[gaim-migrate @ 17215]
Richard Laager <rlaager@pidgin.im>
parents:
14546
diff
changeset
|
258 | { |
| 14546 | 259 | continue; |
|
14558
41176168ddab
[gaim-migrate @ 17215]
Richard Laager <rlaager@pidgin.im>
parents:
14546
diff
changeset
|
260 | } |
|
16863
b98303c15033
Change a few functions to free a linked list while iterating through
Mark Doliner <markdoliner@pidgin.im>
parents:
16795
diff
changeset
|
261 | |
| 15884 | 262 | purple_blist_server_alias_buddy(b, alias); |
| 9135 | 263 | |
| 15884 | 264 | conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, b->name, account); |
|
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
|
265 | if(conv != NULL && alias != NULL && strcmp(alias, who)) |
| 9135 | 266 | { |
| 267 | char *tmp = g_strdup_printf(_("%s is now known as %s.\n"), | |
| 268 | who, alias); | |
| 269 | ||
| 18090 | 270 | purple_conversation_write(conv, NULL, tmp, |
| 271 | PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, | |
| 272 | time(NULL)); | |
| 9135 | 273 | |
| 274 | g_free(tmp); | |
| 275 | } | |
| 8870 | 276 | } |
| 4227 | 277 | } |
| 278 | ||
|
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
|
279 | 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
|
280 | 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
|
281 | { |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
282 | 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
|
283 | 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
|
284 | 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
|
285 | |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
286 | account = purple_connection_get_account(gc); |
|
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 | buddies = purple_find_buddies(account, who); |
|
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 | |
|
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 | while(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
|
290 | 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
|
291 | |
|
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 | 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
|
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 | if((!b->alias && !alias) || (b->alias && alias && !strcmp(b->alias, 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
|
295 | 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
|
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 | purple_blist_alias_buddy(b, 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
|
298 | } |
|
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 | } |
|
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 | |
|
19639
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
302 | PurpleAttentionType *purple_get_attention_type_from_code(PurpleAccount *account, guint type_code) |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
303 | { |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
304 | PurplePlugin *prpl; |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
305 | PurpleAttentionType* attn; |
|
19641
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
306 | GList *(*get_attention_types)(PurpleAccount *); |
|
19639
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
307 | |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
308 | g_return_val_if_fail(account != NULL, NULL); |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
309 | |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
310 | prpl = purple_find_prpl(purple_account_get_protocol_id(account)); |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
311 | |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
312 | /* Lookup the attention type in the protocol's attention_types list, if any. */ |
|
19911
da84d233133e
Change attention_types to get_attention_types so this will compile.
Richard Laager <rlaager@pidgin.im>
parents:
19908
diff
changeset
|
313 | get_attention_types = PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->get_attention_types; |
|
19641
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
314 | if (get_attention_types) { |
|
19639
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
315 | GList *attention_types; |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
316 | |
|
19641
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
317 | attention_types = get_attention_types(account); |
|
19639
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
318 | attn = (PurpleAttentionType *)g_list_nth_data(attention_types, type_code); |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
319 | } else { |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
320 | attn = NULL; |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
321 | } |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
322 | |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
323 | return attn; |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
324 | } |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
325 | |
|
19604
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
326 | void |
|
19639
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
327 | serv_send_attention(PurpleConnection *gc, const char *who, guint type_code) |
|
19604
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
328 | { |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23523
diff
changeset
|
329 | purple_prpl_send_attention(gc, who, type_code); |
|
19639
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
330 | } |
|
19604
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
331 | |
|
19639
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
332 | void |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
333 | serv_got_attention(PurpleConnection *gc, const char *who, guint type_code) |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
334 | { |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23523
diff
changeset
|
335 | purple_prpl_got_attention(gc, who, type_code); |
|
19604
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
336 | } |
|
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
337 | |
|
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
338 | |
| 3136 | 339 | /* |
| 340 | * Move a buddy from one group to another on server. | |
| 341 | * | |
| 342 | * 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
|
343 | * it should be possible. Probably needs to be done, someday. Although, |
| 15884 | 344 | * the UI for that would be difficult, because groups are Purple-wide. |
| 3136 | 345 | */ |
| 15884 | 346 | void serv_move_buddy(PurpleBuddy *b, PurpleGroup *og, PurpleGroup *ng) |
| 3136 | 347 | { |
|
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
|
348 | PurpleAccount *account = NULL; |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
349 | PurpleConnection *gc = NULL; |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
350 | PurplePlugin *prpl = NULL; |
| 15884 | 351 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
352 | |
|
13418
676c3eb505dc
[gaim-migrate @ 15792]
Richard Laager <rlaager@pidgin.im>
parents:
13294
diff
changeset
|
353 | g_return_if_fail(b != NULL); |
|
676c3eb505dc
[gaim-migrate @ 15792]
Richard Laager <rlaager@pidgin.im>
parents:
13294
diff
changeset
|
354 | g_return_if_fail(og != NULL); |
|
676c3eb505dc
[gaim-migrate @ 15792]
Richard Laager <rlaager@pidgin.im>
parents:
13294
diff
changeset
|
355 | g_return_if_fail(ng != NULL); |
|
676c3eb505dc
[gaim-migrate @ 15792]
Richard Laager <rlaager@pidgin.im>
parents:
13294
diff
changeset
|
356 | |
|
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
|
357 | 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
|
358 | 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
|
359 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
360 | if(gc) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
361 | prpl = purple_connection_get_prpl(gc); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
362 | |
|
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
|
363 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
364 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
365 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
366 | if(gc && og && ng) { |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
367 | if (prpl_info && prpl_info->group_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
|
368 | prpl_info->group_buddy(gc, b->name, og->name, ng->name); |
| 3136 | 369 | } |
| 370 | } | |
| 371 | } | |
| 372 | ||
|
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
|
373 | void serv_add_permit(PurpleConnection *gc, const char *name) |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
374 | { |
|
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
|
375 | PurplePlugin *prpl = NULL; |
| 15884 | 376 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
377 | |
|
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
|
378 | if(gc) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
379 | prpl = purple_connection_get_prpl(gc); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
380 | |
|
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
|
381 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
382 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
383 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
384 | if(prpl_info && prpl_info->add_permit) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
385 | prpl_info->add_permit(gc, name); |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
386 | } |
|
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
387 | |
|
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
|
388 | void serv_add_deny(PurpleConnection *gc, const char *name) |
| 1 | 389 | { |
|
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
|
390 | PurplePlugin *prpl = NULL; |
| 15884 | 391 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
392 | |
|
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
|
393 | if(gc) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
394 | prpl = purple_connection_get_prpl(gc); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
395 | |
|
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
|
396 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
397 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
398 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
399 | if(prpl_info && prpl_info->add_deny) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
400 | prpl_info->add_deny(gc, name); |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
401 | } |
|
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
402 | |
|
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
|
403 | void serv_rem_permit(PurpleConnection *gc, const char *name) |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
404 | { |
|
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
|
405 | PurplePlugin *prpl = NULL; |
| 15884 | 406 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
407 | |
|
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
|
408 | if(gc) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
409 | prpl = purple_connection_get_prpl(gc); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
410 | |
|
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
|
411 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
412 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
413 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
414 | if(prpl_info && prpl_info->rem_permit) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
415 | prpl_info->rem_permit(gc, name); |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
416 | } |
| 1 | 417 | |
|
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
|
418 | void serv_rem_deny(PurpleConnection *gc, const char *name) |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
419 | { |
|
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
|
420 | PurplePlugin *prpl = NULL; |
| 15884 | 421 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
422 | |
|
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
|
423 | if(gc) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
424 | prpl = purple_connection_get_prpl(gc); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
425 | |
|
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
|
426 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
427 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
428 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
429 | if(prpl_info && prpl_info->rem_deny) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
430 | prpl_info->rem_deny(gc, name); |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
431 | } |
|
678
6e2cb341573a
[gaim-migrate @ 688]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
660
diff
changeset
|
432 | |
|
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
|
433 | void serv_set_permit_deny(PurpleConnection *gc) |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
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 | PurplePlugin *prpl = NULL; |
| 15884 | 436 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
437 | |
|
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
|
438 | if(gc) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
439 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
440 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
441 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
442 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
443 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
444 | /* |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
445 | * this is called when either you import a buddy list, and make lots |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
446 | * of changes that way, or when the user toggles the permit/deny mode |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
447 | * in the prefs. In either case you should probably be resetting and |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
448 | * resending the permit/deny info when you get this. |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
449 | */ |
|
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
|
450 | if(prpl_info && prpl_info->set_permit_deny) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
451 | prpl_info->set_permit_deny(gc); |
| 1 | 452 | } |
| 453 | ||
|
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
|
454 | void serv_join_chat(PurpleConnection *gc, GHashTable *data) |
| 1 | 455 | { |
|
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
|
456 | PurplePlugin *prpl = NULL; |
| 15884 | 457 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
458 | |
|
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
|
459 | if(gc) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
460 | prpl = purple_connection_get_prpl(gc); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
461 | |
|
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
|
462 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
463 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
464 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
465 | if(prpl_info && prpl_info->join_chat) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
466 | prpl_info->join_chat(gc, data); |
| 1 | 467 | } |
| 468 | ||
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
469 | |
|
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 | void serv_reject_chat(PurpleConnection *gc, GHashTable *data) |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
471 | { |
|
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
|
472 | PurplePlugin *prpl = NULL; |
| 15884 | 473 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
474 | |
|
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
|
475 | if(gc) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
476 | prpl = purple_connection_get_prpl(gc); |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
477 | |
|
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
|
478 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
479 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
480 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
481 | if(prpl_info && prpl_info->reject_chat) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
482 | prpl_info->reject_chat(gc, data); |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
483 | } |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
484 | |
|
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
|
485 | void serv_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name) |
| 1 | 486 | { |
|
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
|
487 | PurplePlugin *prpl = NULL; |
| 15884 | 488 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 489 | PurpleConversation *conv; | |
|
2359
27c1207ca513
[gaim-migrate @ 2372]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2345
diff
changeset
|
490 | char *buffy = message && *message ? g_strdup(message) : NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
491 | |
|
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
|
492 | conv = purple_find_chat(gc, id); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
493 | |
|
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
|
494 | if(conv == NULL) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
495 | return; |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
496 | |
|
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
|
497 | if(gc) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
498 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
499 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
500 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
501 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
502 | |
| 15884 | 503 | purple_signal_emit(purple_conversations_get_handle(), "chat-inviting-user", |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
504 | conv, name, &buffy); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
505 | |
|
14669
df3f48ab4aff
[gaim-migrate @ 17335]
Mark Doliner <markdoliner@pidgin.im>
parents:
14558
diff
changeset
|
506 | if (prpl_info && prpl_info->chat_invite) |
|
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
|
507 | prpl_info->chat_invite(gc, id, buffy, name); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
508 | |
| 15884 | 509 | purple_signal_emit(purple_conversations_get_handle(), "chat-invited-user", |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
510 | conv, name, buffy); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
511 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13995
diff
changeset
|
512 | g_free(buffy); |
| 1 | 513 | } |
| 514 | ||
| 15884 | 515 | /* Ya know, nothing uses this except purple_conversation_destroy(), |
| 8256 | 516 | * I think I'll just merge it into that later... |
| 517 | * Then again, something might want to use this, from outside prpl-land | |
| 518 | * to leave a chat without destroying the conversation. | |
| 519 | */ | |
| 520 | ||
|
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
|
521 | void serv_chat_leave(PurpleConnection *gc, int id) |
| 1 | 522 | { |
|
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
|
523 | PurplePlugin *prpl = NULL; |
| 15884 | 524 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
525 | |
|
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
|
526 | prpl = purple_connection_get_prpl(gc); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
527 | |
|
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
|
528 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
529 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
530 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
531 | if(prpl_info && prpl_info->chat_leave) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
532 | prpl_info->chat_leave(gc, id); |
| 1 | 533 | } |
| 534 | ||
|
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
|
535 | void serv_chat_whisper(PurpleConnection *gc, int id, const char *who, const char *message) |
| 1 | 536 | { |
|
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
|
537 | PurplePlugin *prpl = NULL; |
| 15884 | 538 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
539 | |
|
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
|
540 | if(gc) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
541 | prpl = purple_connection_get_prpl(gc); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
542 | |
|
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
|
543 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
544 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
545 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
546 | if(prpl_info && prpl_info->chat_whisper) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
547 | prpl_info->chat_whisper(gc, id, who, message); |
| 1 | 548 | } |
| 549 | ||
| 15884 | 550 | int serv_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) |
| 1 | 551 | { |
|
2167
cbb558585911
[gaim-migrate @ 2177]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2131
diff
changeset
|
552 | 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
|
553 | PurplePlugin *prpl = NULL; |
| 15884 | 554 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
555 | |
|
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
|
556 | prpl = purple_connection_get_prpl(gc); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
557 | |
|
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
|
558 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
559 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
560 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
561 | if(prpl_info && prpl_info->chat_send) |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12116
diff
changeset
|
562 | val = prpl_info->chat_send(gc, id, message, flags); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
563 | |
|
2167
cbb558585911
[gaim-migrate @ 2177]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2131
diff
changeset
|
564 | return val; |
| 1 | 565 | } |
| 566 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
567 | /* |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
568 | * 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
|
569 | * sure to follow along, kids |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
570 | */ |
| 15884 | 571 | void serv_got_im(PurpleConnection *gc, const char *who, const char *msg, |
| 572 | PurpleMessageFlags flags, time_t mtime) | |
| 1 | 573 | { |
| 15884 | 574 | PurpleAccount *account; |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
575 | PurpleConversation *conv; |
| 5136 | 576 | char *message, *name; |
|
6622
277eb0b14653
[gaim-migrate @ 7146]
Robert McQueen <robot101@debian.org>
parents:
6621
diff
changeset
|
577 | char *angel, *buffy; |
|
277eb0b14653
[gaim-migrate @ 7146]
Robert McQueen <robot101@debian.org>
parents:
6621
diff
changeset
|
578 | int plugin_return; |
|
2273
b7c08d737d81
[gaim-migrate @ 2283]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2231
diff
changeset
|
579 | |
|
11903
56ae8af14a0d
[gaim-migrate @ 14194]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11818
diff
changeset
|
580 | g_return_if_fail(msg != NULL); |
|
56ae8af14a0d
[gaim-migrate @ 14194]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11818
diff
changeset
|
581 | |
| 15884 | 582 | account = purple_connection_get_account(gc); |
| 12849 | 583 | |
|
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
|
584 | if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->set_permit_deny == NULL) { |
| 12849 | 585 | /* protocol does not support privacy, handle it ourselves */ |
|
23312
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23270
diff
changeset
|
586 | if (!purple_privacy_check(account, who)) { |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23270
diff
changeset
|
587 | purple_signal_emit(purple_conversations_get_handle(), "blocked-im-msg", |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23270
diff
changeset
|
588 | account, who, msg, flags, (unsigned int)mtime); |
| 12849 | 589 | return; |
|
23312
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23270
diff
changeset
|
590 | } |
| 12849 | 591 | } |
| 592 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
593 | /* |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
594 | * We should update the conversation window buttons and menu, |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
595 | * if it exists. |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
596 | */ |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
597 | conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, gc->account); |
|
2106
ecd1bec6376c
[gaim-migrate @ 2116]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2104
diff
changeset
|
598 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
599 | /* |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
600 | * Make copies of the message and the sender in case plugins want |
|
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
601 | * to free these strings and replace them with a modifed version. |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
602 | */ |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
603 | buffy = g_strdup(msg); |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
604 | angel = g_strdup(who); |
| 1339 | 605 | |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
606 | plugin_return = GPOINTER_TO_INT( |
| 15884 | 607 | purple_signal_emit_return_1(purple_conversations_get_handle(), |
| 8999 | 608 | "receiving-im-msg", gc->account, |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
609 | &angel, &buffy, conv, &flags)); |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
610 | |
|
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
611 | if (!buffy || !angel || plugin_return) { |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13995
diff
changeset
|
612 | g_free(buffy); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13995
diff
changeset
|
613 | g_free(angel); |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
614 | return; |
|
1100
efc7d10c7826
[gaim-migrate @ 1110]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1089
diff
changeset
|
615 | } |
| 8619 | 616 | |
| 8999 | 617 | name = angel; |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
618 | message = buffy; |
|
2104
8d12ab6f798c
[gaim-migrate @ 2114]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2090
diff
changeset
|
619 | |
| 15884 | 620 | purple_signal_emit(purple_conversations_get_handle(), "received-im-msg", gc->account, |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
621 | name, message, conv, flags); |
| 8999 | 622 | |
|
12288
d3452b226853
[gaim-migrate @ 14592]
Casey Harkins <charkins@pidgin.im>
parents:
12281
diff
changeset
|
623 | /* search for conversation again in case it was created by received-im-msg handler */ |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
624 | if (conv == NULL) |
|
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
625 | conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); |
|
12288
d3452b226853
[gaim-migrate @ 14592]
Casey Harkins <charkins@pidgin.im>
parents:
12281
diff
changeset
|
626 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
627 | /* |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12116
diff
changeset
|
628 | * XXX: Should we be setting this here, or relying on prpls to set it? |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
629 | */ |
| 15884 | 630 | flags |= PURPLE_MESSAGE_RECV; |
| 1 | 631 | |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
632 | if (conv == NULL) |
|
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
633 | conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
634 | |
|
22790
48f95ffaed17
Pass something useful as the 'who' parameter to purple_conv_im_write for
Will Thompson <resiak@pidgin.im>
parents:
22474
diff
changeset
|
635 | purple_conv_im_write(PURPLE_CONV_IM(conv), name, message, flags, mtime); |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
636 | g_free(message); |
|
12116
17bf39d2678f
[gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents:
12114
diff
changeset
|
637 | |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
638 | /* |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
639 | * Don't autorespond if: |
|
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 | * - it's not supported on this connection |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
642 | * - we are available |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
643 | * - or it's disabled |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
644 | * - 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
|
645 | * is set |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
646 | */ |
| 15884 | 647 | if (gc->flags & PURPLE_CONNECTION_AUTO_RESP) |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
648 | { |
| 15884 | 649 | PurplePresence *presence; |
| 650 | PurpleStatus *status; | |
| 651 | PurpleStatusType *status_type; | |
| 652 | PurpleStatusPrimitive primitive; | |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
653 | const gchar *auto_reply_pref; |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
654 | 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
|
655 | gboolean mobile = FALSE; |
|
1775
16de02b8c378
[gaim-migrate @ 1785]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1774
diff
changeset
|
656 | |
|
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
|
657 | 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
|
658 | |
| 15884 | 659 | presence = purple_account_get_presence(account); |
| 660 | status = purple_presence_get_active_status(presence); | |
| 661 | status_type = purple_status_get_type(status); | |
| 662 | 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
|
663 | mobile = purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOBILE); |
| 15884 | 664 | if ((primitive == PURPLE_STATUS_AVAILABLE) || |
| 665 | (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
|
666 | mobile || |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
667 | !strcmp(auto_reply_pref, "never") || |
| 15884 | 668 | (!purple_presence_is_idle(presence) && !strcmp(auto_reply_pref, "awayidle"))) |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
669 | { |
|
2104
8d12ab6f798c
[gaim-migrate @ 2114]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2090
diff
changeset
|
670 | g_free(name); |
|
1775
16de02b8c378
[gaim-migrate @ 1785]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1774
diff
changeset
|
671 | return; |
|
2104
8d12ab6f798c
[gaim-migrate @ 2114]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2090
diff
changeset
|
672 | } |
|
1775
16de02b8c378
[gaim-migrate @ 1785]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1774
diff
changeset
|
673 | |
| 15884 | 674 | away_msg = purple_value_get_string( |
| 675 | purple_status_get_attr_value(status, "message")); | |
|
1775
16de02b8c378
[gaim-migrate @ 1785]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1774
diff
changeset
|
676 | |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
677 | if ((away_msg != NULL) && (*away_msg != '\0')) { |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
678 | struct last_auto_response *lar; |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
679 | time_t now = time(NULL); |
|
10052
329dad7e2da3
[gaim-migrate @ 11013]
Dave West <kat@users.sourceforge.net>
parents:
10011
diff
changeset
|
680 | |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
681 | /* |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
682 | * 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
|
683 | * 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
|
684 | * 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
|
685 | * 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
|
686 | * 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
|
687 | * 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
|
688 | * if necessary. |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
689 | */ |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
690 | lar = get_last_auto_response(gc, name); |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
691 | if ((now - lar->sent) >= SECS_BEFORE_RESENDING_AUTORESPONSE) |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
692 | { |
|
13995
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
693 | /* |
|
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
694 | * 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
|
695 | * 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
|
696 | * _next_ message, so we still set lar->sent to now. |
|
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
697 | */ |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
698 | lar->sent = now; |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13995
diff
changeset
|
699 | |
| 15884 | 700 | if (!(flags & PURPLE_MESSAGE_AUTO_RESP)) |
|
13995
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
701 | { |
| 15884 | 702 | serv_send_im(gc, name, away_msg, PURPLE_MESSAGE_AUTO_RESP); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
703 | |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
704 | purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, away_msg, |
| 15884 | 705 | PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_AUTO_RESP, |
|
13995
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
706 | mtime); |
|
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
707 | } |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
708 | } |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
709 | } |
| 1 | 710 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
711 | |
|
2104
8d12ab6f798c
[gaim-migrate @ 2114]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2090
diff
changeset
|
712 | g_free(name); |
| 1 | 713 | } |
| 714 | ||
| 15884 | 715 | void serv_got_typing(PurpleConnection *gc, const char *name, int timeout, |
| 716 | PurpleTypingState state) { | |
| 717 | PurpleConversation *conv; | |
| 718 | PurpleConvIm *im = NULL; | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
719 | |
| 15884 | 720 | conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); |
|
11706
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
721 | if (conv != NULL) { |
| 15884 | 722 | im = PURPLE_CONV_IM(conv); |
|
5032
2276c67b0243
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
723 | |
| 15884 | 724 | purple_conv_im_set_typing_state(im, state); |
| 725 | purple_conv_im_update_typing(im); | |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12677
diff
changeset
|
726 | } 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
|
727 | switch (state) |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12677
diff
changeset
|
728 | { |
|
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
|
729 | case PURPLE_TYPING: |
|
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
|
730 | purple_signal_emit(purple_conversations_get_handle(), |
|
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
|
731 | "buddy-typing", gc->account, name); |
|
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
|
732 | break; |
|
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
|
733 | case PURPLE_TYPED: |
|
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
|
734 | purple_signal_emit(purple_conversations_get_handle(), |
|
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
|
735 | "buddy-typed", gc->account, name); |
|
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
|
736 | break; |
|
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
|
737 | case PURPLE_NOT_TYPING: |
|
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
|
738 | purple_signal_emit(purple_conversations_get_handle(), |
|
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
|
739 | "buddy-typing-stopped", gc->account, name); |
|
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
|
740 | break; |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12677
diff
changeset
|
741 | } |
|
11706
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
742 | } |
|
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
743 | |
|
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
744 | if (conv != NULL && timeout > 0) |
| 15884 | 745 | purple_conv_im_start_typing_timeout(im, timeout); |
| 2993 | 746 | } |
| 1 | 747 | |
| 15884 | 748 | void serv_got_typing_stopped(PurpleConnection *gc, const char *name) { |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
749 | |
| 15884 | 750 | PurpleConversation *conv; |
| 751 | PurpleConvIm *im; | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
752 | |
| 15884 | 753 | conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); |
|
11706
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
754 | if (conv != NULL) |
|
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
755 | { |
| 15884 | 756 | im = PURPLE_CONV_IM(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
757 | |
| 15884 | 758 | if (im->typing_state == PURPLE_NOT_TYPING) |
|
11706
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
759 | return; |
|
5032
2276c67b0243
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
760 | |
| 15884 | 761 | purple_conv_im_stop_typing_timeout(im); |
| 762 | purple_conv_im_set_typing_state(im, PURPLE_NOT_TYPING); | |
| 763 | purple_conv_im_update_typing(im); | |
|
11706
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
764 | } |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
765 | else |
|
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
766 | { |
| 15884 | 767 | purple_signal_emit(purple_conversations_get_handle(), |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
768 | "buddy-typing-stopped", gc->account, name); |
|
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
769 | } |
| 2993 | 770 | } |
| 1 | 771 | |
| 4487 | 772 | struct chat_invite_data { |
| 15884 | 773 | PurpleConnection *gc; |
| 5234 | 774 | GHashTable *components; |
| 4487 | 775 | }; |
| 1723 | 776 | |
| 4487 | 777 | static void chat_invite_data_free(struct chat_invite_data *cid) |
| 1 | 778 | { |
| 5234 | 779 | if (cid->components) |
| 780 | g_hash_table_destroy(cid->components); | |
| 4487 | 781 | g_free(cid); |
| 782 | } | |
| 1723 | 783 | |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
784 | |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
785 | static void chat_invite_reject(struct chat_invite_data *cid) |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
786 | { |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
787 | serv_reject_chat(cid->gc, cid->components); |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
788 | chat_invite_data_free(cid); |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
789 | } |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
790 | |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
791 | |
| 4487 | 792 | static void chat_invite_accept(struct chat_invite_data *cid) |
| 793 | { | |
| 5234 | 794 | serv_join_chat(cid->gc, cid->components); |
| 4487 | 795 | chat_invite_data_free(cid); |
| 1 | 796 | } |
| 797 | ||
| 798 | ||
| 799 | ||
| 15884 | 800 | void serv_got_chat_invite(PurpleConnection *gc, const char *name, |
|
5630
a05d97d87690
[gaim-migrate @ 6037]
Mark Doliner <markdoliner@pidgin.im>
parents:
5602
diff
changeset
|
801 | const char *who, const char *message, GHashTable *data) |
| 1 | 802 | { |
| 15884 | 803 | PurpleAccount *account; |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
804 | char buf2[BUF_LONG]; |
| 4487 | 805 | struct chat_invite_data *cid = g_new0(struct chat_invite_data, 1); |
| 11064 | 806 | int plugin_return; |
| 1 | 807 | |
| 15884 | 808 | account = purple_connection_get_account(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
|
809 | if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->set_permit_deny == NULL) { |
| 12849 | 810 | /* protocol does not support privacy, handle it ourselves */ |
|
23312
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23270
diff
changeset
|
811 | if (!purple_privacy_check(account, who)) { |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23270
diff
changeset
|
812 | purple_signal_emit(purple_conversations_get_handle(), "chat-invite-blocked", |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23270
diff
changeset
|
813 | account, who, name, message, data); |
| 12849 | 814 | return; |
|
23312
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23270
diff
changeset
|
815 | } |
| 12849 | 816 | } |
| 1 | 817 | |
| 15884 | 818 | plugin_return = GPOINTER_TO_INT(purple_signal_emit_return_1( |
| 819 | purple_conversations_get_handle(), | |
| 11064 | 820 | "chat-invited", account, who, name, message, data)); |
| 1 | 821 | |
| 4487 | 822 | cid->gc = gc; |
| 5234 | 823 | cid->components = data; |
| 1 | 824 | |
| 11064 | 825 | if (plugin_return == 0) |
| 826 | { | |
| 827 | if (message != NULL) | |
| 828 | { | |
| 829 | g_snprintf(buf2, sizeof(buf2), | |
| 830 | _("%s has invited %s to the chat room %s:\n%s"), | |
| 15884 | 831 | who, purple_account_get_username(account), name, message); |
| 11064 | 832 | } |
| 833 | else | |
| 834 | g_snprintf(buf2, sizeof(buf2), | |
| 835 | _("%s has invited %s to the chat room %s\n"), | |
| 15884 | 836 | who, purple_account_get_username(account), name); |
| 11064 | 837 | |
| 838 | ||
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
839 | purple_request_accept_cancel(gc, NULL, _("Accept chat invitation?"), buf2, |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16478
diff
changeset
|
840 | PURPLE_DEFAULT_ACTION_NONE, account, who, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
841 | cid, G_CALLBACK(chat_invite_accept), |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
842 | G_CALLBACK(chat_invite_reject)); |
| 11064 | 843 | } |
| 844 | else if (plugin_return > 0) | |
| 845 | chat_invite_accept(cid); | |
| 846 | else | |
| 847 | chat_invite_reject(cid); | |
| 1 | 848 | } |
| 849 | ||
| 15884 | 850 | PurpleConversation *serv_got_joined_chat(PurpleConnection *gc, |
|
5630
a05d97d87690
[gaim-migrate @ 6037]
Mark Doliner <markdoliner@pidgin.im>
parents:
5602
diff
changeset
|
851 | int id, const char *name) |
| 1 | 852 | { |
| 15884 | 853 | PurpleConversation *conv; |
| 854 | PurpleConvChat *chat; | |
| 855 | PurpleAccount *account; | |
| 1 | 856 | |
| 15884 | 857 | account = purple_connection_get_account(gc); |
| 1 | 858 | |
| 15884 | 859 | conv = purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name); |
| 860 | chat = PURPLE_CONV_CHAT(conv); | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
861 | |
| 8256 | 862 | if (!g_slist_find(gc->buddy_chats, conv)) |
| 863 | gc->buddy_chats = g_slist_append(gc->buddy_chats, conv); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
864 | |
| 15884 | 865 | purple_conv_chat_set_id(chat, id); |
|
4476
bf88170ba269
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4440
diff
changeset
|
866 | |
| 15884 | 867 | purple_signal_emit(purple_conversations_get_handle(), "chat-joined", conv); |
| 3710 | 868 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
869 | return conv; |
| 1 | 870 | } |
| 871 | ||
| 15884 | 872 | void serv_got_chat_left(PurpleConnection *g, int id) |
| 1 | 873 | { |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
874 | GSList *bcs; |
| 15884 | 875 | PurpleConversation *conv = NULL; |
| 876 | PurpleConvChat *chat = NULL; | |
| 1 | 877 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
878 | for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { |
| 15884 | 879 | conv = (PurpleConversation *)bcs->data; |
| 1 | 880 | |
| 15884 | 881 | chat = PURPLE_CONV_CHAT(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
882 | |
| 15884 | 883 | if (purple_conv_chat_get_id(chat) == id) |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
884 | break; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
885 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
886 | conv = NULL; |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
887 | } |
| 1 | 888 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
889 | if (!conv) |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
890 | return; |
| 1 | 891 | |
| 15884 | 892 | purple_debug(PURPLE_DEBUG_INFO, "server", "Leaving room: %s\n", |
| 893 | purple_conversation_get_name(conv)); | |
| 1 | 894 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
895 | g->buddy_chats = g_slist_remove(g->buddy_chats, conv); |
| 1 | 896 | |
| 15884 | 897 | purple_conv_chat_left(PURPLE_CONV_CHAT(conv)); |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12677
diff
changeset
|
898 | |
| 15884 | 899 | purple_signal_emit(purple_conversations_get_handle(), "chat-left", conv); |
| 1 | 900 | } |
| 901 | ||
|
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
|
902 | 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
|
903 | { |
|
6681f6f71dfc
applied changes from feb2303b4209e0eeb4e20beaf151b1e4368c4e03
Evan Schoenberg <evands@pidgin.im>
parents:
22919
diff
changeset
|
904 | 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
|
905 | gc, data); |
|
22920
6681f6f71dfc
applied changes from feb2303b4209e0eeb4e20beaf151b1e4368c4e03
Evan Schoenberg <evands@pidgin.im>
parents:
22919
diff
changeset
|
906 | } |
|
6681f6f71dfc
applied changes from feb2303b4209e0eeb4e20beaf151b1e4368c4e03
Evan Schoenberg <evands@pidgin.im>
parents:
22919
diff
changeset
|
907 | |
| 15884 | 908 | void serv_got_chat_in(PurpleConnection *g, int id, const char *who, |
| 909 | PurpleMessageFlags flags, const char *message, time_t mtime) | |
| 1 | 910 | { |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
911 | GSList *bcs; |
| 15884 | 912 | PurpleConversation *conv = NULL; |
| 913 | PurpleConvChat *chat = NULL; | |
| 3163 | 914 | char *buffy, *angel; |
| 915 | int plugin_return; | |
| 1 | 916 | |
|
12894
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
917 | g_return_if_fail(who != NULL); |
|
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
918 | g_return_if_fail(message != NULL); |
|
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
919 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
920 | for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { |
| 15884 | 921 | conv = (PurpleConversation *)bcs->data; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
922 | |
| 15884 | 923 | chat = PURPLE_CONV_CHAT(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
924 | |
| 15884 | 925 | if (purple_conv_chat_get_id(chat) == id) |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
926 | break; |
| 1 | 927 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
928 | conv = NULL; |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
929 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
930 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
931 | if (!conv) |
|
1100
efc7d10c7826
[gaim-migrate @ 1110]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1089
diff
changeset
|
932 | return; |
|
391
677e4414a83f
[gaim-migrate @ 401]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
368
diff
changeset
|
933 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
934 | /* |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
935 | * Make copies of the message and the sender in case plugins want |
|
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
936 | * to free these strings and replace them with a modifed version. |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
937 | */ |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
938 | buffy = g_strdup(message); |
| 3163 | 939 | angel = g_strdup(who); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
940 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
941 | plugin_return = GPOINTER_TO_INT( |
| 15884 | 942 | purple_signal_emit_return_1(purple_conversations_get_handle(), |
| 8999 | 943 | "receiving-chat-msg", g->account, |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12116
diff
changeset
|
944 | &angel, &buffy, conv, &flags)); |
| 3163 | 945 | |
| 946 | if (!buffy || !angel || plugin_return) { | |
|
12894
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
947 | g_free(buffy); |
|
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
948 | g_free(angel); |
|
2372
c24942700dfd
[gaim-migrate @ 2385]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2359
diff
changeset
|
949 | return; |
| 3163 | 950 | } |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
951 | |
| 3163 | 952 | who = angel; |
| 953 | message = buffy; | |
| 1 | 954 | |
| 15884 | 955 | purple_signal_emit(purple_conversations_get_handle(), "received-chat-msg", g->account, |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12116
diff
changeset
|
956 | who, message, conv, flags); |
| 8999 | 957 | |
| 15884 | 958 | purple_conv_chat_write(chat, who, message, flags, mtime); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
959 | |
| 6350 | 960 | g_free(angel); |
|
6062
a292fd631fdb
[gaim-migrate @ 6512]
Mark Doliner <markdoliner@pidgin.im>
parents:
6059
diff
changeset
|
961 | g_free(buffy); |
| 1 | 962 | } |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9453
diff
changeset
|
963 | |
| 15884 | 964 | void 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
|
965 | { |
|
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
|
966 | PurplePlugin *prpl = NULL; |
| 15884 | 967 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
10751
e15f4f5927ce
[gaim-migrate @ 12354]
Mark Doliner <markdoliner@pidgin.im>
parents:
10745
diff
changeset
|
968 | |
|
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
|
969 | if(gc) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
970 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
971 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
972 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
973 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9453
diff
changeset
|
974 | |
|
9647
7ae5b5933b5a
[gaim-migrate @ 10495]
Daniel Atallah <datallah@pidgin.im>
parents:
9620
diff
changeset
|
975 | if (prpl_info && prpl_info->send_file) { |
|
7ae5b5933b5a
[gaim-migrate @ 10495]
Daniel Atallah <datallah@pidgin.im>
parents:
9620
diff
changeset
|
976 | if (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who)) { |
|
7ae5b5933b5a
[gaim-migrate @ 10495]
Daniel Atallah <datallah@pidgin.im>
parents:
9620
diff
changeset
|
977 | prpl_info->send_file(gc, who, file); |
|
7ae5b5933b5a
[gaim-migrate @ 10495]
Daniel Atallah <datallah@pidgin.im>
parents:
9620
diff
changeset
|
978 | } |
|
7ae5b5933b5a
[gaim-migrate @ 10495]
Daniel Atallah <datallah@pidgin.im>
parents:
9620
diff
changeset
|
979 | } |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9453
diff
changeset
|
980 | } |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22474
diff
changeset
|
981 |