Mon, 01 Oct 2007 21:25:18 +0000
merge of '2a1e61ae4a0491e4906ffc58a5d4c01f406b5a61'
and '933b5898de30964f6fd69cbb3c5bbf029db95405'
| 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" |
| 1 | 40 | |
|
8948
a5ec0dd1f46c
[gaim-migrate @ 9720]
Mark Doliner <markdoliner@pidgin.im>
parents:
8904
diff
changeset
|
41 | #define SECS_BEFORE_RESENDING_AUTORESPONSE 600 |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9237
diff
changeset
|
42 | #define SEX_BEFORE_RESENDING_AUTORESPONSE "Only after you're married" |
|
8948
a5ec0dd1f46c
[gaim-migrate @ 9720]
Mark Doliner <markdoliner@pidgin.im>
parents:
8904
diff
changeset
|
43 | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
44 | unsigned int |
| 15884 | 45 | serv_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state) |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
46 | { |
| 15884 | 47 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
48 | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
49 | if (gc != NULL && gc->prpl != NULL) |
| 15884 | 50 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
51 | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
52 | if (prpl_info && prpl_info->send_typing) |
|
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
53 | return prpl_info->send_typing(gc, name, state); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
54 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
55 | return 0; |
| 2993 | 56 | } |
| 1 | 57 | |
|
10871
c0282a4f2250
[gaim-migrate @ 12558]
Mark Doliner <markdoliner@pidgin.im>
parents:
10853
diff
changeset
|
58 | static GSList *last_auto_responses = NULL; |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
59 | struct last_auto_response { |
| 15884 | 60 | PurpleConnection *gc; |
|
3815
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
61 | char name[80]; |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
62 | time_t sent; |
|
3815
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
63 | }; |
|
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
64 | |
|
10850
6889f793b918
[gaim-migrate @ 12522]
Mark Doliner <markdoliner@pidgin.im>
parents:
10827
diff
changeset
|
65 | static gboolean |
|
6889f793b918
[gaim-migrate @ 12522]
Mark Doliner <markdoliner@pidgin.im>
parents:
10827
diff
changeset
|
66 | expire_last_auto_responses(gpointer data) |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
67 | { |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
68 | GSList *tmp, *cur; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
69 | struct last_auto_response *lar; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
70 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
71 | tmp = last_auto_responses; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
72 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
73 | while (tmp) { |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
74 | cur = tmp; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
75 | tmp = tmp->next; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
76 | lar = (struct last_auto_response *)cur->data; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
77 | |
|
8948
a5ec0dd1f46c
[gaim-migrate @ 9720]
Mark Doliner <markdoliner@pidgin.im>
parents:
8904
diff
changeset
|
78 | if ((time(NULL) - lar->sent) > SECS_BEFORE_RESENDING_AUTORESPONSE) { |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
79 | last_auto_responses = g_slist_remove(last_auto_responses, lar); |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
80 | g_free(lar); |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
81 | } |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
82 | } |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
83 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
84 | return FALSE; /* do not run again */ |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
85 | } |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
86 | |
|
10850
6889f793b918
[gaim-migrate @ 12522]
Mark Doliner <markdoliner@pidgin.im>
parents:
10827
diff
changeset
|
87 | static struct last_auto_response * |
| 15884 | 88 | get_last_auto_response(PurpleConnection *gc, const char *name) |
|
6479
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 | GSList *tmp; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
91 | struct last_auto_response *lar; |
|
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 | /* because we're modifying or creating a lar, schedule the |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
94 | * function to expire them as the pref dictates */ |
|
18068
b6554e3c8224
merge of '1442df274a24edc9a31194327bd00dfbcf478720'
Richard Laager <rlaager@pidgin.im>
diff
changeset
|
95 | 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
|
96 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
97 | tmp = last_auto_responses; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
98 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
99 | while (tmp) { |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
100 | lar = (struct last_auto_response *)tmp->data; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
101 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
102 | if (gc == lar->gc && !strncmp(name, lar->name, sizeof(lar->name))) |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
103 | return lar; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
104 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
105 | tmp = tmp->next; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
106 | } |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
107 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
108 | 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
|
109 | g_snprintf(lar->name, sizeof(lar->name), "%s", name); |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
110 | lar->gc = gc; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
111 | lar->sent = 0; |
|
13791
df2a8738c602
[gaim-migrate @ 16201]
Richard Laager <rlaager@pidgin.im>
parents:
13664
diff
changeset
|
112 | last_auto_responses = g_slist_prepend(last_auto_responses, lar); |
|
6479
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 | return lar; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
115 | } |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
116 | |
| 15884 | 117 | int serv_send_im(PurpleConnection *gc, const char *name, const char *message, |
| 118 | PurpleMessageFlags flags) | |
| 1 | 119 | { |
| 15884 | 120 | PurpleConversation *conv; |
| 121 | PurpleAccount *account; | |
| 122 | PurplePresence *presence; | |
| 123 | PurplePluginProtocolInfo *prpl_info; | |
|
2123
4cfdde0aa3f1
[gaim-migrate @ 2133]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2108
diff
changeset
|
124 | int val = -EINVAL; |
|
9594
7a1f902b9494
[gaim-migrate @ 10437]
Mark Doliner <markdoliner@pidgin.im>
parents:
9584
diff
changeset
|
125 | const gchar *auto_reply_pref; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
126 | |
|
13422
0221ca926ebe
[gaim-migrate @ 15796]
Richard Laager <rlaager@pidgin.im>
parents:
13418
diff
changeset
|
127 | g_return_val_if_fail(gc != NULL, val); |
|
0221ca926ebe
[gaim-migrate @ 15796]
Richard Laager <rlaager@pidgin.im>
parents:
13418
diff
changeset
|
128 | g_return_val_if_fail(gc->prpl != NULL, val); |
|
0221ca926ebe
[gaim-migrate @ 15796]
Richard Laager <rlaager@pidgin.im>
parents:
13418
diff
changeset
|
129 | |
| 15884 | 130 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
131 | |
| 15884 | 132 | account = purple_connection_get_account(gc); |
| 133 | presence = purple_account_get_presence(account); | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
134 | |
| 15884 | 135 | conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
136 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
137 | if (prpl_info && prpl_info->send_im) |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12116
diff
changeset
|
138 | val = prpl_info->send_im(gc, name, message, flags); |
|
94
0c6ba3d3fa90
[gaim-migrate @ 104]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
79
diff
changeset
|
139 | |
|
9594
7a1f902b9494
[gaim-migrate @ 10437]
Mark Doliner <markdoliner@pidgin.im>
parents:
9584
diff
changeset
|
140 | /* |
|
7a1f902b9494
[gaim-migrate @ 10437]
Mark Doliner <markdoliner@pidgin.im>
parents:
9584
diff
changeset
|
141 | * 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
|
142 | * this only reset lar->sent if we're away AND idle? |
|
7a1f902b9494
[gaim-migrate @ 10437]
Mark Doliner <markdoliner@pidgin.im>
parents:
9584
diff
changeset
|
143 | */ |
|
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
|
144 | auto_reply_pref = purple_prefs_get_string("/purple/away/auto_reply"); |
| 15884 | 145 | if ((gc->flags & PURPLE_CONNECTION_AUTO_RESP) && |
|
20326
8b1622442951
Only keep track of sent auto-responses in determining whether to send an auto-response. This will keep people who have had a conversation and then set themselves away from getting confused and thinking it doesn't work
Sean Egan <seanegan@pidgin.im>
parents:
19916
diff
changeset
|
146 | flags & PURPLE_MESSAGE_AUTO_RESP && |
| 15884 | 147 | !purple_presence_is_available(presence) && |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
148 | strcmp(auto_reply_pref, "never")) { |
|
5545
a8b1a1262402
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
149 | |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
150 | struct last_auto_response *lar; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
151 | lar = get_last_auto_response(gc, name); |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
152 | lar->sent = time(NULL); |
|
3815
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
153 | } |
|
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
154 | |
| 15884 | 155 | if (conv && purple_conv_im_get_send_typed_timeout(PURPLE_CONV_IM(conv))) |
| 156 | purple_conv_im_stop_send_typed_timeout(PURPLE_CONV_IM(conv)); | |
| 3601 | 157 | |
|
2123
4cfdde0aa3f1
[gaim-migrate @ 2133]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2108
diff
changeset
|
158 | return val; |
| 1 | 159 | } |
| 160 | ||
| 15884 | 161 | void serv_get_info(PurpleConnection *gc, const char *name) |
| 1 | 162 | { |
| 15884 | 163 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
164 | |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9237
diff
changeset
|
165 | if (gc != NULL && gc->prpl != NULL) |
| 15884 | 166 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
167 | |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9237
diff
changeset
|
168 | if (gc && prpl_info && prpl_info->get_info) |
|
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9237
diff
changeset
|
169 | prpl_info->get_info(gc, name); |
|
249
14b7e4f943ff
[gaim-migrate @ 259]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
248
diff
changeset
|
170 | } |
|
14b7e4f943ff
[gaim-migrate @ 259]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
248
diff
changeset
|
171 | |
| 15884 | 172 | void serv_set_info(PurpleConnection *gc, const char *info) |
| 1 | 173 | { |
| 15884 | 174 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 175 | PurpleAccount *account; | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
176 | |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9237
diff
changeset
|
177 | if (gc != NULL && gc->prpl != NULL) |
| 15884 | 178 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
179 | |
|
14669
df3f48ab4aff
[gaim-migrate @ 17335]
Mark Doliner <markdoliner@pidgin.im>
parents:
14558
diff
changeset
|
180 | if (prpl_info && prpl_info->set_info) { |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
181 | |
| 15884 | 182 | account = purple_connection_get_account(gc); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
183 | |
| 15884 | 184 | if (purple_signal_emit_return_1(purple_accounts_get_handle(), |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
185 | "account-setting-info", account, info)) |
| 3456 | 186 | return; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
187 | |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9237
diff
changeset
|
188 | prpl_info->set_info(gc, info); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
189 | |
| 15884 | 190 | purple_signal_emit(purple_accounts_get_handle(), |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
191 | "account-set-info", account, info); |
| 1749 | 192 | } |
|
237
83ff5f92ee7e
[gaim-migrate @ 247]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
200
diff
changeset
|
193 | } |
|
83ff5f92ee7e
[gaim-migrate @ 247]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
200
diff
changeset
|
194 | |
| 3136 | 195 | /* |
| 196 | * Set buddy's alias on server roster/list | |
| 197 | */ | |
| 15884 | 198 | void serv_alias_buddy(PurpleBuddy *b) |
| 3136 | 199 | { |
| 15884 | 200 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
201 | |
|
18311
ff92c7760d60
Fix a crash when trying to alias someone from the tab-label on a disconnected
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18090
diff
changeset
|
202 | if (b != NULL && b->account->gc && b->account->gc->prpl != NULL) |
| 15884 | 203 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(b->account->gc->prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
204 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
205 | if (b && prpl_info && prpl_info->alias_buddy) { |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
206 | prpl_info->alias_buddy(b->account->gc, b->name, b->alias); |
| 3136 | 207 | } |
| 208 | } | |
| 209 | ||
| 9135 | 210 | void |
| 15884 | 211 | serv_got_alias(PurpleConnection *gc, const char *who, const char *alias) |
| 9135 | 212 | { |
| 15884 | 213 | PurpleAccount *account = purple_connection_get_account(gc); |
|
16863
b98303c15033
Change a few functions to free a linked list while iterating through
Mark Doliner <markdoliner@pidgin.im>
parents:
16795
diff
changeset
|
214 | GSList *buddies = purple_find_buddies(account, who); |
| 15884 | 215 | PurpleBuddy *b; |
| 216 | PurpleConversation *conv; | |
|
6058
0d5c66a5da5d
[gaim-migrate @ 6508]
Mark Doliner <markdoliner@pidgin.im>
parents:
6019
diff
changeset
|
217 | |
|
16863
b98303c15033
Change a few functions to free a linked list while iterating through
Mark Doliner <markdoliner@pidgin.im>
parents:
16795
diff
changeset
|
218 | while (buddies != NULL) |
| 9135 | 219 | { |
|
16863
b98303c15033
Change a few functions to free a linked list while iterating through
Mark Doliner <markdoliner@pidgin.im>
parents:
16795
diff
changeset
|
220 | 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
|
221 | 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
|
222 | |
|
14558
41176168ddab
[gaim-migrate @ 17215]
Richard Laager <rlaager@pidgin.im>
parents:
14546
diff
changeset
|
223 | if ((b->server_alias == NULL && alias == NULL) || |
|
41176168ddab
[gaim-migrate @ 17215]
Richard Laager <rlaager@pidgin.im>
parents:
14546
diff
changeset
|
224 | (b->server_alias && alias && !strcmp(b->server_alias, alias))) |
|
41176168ddab
[gaim-migrate @ 17215]
Richard Laager <rlaager@pidgin.im>
parents:
14546
diff
changeset
|
225 | { |
| 14546 | 226 | continue; |
|
14558
41176168ddab
[gaim-migrate @ 17215]
Richard Laager <rlaager@pidgin.im>
parents:
14546
diff
changeset
|
227 | } |
|
16863
b98303c15033
Change a few functions to free a linked list while iterating through
Mark Doliner <markdoliner@pidgin.im>
parents:
16795
diff
changeset
|
228 | |
| 15884 | 229 | purple_blist_server_alias_buddy(b, alias); |
| 9135 | 230 | |
| 15884 | 231 | conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, b->name, account); |
|
15699
7c290d5f0c14
Suppress name changed messages when it would print 'X is now known as X' ('evands@pidgin.im is now known as evands@pidgin.im')
Evan Schoenberg <evands@pidgin.im>
parents:
15640
diff
changeset
|
232 | if (conv != NULL && alias != NULL && strcmp(alias, who)) |
| 9135 | 233 | { |
| 234 | char *tmp = g_strdup_printf(_("%s is now known as %s.\n"), | |
| 235 | who, alias); | |
| 236 | ||
| 18090 | 237 | purple_conversation_write(conv, NULL, tmp, |
| 238 | PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, | |
| 239 | time(NULL)); | |
| 9135 | 240 | |
| 241 | g_free(tmp); | |
| 242 | } | |
| 8870 | 243 | } |
| 4227 | 244 | } |
| 245 | ||
|
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
|
246 | 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
|
247 | { |
|
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
|
248 | 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
|
249 | 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
|
250 | 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
|
251 | |
|
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
|
252 | 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
|
253 | |
|
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
|
254 | 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
|
255 | |
|
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
|
256 | /* 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
|
257 | 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
|
258 | 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
|
259 | 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
|
260 | |
|
19641
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
261 | 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
|
262 | 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
|
263 | } 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
|
264 | 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
|
265 | } |
|
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
|
266 | |
|
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
|
267 | 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
|
268 | } |
|
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
|
269 | |
|
19604
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
270 | 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
|
271 | 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
|
272 | { |
|
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
|
273 | PurpleAttentionType *attn; |
|
19604
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
274 | PurpleMessageFlags flags; |
|
19641
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
275 | PurplePlugin *prpl; |
|
19673
c8c2b91016f3
Don't trigger 'receiving-' and 'received-' signals when sending attention request.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19641
diff
changeset
|
276 | PurpleConversation *conv; |
|
19641
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
277 | gboolean (*send_attention)(PurpleConnection *, const char *, guint); |
|
19916
9ab6412cffaf
Take aliases into account for the attention messages.
Richard Laager <rlaager@pidgin.im>
parents:
19911
diff
changeset
|
278 | PurpleBuddy *buddy; |
|
9ab6412cffaf
Take aliases into account for the attention messages.
Richard Laager <rlaager@pidgin.im>
parents:
19911
diff
changeset
|
279 | const char *alias; |
|
19604
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
280 | gchar *description; |
|
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
|
281 | time_t mtime; |
|
19604
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
282 | |
|
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
|
283 | g_return_if_fail(gc != 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
|
284 | g_return_if_fail(who != 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
|
285 | |
|
19641
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
286 | prpl = purple_find_prpl(purple_account_get_protocol_id(gc->account)); |
|
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
287 | send_attention = PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention; |
|
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
288 | g_return_if_fail(send_attention != NULL); |
|
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
289 | |
|
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
|
290 | mtime = time(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
|
291 | |
|
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
|
292 | attn = purple_get_attention_type_from_code(gc->account, type_code); |
|
19604
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
293 | |
|
19916
9ab6412cffaf
Take aliases into account for the attention messages.
Richard Laager <rlaager@pidgin.im>
parents:
19911
diff
changeset
|
294 | if ((buddy = purple_find_buddy(purple_connection_get_account(gc), who)) != NULL) |
|
9ab6412cffaf
Take aliases into account for the attention messages.
Richard Laager <rlaager@pidgin.im>
parents:
19911
diff
changeset
|
295 | alias = purple_buddy_get_contact_alias(buddy); |
|
9ab6412cffaf
Take aliases into account for the attention messages.
Richard Laager <rlaager@pidgin.im>
parents:
19911
diff
changeset
|
296 | else |
|
9ab6412cffaf
Take aliases into account for the attention messages.
Richard Laager <rlaager@pidgin.im>
parents:
19911
diff
changeset
|
297 | alias = who; |
|
9ab6412cffaf
Take aliases into account for the attention messages.
Richard Laager <rlaager@pidgin.im>
parents:
19911
diff
changeset
|
298 | |
|
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
|
299 | if (attn && attn->outgoing_description) { |
|
19916
9ab6412cffaf
Take aliases into account for the attention messages.
Richard Laager <rlaager@pidgin.im>
parents:
19911
diff
changeset
|
300 | description = g_strdup_printf(attn->outgoing_description, alias); |
|
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
|
301 | } else { |
|
19916
9ab6412cffaf
Take aliases into account for the attention messages.
Richard Laager <rlaager@pidgin.im>
parents:
19911
diff
changeset
|
302 | description = g_strdup_printf(_("Requesting %s's attention..."), alias); |
|
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
|
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 | |
|
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 | flags = PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_SYSTEM; |
|
19604
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
306 | |
|
19641
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
307 | purple_debug_info("server", "serv_send_attention: sending '%s' to %s\n", |
|
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
308 | description, who); |
|
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
309 | |
|
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
310 | if (!send_attention(gc, who, type_code)) |
|
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
311 | return; |
|
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
312 | |
|
19673
c8c2b91016f3
Don't trigger 'receiving-' and 'received-' signals when sending attention request.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19641
diff
changeset
|
313 | conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, gc->account, who); |
|
c8c2b91016f3
Don't trigger 'receiving-' and 'received-' signals when sending attention request.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19641
diff
changeset
|
314 | purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, description, flags, mtime); |
|
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 | |
|
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 | g_free(description); |
|
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
|
317 | } |
|
19604
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
318 | |
|
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
|
319 | 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
|
320 | 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
|
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 | PurpleMessageFlags flags; |
|
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 | PurpleAttentionType *attn; |
|
19916
9ab6412cffaf
Take aliases into account for the attention messages.
Richard Laager <rlaager@pidgin.im>
parents:
19911
diff
changeset
|
324 | PurpleBuddy *buddy; |
|
9ab6412cffaf
Take aliases into account for the attention messages.
Richard Laager <rlaager@pidgin.im>
parents:
19911
diff
changeset
|
325 | const char *alias; |
|
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
|
326 | gchar *description; |
|
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 | time_t mtime; |
|
19604
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
328 | |
|
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
|
329 | mtime = time(NULL); |
|
19604
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
330 | |
|
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
|
331 | attn = purple_get_attention_type_from_code(gc->account, 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
|
332 | |
|
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 | /* PURPLE_MESSAGE_NOTIFY is for attention messages. */ |
|
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 | flags = PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_RECV; |
|
19604
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
335 | |
|
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
336 | /* TODO: if (attn->icon_name) is non-null, use it to lookup an emoticon and display |
|
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
337 | * it next to the attention command. And if it is null, display a generic icon. */ |
|
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
338 | |
|
19916
9ab6412cffaf
Take aliases into account for the attention messages.
Richard Laager <rlaager@pidgin.im>
parents:
19911
diff
changeset
|
339 | if ((buddy = purple_find_buddy(purple_connection_get_account(gc), who)) != NULL) |
|
9ab6412cffaf
Take aliases into account for the attention messages.
Richard Laager <rlaager@pidgin.im>
parents:
19911
diff
changeset
|
340 | alias = purple_buddy_get_contact_alias(buddy); |
|
9ab6412cffaf
Take aliases into account for the attention messages.
Richard Laager <rlaager@pidgin.im>
parents:
19911
diff
changeset
|
341 | else |
|
9ab6412cffaf
Take aliases into account for the attention messages.
Richard Laager <rlaager@pidgin.im>
parents:
19911
diff
changeset
|
342 | alias = who; |
|
9ab6412cffaf
Take aliases into account for the attention messages.
Richard Laager <rlaager@pidgin.im>
parents:
19911
diff
changeset
|
343 | |
|
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
|
344 | if (attn && attn->incoming_description) { |
|
19916
9ab6412cffaf
Take aliases into account for the attention messages.
Richard Laager <rlaager@pidgin.im>
parents:
19911
diff
changeset
|
345 | description = g_strdup_printf(attn->incoming_description, alias); |
|
19604
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
346 | } else { |
|
19916
9ab6412cffaf
Take aliases into account for the attention messages.
Richard Laager <rlaager@pidgin.im>
parents:
19911
diff
changeset
|
347 | description = g_strdup_printf(_("%s has requested your attention!"), alias); |
|
19604
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
348 | } |
|
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
349 | |
|
19641
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
350 | purple_debug_info("server", "serv_got_attention: got '%s' from %s\n", |
|
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
351 | description, who); |
|
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
352 | |
|
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
|
353 | serv_got_im(gc, who, description, flags, mtime); |
|
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
|
354 | |
|
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
|
355 | /* TODO: sounds (depending on PurpleAttentionType), shaking, etc. */ |
|
19604
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
356 | |
|
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
357 | g_free(description); |
|
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
358 | } |
|
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
359 | |
|
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
360 | |
| 3136 | 361 | /* |
| 362 | * Move a buddy from one group to another on server. | |
| 363 | * | |
| 364 | * 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
|
365 | * it should be possible. Probably needs to be done, someday. Although, |
| 15884 | 366 | * the UI for that would be difficult, because groups are Purple-wide. |
| 3136 | 367 | */ |
| 15884 | 368 | void serv_move_buddy(PurpleBuddy *b, PurpleGroup *og, PurpleGroup *ng) |
| 3136 | 369 | { |
| 15884 | 370 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
371 | |
|
13418
676c3eb505dc
[gaim-migrate @ 15792]
Richard Laager <rlaager@pidgin.im>
parents:
13294
diff
changeset
|
372 | g_return_if_fail(b != NULL); |
|
676c3eb505dc
[gaim-migrate @ 15792]
Richard Laager <rlaager@pidgin.im>
parents:
13294
diff
changeset
|
373 | g_return_if_fail(og != NULL); |
|
676c3eb505dc
[gaim-migrate @ 15792]
Richard Laager <rlaager@pidgin.im>
parents:
13294
diff
changeset
|
374 | g_return_if_fail(ng != NULL); |
|
676c3eb505dc
[gaim-migrate @ 15792]
Richard Laager <rlaager@pidgin.im>
parents:
13294
diff
changeset
|
375 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
376 | if (b->account->gc != NULL && b->account->gc->prpl != NULL) |
| 15884 | 377 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(b->account->gc->prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
378 | |
|
13418
676c3eb505dc
[gaim-migrate @ 15792]
Richard Laager <rlaager@pidgin.im>
parents:
13294
diff
changeset
|
379 | if (b->account->gc && og && ng) { |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
380 | if (prpl_info && prpl_info->group_buddy) { |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
381 | prpl_info->group_buddy(b->account->gc, b->name, og->name, ng->name); |
| 3136 | 382 | } |
| 383 | } | |
| 384 | } | |
| 385 | ||
| 15884 | 386 | void serv_add_permit(PurpleConnection *g, const char *name) |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
387 | { |
| 15884 | 388 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
389 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
390 | if (g != NULL && g->prpl != NULL) |
| 15884 | 391 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
392 | |
|
14669
df3f48ab4aff
[gaim-migrate @ 17335]
Mark Doliner <markdoliner@pidgin.im>
parents:
14558
diff
changeset
|
393 | if (prpl_info && prpl_info->add_permit) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
394 | prpl_info->add_permit(g, name); |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
395 | } |
|
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
396 | |
| 15884 | 397 | void serv_add_deny(PurpleConnection *g, const char *name) |
| 1 | 398 | { |
| 15884 | 399 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
400 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
401 | if (g != NULL && g->prpl != NULL) |
| 15884 | 402 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
403 | |
|
14669
df3f48ab4aff
[gaim-migrate @ 17335]
Mark Doliner <markdoliner@pidgin.im>
parents:
14558
diff
changeset
|
404 | if (prpl_info && prpl_info->add_deny) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
405 | prpl_info->add_deny(g, name); |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
406 | } |
|
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
407 | |
| 15884 | 408 | void serv_rem_permit(PurpleConnection *g, const char *name) |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
409 | { |
| 15884 | 410 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
411 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
412 | if (g != NULL && g->prpl != NULL) |
| 15884 | 413 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
414 | |
|
14669
df3f48ab4aff
[gaim-migrate @ 17335]
Mark Doliner <markdoliner@pidgin.im>
parents:
14558
diff
changeset
|
415 | if (prpl_info && prpl_info->rem_permit) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
416 | prpl_info->rem_permit(g, name); |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
417 | } |
| 1 | 418 | |
| 15884 | 419 | void serv_rem_deny(PurpleConnection *g, const char *name) |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
420 | { |
| 15884 | 421 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
422 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
423 | if (g != NULL && g->prpl != NULL) |
| 15884 | 424 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
425 | |
|
14669
df3f48ab4aff
[gaim-migrate @ 17335]
Mark Doliner <markdoliner@pidgin.im>
parents:
14558
diff
changeset
|
426 | if (prpl_info && prpl_info->rem_deny) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
427 | prpl_info->rem_deny(g, name); |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
428 | } |
|
678
6e2cb341573a
[gaim-migrate @ 688]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
660
diff
changeset
|
429 | |
| 15884 | 430 | void serv_set_permit_deny(PurpleConnection *g) |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
431 | { |
| 15884 | 432 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
433 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
434 | if (g != NULL && g->prpl != NULL) |
| 15884 | 435 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
436 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
437 | /* |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
438 | * 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
|
439 | * 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
|
440 | * 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
|
441 | * resending the permit/deny info when you get this. |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
442 | */ |
|
14669
df3f48ab4aff
[gaim-migrate @ 17335]
Mark Doliner <markdoliner@pidgin.im>
parents:
14558
diff
changeset
|
443 | if (prpl_info && prpl_info->set_permit_deny) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
444 | prpl_info->set_permit_deny(g); |
| 1 | 445 | } |
| 446 | ||
| 15884 | 447 | void serv_join_chat(PurpleConnection *g, GHashTable *data) |
| 1 | 448 | { |
| 15884 | 449 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
450 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
451 | if (g != NULL && g->prpl != NULL) |
| 15884 | 452 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
453 | |
|
14669
df3f48ab4aff
[gaim-migrate @ 17335]
Mark Doliner <markdoliner@pidgin.im>
parents:
14558
diff
changeset
|
454 | if (prpl_info && prpl_info->join_chat) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
455 | prpl_info->join_chat(g, data); |
| 1 | 456 | } |
| 457 | ||
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
458 | |
| 15884 | 459 | void serv_reject_chat(PurpleConnection *g, GHashTable *data) |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
460 | { |
| 15884 | 461 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
462 | |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
463 | if (g != NULL && g->prpl != NULL) |
| 15884 | 464 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl); |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
465 | |
|
14669
df3f48ab4aff
[gaim-migrate @ 17335]
Mark Doliner <markdoliner@pidgin.im>
parents:
14558
diff
changeset
|
466 | if (prpl_info && prpl_info->reject_chat) |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
467 | prpl_info->reject_chat(g, data); |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
468 | } |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
469 | |
| 15884 | 470 | void serv_chat_invite(PurpleConnection *g, int id, const char *message, const char *name) |
| 1 | 471 | { |
| 15884 | 472 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 473 | PurpleConversation *conv; | |
|
2359
27c1207ca513
[gaim-migrate @ 2372]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2345
diff
changeset
|
474 | char *buffy = message && *message ? g_strdup(message) : NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
475 | |
| 15884 | 476 | conv = purple_find_chat(g, id); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
477 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
478 | if (conv == NULL) |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
479 | return; |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
480 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
481 | if (g != NULL && g->prpl != NULL) |
| 15884 | 482 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
483 | |
| 15884 | 484 | purple_signal_emit(purple_conversations_get_handle(), "chat-inviting-user", |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
485 | conv, name, &buffy); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
486 | |
|
14669
df3f48ab4aff
[gaim-migrate @ 17335]
Mark Doliner <markdoliner@pidgin.im>
parents:
14558
diff
changeset
|
487 | if (prpl_info && prpl_info->chat_invite) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
488 | prpl_info->chat_invite(g, id, buffy, name); |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
489 | |
| 15884 | 490 | purple_signal_emit(purple_conversations_get_handle(), "chat-invited-user", |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
491 | conv, name, buffy); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
492 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13995
diff
changeset
|
493 | g_free(buffy); |
| 1 | 494 | } |
| 495 | ||
| 15884 | 496 | /* Ya know, nothing uses this except purple_conversation_destroy(), |
| 8256 | 497 | * I think I'll just merge it into that later... |
| 498 | * Then again, something might want to use this, from outside prpl-land | |
| 499 | * to leave a chat without destroying the conversation. | |
| 500 | */ | |
| 501 | ||
| 15884 | 502 | void serv_chat_leave(PurpleConnection *g, int id) |
| 1 | 503 | { |
| 15884 | 504 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
505 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
506 | if (g->prpl != NULL) |
| 15884 | 507 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
508 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
509 | if (prpl_info && prpl_info->chat_leave) |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
510 | prpl_info->chat_leave(g, id); |
| 1 | 511 | } |
| 512 | ||
| 15884 | 513 | void serv_chat_whisper(PurpleConnection *g, int id, const char *who, const char *message) |
| 1 | 514 | { |
| 15884 | 515 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
516 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
517 | if (g != NULL && g->prpl != NULL) |
| 15884 | 518 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
519 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
520 | if (prpl_info && prpl_info->chat_whisper) |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
521 | prpl_info->chat_whisper(g, id, who, message); |
| 1 | 522 | } |
| 523 | ||
| 15884 | 524 | int serv_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) |
| 1 | 525 | { |
|
2167
cbb558585911
[gaim-migrate @ 2177]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2131
diff
changeset
|
526 | int val = -EINVAL; |
| 15884 | 527 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
528 | |
|
11907
de3ea77afe3c
[gaim-migrate @ 14198]
Evan Schoenberg <evands@pidgin.im>
parents:
11903
diff
changeset
|
529 | if (gc->prpl != NULL) |
| 15884 | 530 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
531 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
532 | if (prpl_info && prpl_info->chat_send) |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12116
diff
changeset
|
533 | val = prpl_info->chat_send(gc, id, message, flags); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
534 | |
|
2167
cbb558585911
[gaim-migrate @ 2177]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2131
diff
changeset
|
535 | return val; |
| 1 | 536 | } |
| 537 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
538 | /* |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
539 | * 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
|
540 | * sure to follow along, kids |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
541 | */ |
| 15884 | 542 | void serv_got_im(PurpleConnection *gc, const char *who, const char *msg, |
| 543 | PurpleMessageFlags flags, time_t mtime) | |
| 1 | 544 | { |
| 15884 | 545 | PurpleAccount *account; |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20326
diff
changeset
|
546 | PurpleConversation *conv; |
| 5136 | 547 | char *message, *name; |
|
6622
277eb0b14653
[gaim-migrate @ 7146]
Robert McQueen <robot101@debian.org>
parents:
6621
diff
changeset
|
548 | char *angel, *buffy; |
|
277eb0b14653
[gaim-migrate @ 7146]
Robert McQueen <robot101@debian.org>
parents:
6621
diff
changeset
|
549 | int plugin_return; |
|
2273
b7c08d737d81
[gaim-migrate @ 2283]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2231
diff
changeset
|
550 | |
|
11903
56ae8af14a0d
[gaim-migrate @ 14194]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11818
diff
changeset
|
551 | g_return_if_fail(msg != NULL); |
|
56ae8af14a0d
[gaim-migrate @ 14194]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11818
diff
changeset
|
552 | |
| 15884 | 553 | account = purple_connection_get_account(gc); |
| 12849 | 554 | |
| 15884 | 555 | if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->set_permit_deny == NULL) { |
| 12849 | 556 | /* protocol does not support privacy, handle it ourselves */ |
| 15884 | 557 | if (!purple_privacy_check(account, who)) |
| 12849 | 558 | return; |
| 559 | } | |
| 560 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
561 | /* |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
562 | * We should update the conversation window buttons and menu, |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
563 | * if it exists. |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
564 | */ |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20326
diff
changeset
|
565 | 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
|
566 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
567 | /* |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20326
diff
changeset
|
568 | * 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:
20326
diff
changeset
|
569 | * 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
|
570 | */ |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20326
diff
changeset
|
571 | buffy = g_strdup(msg); |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
572 | angel = g_strdup(who); |
| 1339 | 573 | |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
574 | plugin_return = GPOINTER_TO_INT( |
| 15884 | 575 | purple_signal_emit_return_1(purple_conversations_get_handle(), |
| 8999 | 576 | "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:
20326
diff
changeset
|
577 | &angel, &buffy, conv, &flags)); |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
578 | |
|
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
579 | if (!buffy || !angel || plugin_return) { |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13995
diff
changeset
|
580 | g_free(buffy); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13995
diff
changeset
|
581 | g_free(angel); |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
582 | return; |
|
1100
efc7d10c7826
[gaim-migrate @ 1110]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1089
diff
changeset
|
583 | } |
| 8619 | 584 | |
| 8999 | 585 | name = angel; |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
586 | message = buffy; |
|
2104
8d12ab6f798c
[gaim-migrate @ 2114]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2090
diff
changeset
|
587 | |
| 15884 | 588 | 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:
20326
diff
changeset
|
589 | name, message, conv, flags); |
| 8999 | 590 | |
|
12288
d3452b226853
[gaim-migrate @ 14592]
Casey Harkins <charkins@pidgin.im>
parents:
12281
diff
changeset
|
591 | /* 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:
20326
diff
changeset
|
592 | if (conv == NULL) |
|
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20326
diff
changeset
|
593 | 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
|
594 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
595 | /* |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12116
diff
changeset
|
596 | * 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
|
597 | */ |
| 15884 | 598 | flags |= PURPLE_MESSAGE_RECV; |
| 1 | 599 | |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20326
diff
changeset
|
600 | if (conv == NULL) |
|
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20326
diff
changeset
|
601 | 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
|
602 | |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20326
diff
changeset
|
603 | purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, message, flags, mtime); |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
604 | g_free(message); |
|
12116
17bf39d2678f
[gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents:
12114
diff
changeset
|
605 | |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
606 | /* |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
607 | * Don't autorespond if: |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
608 | * |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
609 | * - it's not supported on this connection |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
610 | * - we are available |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
611 | * - or it's disabled |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
612 | * - 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
|
613 | * is set |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
614 | */ |
| 15884 | 615 | if (gc->flags & PURPLE_CONNECTION_AUTO_RESP) |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
616 | { |
| 15884 | 617 | PurplePresence *presence; |
| 618 | PurpleStatus *status; | |
| 619 | PurpleStatusType *status_type; | |
| 620 | PurpleStatusPrimitive primitive; | |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
621 | const gchar *auto_reply_pref; |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
622 | const char *away_msg = NULL; |
|
1775
16de02b8c378
[gaim-migrate @ 1785]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1774
diff
changeset
|
623 | |
|
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
|
624 | 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
|
625 | |
| 15884 | 626 | presence = purple_account_get_presence(account); |
| 627 | status = purple_presence_get_active_status(presence); | |
| 628 | status_type = purple_status_get_type(status); | |
| 629 | primitive = purple_status_type_get_primitive(status_type); | |
| 630 | if ((primitive == PURPLE_STATUS_AVAILABLE) || | |
| 631 | (primitive == PURPLE_STATUS_INVISIBLE) || | |
| 632 | (primitive == PURPLE_STATUS_MOBILE) || | |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
633 | !strcmp(auto_reply_pref, "never") || |
| 15884 | 634 | (!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
|
635 | { |
|
2104
8d12ab6f798c
[gaim-migrate @ 2114]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2090
diff
changeset
|
636 | g_free(name); |
|
1775
16de02b8c378
[gaim-migrate @ 1785]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1774
diff
changeset
|
637 | return; |
|
2104
8d12ab6f798c
[gaim-migrate @ 2114]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2090
diff
changeset
|
638 | } |
|
1775
16de02b8c378
[gaim-migrate @ 1785]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1774
diff
changeset
|
639 | |
| 15884 | 640 | away_msg = purple_value_get_string( |
| 641 | purple_status_get_attr_value(status, "message")); | |
|
1775
16de02b8c378
[gaim-migrate @ 1785]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1774
diff
changeset
|
642 | |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
643 | if ((away_msg != NULL) && (*away_msg != '\0')) { |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
644 | struct last_auto_response *lar; |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
645 | time_t now = time(NULL); |
|
10052
329dad7e2da3
[gaim-migrate @ 11013]
Dave West <kat@users.sourceforge.net>
parents:
10011
diff
changeset
|
646 | |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
647 | /* |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
648 | * 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
|
649 | * 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
|
650 | * 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
|
651 | * 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
|
652 | * 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
|
653 | * 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
|
654 | * if necessary. |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
655 | */ |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
656 | lar = get_last_auto_response(gc, name); |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
657 | if ((now - lar->sent) >= SECS_BEFORE_RESENDING_AUTORESPONSE) |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
658 | { |
|
13995
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
659 | /* |
|
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
660 | * 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
|
661 | * 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
|
662 | * _next_ message, so we still set lar->sent to now. |
|
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
663 | */ |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
664 | lar->sent = now; |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13995
diff
changeset
|
665 | |
| 15884 | 666 | if (!(flags & PURPLE_MESSAGE_AUTO_RESP)) |
|
13995
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
667 | { |
| 15884 | 668 | 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
|
669 | |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20326
diff
changeset
|
670 | purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, away_msg, |
| 15884 | 671 | PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_AUTO_RESP, |
|
13995
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
672 | mtime); |
|
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
673 | } |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
674 | } |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
675 | } |
| 1 | 676 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
677 | |
|
2104
8d12ab6f798c
[gaim-migrate @ 2114]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2090
diff
changeset
|
678 | g_free(name); |
| 1 | 679 | } |
| 680 | ||
| 15884 | 681 | void serv_got_typing(PurpleConnection *gc, const char *name, int timeout, |
| 682 | PurpleTypingState state) { | |
| 683 | PurpleConversation *conv; | |
| 684 | PurpleConvIm *im = NULL; | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
685 | |
| 15884 | 686 | 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
|
687 | if (conv != NULL) { |
| 15884 | 688 | im = PURPLE_CONV_IM(conv); |
|
5032
2276c67b0243
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
689 | |
| 15884 | 690 | purple_conv_im_set_typing_state(im, state); |
| 691 | purple_conv_im_update_typing(im); | |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12677
diff
changeset
|
692 | } 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
|
693 | switch (state) |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12677
diff
changeset
|
694 | { |
|
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
|
695 | 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
|
696 | 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
|
697 | "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
|
698 | 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
|
699 | 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
|
700 | 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
|
701 | "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
|
702 | 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
|
703 | 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
|
704 | 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
|
705 | "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
|
706 | break; |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12677
diff
changeset
|
707 | } |
|
11706
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
708 | } |
|
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
709 | |
|
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
710 | if (conv != NULL && timeout > 0) |
| 15884 | 711 | purple_conv_im_start_typing_timeout(im, timeout); |
| 2993 | 712 | } |
| 1 | 713 | |
| 15884 | 714 | void serv_got_typing_stopped(PurpleConnection *gc, const char *name) { |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
715 | |
| 15884 | 716 | PurpleConversation *conv; |
| 717 | PurpleConvIm *im; | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
718 | |
| 15884 | 719 | 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
|
720 | if (conv != NULL) |
|
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
721 | { |
| 15884 | 722 | im = PURPLE_CONV_IM(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
723 | |
| 15884 | 724 | if (im->typing_state == PURPLE_NOT_TYPING) |
|
11706
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
725 | return; |
|
5032
2276c67b0243
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
726 | |
| 15884 | 727 | purple_conv_im_stop_typing_timeout(im); |
| 728 | purple_conv_im_set_typing_state(im, PURPLE_NOT_TYPING); | |
| 729 | purple_conv_im_update_typing(im); | |
|
11706
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
730 | } |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
731 | else |
|
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
732 | { |
| 15884 | 733 | purple_signal_emit(purple_conversations_get_handle(), |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
734 | "buddy-typing-stopped", gc->account, name); |
|
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
735 | } |
| 2993 | 736 | } |
| 1 | 737 | |
| 4487 | 738 | struct chat_invite_data { |
| 15884 | 739 | PurpleConnection *gc; |
| 5234 | 740 | GHashTable *components; |
| 4487 | 741 | }; |
| 1723 | 742 | |
| 4487 | 743 | static void chat_invite_data_free(struct chat_invite_data *cid) |
| 1 | 744 | { |
| 5234 | 745 | if (cid->components) |
| 746 | g_hash_table_destroy(cid->components); | |
| 4487 | 747 | g_free(cid); |
| 748 | } | |
| 1723 | 749 | |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
750 | |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
751 | static void chat_invite_reject(struct chat_invite_data *cid) |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
752 | { |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
753 | serv_reject_chat(cid->gc, cid->components); |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
754 | chat_invite_data_free(cid); |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
755 | } |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
756 | |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
757 | |
| 4487 | 758 | static void chat_invite_accept(struct chat_invite_data *cid) |
| 759 | { | |
| 5234 | 760 | serv_join_chat(cid->gc, cid->components); |
| 4487 | 761 | chat_invite_data_free(cid); |
| 1 | 762 | } |
| 763 | ||
| 764 | ||
| 765 | ||
| 15884 | 766 | void serv_got_chat_invite(PurpleConnection *gc, const char *name, |
|
5630
a05d97d87690
[gaim-migrate @ 6037]
Mark Doliner <markdoliner@pidgin.im>
parents:
5602
diff
changeset
|
767 | const char *who, const char *message, GHashTable *data) |
| 1 | 768 | { |
| 15884 | 769 | PurpleAccount *account; |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
770 | char buf2[BUF_LONG]; |
| 4487 | 771 | struct chat_invite_data *cid = g_new0(struct chat_invite_data, 1); |
| 11064 | 772 | int plugin_return; |
| 1 | 773 | |
| 15884 | 774 | account = purple_connection_get_account(gc); |
| 775 | if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->set_permit_deny == NULL) { | |
| 12849 | 776 | /* protocol does not support privacy, handle it ourselves */ |
| 15884 | 777 | if (!purple_privacy_check(account, who)) |
| 12849 | 778 | return; |
| 779 | } | |
| 1 | 780 | |
| 15884 | 781 | plugin_return = GPOINTER_TO_INT(purple_signal_emit_return_1( |
| 782 | purple_conversations_get_handle(), | |
| 11064 | 783 | "chat-invited", account, who, name, message, data)); |
| 1 | 784 | |
| 4487 | 785 | cid->gc = gc; |
| 5234 | 786 | cid->components = data; |
| 1 | 787 | |
| 11064 | 788 | if (plugin_return == 0) |
| 789 | { | |
| 790 | if (message != NULL) | |
| 791 | { | |
| 792 | g_snprintf(buf2, sizeof(buf2), | |
| 793 | _("%s has invited %s to the chat room %s:\n%s"), | |
| 15884 | 794 | who, purple_account_get_username(account), name, message); |
| 11064 | 795 | } |
| 796 | else | |
| 797 | g_snprintf(buf2, sizeof(buf2), | |
| 798 | _("%s has invited %s to the chat room %s\n"), | |
| 15884 | 799 | who, purple_account_get_username(account), name); |
| 11064 | 800 | |
| 801 | ||
| 15884 | 802 | 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
|
803 | PURPLE_DEFAULT_ACTION_NONE, account, who, NULL, |
|
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
|
804 | cid, G_CALLBACK(chat_invite_accept), |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
805 | G_CALLBACK(chat_invite_reject)); |
| 11064 | 806 | } |
| 807 | else if (plugin_return > 0) | |
| 808 | chat_invite_accept(cid); | |
| 809 | else | |
| 810 | chat_invite_reject(cid); | |
| 1 | 811 | } |
| 812 | ||
| 15884 | 813 | PurpleConversation *serv_got_joined_chat(PurpleConnection *gc, |
|
5630
a05d97d87690
[gaim-migrate @ 6037]
Mark Doliner <markdoliner@pidgin.im>
parents:
5602
diff
changeset
|
814 | int id, const char *name) |
| 1 | 815 | { |
| 15884 | 816 | PurpleConversation *conv; |
| 817 | PurpleConvChat *chat; | |
| 818 | PurpleAccount *account; | |
| 1 | 819 | |
| 15884 | 820 | account = purple_connection_get_account(gc); |
| 1 | 821 | |
| 15884 | 822 | conv = purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name); |
| 823 | chat = PURPLE_CONV_CHAT(conv); | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
824 | |
| 8256 | 825 | if (!g_slist_find(gc->buddy_chats, conv)) |
| 826 | gc->buddy_chats = g_slist_append(gc->buddy_chats, conv); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
827 | |
| 15884 | 828 | purple_conv_chat_set_id(chat, id); |
|
4476
bf88170ba269
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4440
diff
changeset
|
829 | |
| 15884 | 830 | purple_signal_emit(purple_conversations_get_handle(), "chat-joined", conv); |
| 3710 | 831 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
832 | return conv; |
| 1 | 833 | } |
| 834 | ||
| 15884 | 835 | void serv_got_chat_left(PurpleConnection *g, int id) |
| 1 | 836 | { |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
837 | GSList *bcs; |
| 15884 | 838 | PurpleConversation *conv = NULL; |
| 839 | PurpleConvChat *chat = NULL; | |
| 1 | 840 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
841 | for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { |
| 15884 | 842 | conv = (PurpleConversation *)bcs->data; |
| 1 | 843 | |
| 15884 | 844 | chat = PURPLE_CONV_CHAT(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
845 | |
| 15884 | 846 | if (purple_conv_chat_get_id(chat) == id) |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
847 | break; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
848 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
849 | conv = NULL; |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
850 | } |
| 1 | 851 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
852 | if (!conv) |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
853 | return; |
| 1 | 854 | |
| 15884 | 855 | purple_debug(PURPLE_DEBUG_INFO, "server", "Leaving room: %s\n", |
| 856 | purple_conversation_get_name(conv)); | |
| 1 | 857 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
858 | g->buddy_chats = g_slist_remove(g->buddy_chats, conv); |
| 1 | 859 | |
| 15884 | 860 | purple_conv_chat_left(PURPLE_CONV_CHAT(conv)); |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12677
diff
changeset
|
861 | |
| 15884 | 862 | purple_signal_emit(purple_conversations_get_handle(), "chat-left", conv); |
| 1 | 863 | } |
| 864 | ||
| 15884 | 865 | void serv_got_chat_in(PurpleConnection *g, int id, const char *who, |
| 866 | PurpleMessageFlags flags, const char *message, time_t mtime) | |
| 1 | 867 | { |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
868 | GSList *bcs; |
| 15884 | 869 | PurpleConversation *conv = NULL; |
| 870 | PurpleConvChat *chat = NULL; | |
| 3163 | 871 | char *buffy, *angel; |
| 872 | int plugin_return; | |
| 1 | 873 | |
|
12894
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
874 | g_return_if_fail(who != NULL); |
|
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
875 | g_return_if_fail(message != NULL); |
|
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
876 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
877 | for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { |
| 15884 | 878 | conv = (PurpleConversation *)bcs->data; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
879 | |
| 15884 | 880 | chat = PURPLE_CONV_CHAT(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
881 | |
| 15884 | 882 | if (purple_conv_chat_get_id(chat) == id) |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
883 | break; |
| 1 | 884 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
885 | conv = NULL; |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
886 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
887 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
888 | if (!conv) |
|
1100
efc7d10c7826
[gaim-migrate @ 1110]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1089
diff
changeset
|
889 | return; |
|
391
677e4414a83f
[gaim-migrate @ 401]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
368
diff
changeset
|
890 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
891 | /* |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20326
diff
changeset
|
892 | * 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:
20326
diff
changeset
|
893 | * 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
|
894 | */ |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20326
diff
changeset
|
895 | buffy = g_strdup(message); |
| 3163 | 896 | angel = g_strdup(who); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
897 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
898 | plugin_return = GPOINTER_TO_INT( |
| 15884 | 899 | purple_signal_emit_return_1(purple_conversations_get_handle(), |
| 8999 | 900 | "receiving-chat-msg", g->account, |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12116
diff
changeset
|
901 | &angel, &buffy, conv, &flags)); |
| 3163 | 902 | |
| 903 | if (!buffy || !angel || plugin_return) { | |
|
12894
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
904 | g_free(buffy); |
|
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
905 | g_free(angel); |
|
2372
c24942700dfd
[gaim-migrate @ 2385]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2359
diff
changeset
|
906 | return; |
| 3163 | 907 | } |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20326
diff
changeset
|
908 | |
| 3163 | 909 | who = angel; |
| 910 | message = buffy; | |
| 1 | 911 | |
| 15884 | 912 | 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
|
913 | who, message, conv, flags); |
| 8999 | 914 | |
| 15884 | 915 | purple_conv_chat_write(chat, who, message, flags, mtime); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
916 | |
| 6350 | 917 | g_free(angel); |
|
6062
a292fd631fdb
[gaim-migrate @ 6512]
Mark Doliner <markdoliner@pidgin.im>
parents:
6059
diff
changeset
|
918 | g_free(buffy); |
| 1 | 919 | } |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9453
diff
changeset
|
920 | |
| 15884 | 921 | 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
|
922 | { |
| 15884 | 923 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
10751
e15f4f5927ce
[gaim-migrate @ 12354]
Mark Doliner <markdoliner@pidgin.im>
parents:
10745
diff
changeset
|
924 | |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9453
diff
changeset
|
925 | if (gc != NULL && gc->prpl != NULL) |
| 15884 | 926 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9453
diff
changeset
|
927 | |
|
9647
7ae5b5933b5a
[gaim-migrate @ 10495]
Daniel Atallah <datallah@pidgin.im>
parents:
9620
diff
changeset
|
928 | if (prpl_info && prpl_info->send_file) { |
|
7ae5b5933b5a
[gaim-migrate @ 10495]
Daniel Atallah <datallah@pidgin.im>
parents:
9620
diff
changeset
|
929 | 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
|
930 | prpl_info->send_file(gc, who, file); |
|
7ae5b5933b5a
[gaim-migrate @ 10495]
Daniel Atallah <datallah@pidgin.im>
parents:
9620
diff
changeset
|
931 | } |
|
7ae5b5933b5a
[gaim-migrate @ 10495]
Daniel Atallah <datallah@pidgin.im>
parents:
9620
diff
changeset
|
932 | } |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9453
diff
changeset
|
933 | } |