Sun, 23 Jun 2013 17:20:37 +0530
Refactor code to remove conversation type from some instances of purple_conversations_find_with_account()
| 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" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
33 | #include "prpl.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
34 | #include "request.h" |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
35 | #include "signals.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
36 | #include "server.h" |
|
9944
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9933
diff
changeset
|
37 | #include "status.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
38 | #include "util.h" |
| 1 | 39 | |
|
8948
a5ec0dd1f46c
[gaim-migrate @ 9720]
Mark Doliner <markdoliner@pidgin.im>
parents:
8904
diff
changeset
|
40 | #define SECS_BEFORE_RESENDING_AUTORESPONSE 600 |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9237
diff
changeset
|
41 | #define SEX_BEFORE_RESENDING_AUTORESPONSE "Only after you're married" |
|
8948
a5ec0dd1f46c
[gaim-migrate @ 9720]
Mark Doliner <markdoliner@pidgin.im>
parents:
8904
diff
changeset
|
42 | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
43 | unsigned int |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
44 | serv_send_typing(PurpleConnection *gc, const char *name, PurpleIMConversationTypingState state) |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
45 | { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
46 | PurplePlugin *prpl; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
47 | PurplePluginProtocolInfo *prpl_info; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
48 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
49 | if (gc) { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
50 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
51 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
52 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
53 | if (prpl_info->send_typing) |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
54 | return prpl_info->send_typing(gc, name, state); |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
55 | } |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
56 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
57 | return 0; |
| 2993 | 58 | } |
| 1 | 59 | |
|
10871
c0282a4f2250
[gaim-migrate @ 12558]
Mark Doliner <markdoliner@pidgin.im>
parents:
10853
diff
changeset
|
60 | static GSList *last_auto_responses = NULL; |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
61 | struct last_auto_response { |
| 15884 | 62 | PurpleConnection *gc; |
|
3815
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
63 | char name[80]; |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
64 | time_t sent; |
|
3815
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
65 | }; |
|
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
66 | |
|
10850
6889f793b918
[gaim-migrate @ 12522]
Mark Doliner <markdoliner@pidgin.im>
parents:
10827
diff
changeset
|
67 | static gboolean |
|
6889f793b918
[gaim-migrate @ 12522]
Mark Doliner <markdoliner@pidgin.im>
parents:
10827
diff
changeset
|
68 | expire_last_auto_responses(gpointer data) |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
69 | { |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
70 | GSList *tmp, *cur; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
71 | struct last_auto_response *lar; |
|
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 | tmp = last_auto_responses; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
74 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
75 | while (tmp) { |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
76 | cur = tmp; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
77 | tmp = tmp->next; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
78 | lar = (struct last_auto_response *)cur->data; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
79 | |
|
8948
a5ec0dd1f46c
[gaim-migrate @ 9720]
Mark Doliner <markdoliner@pidgin.im>
parents:
8904
diff
changeset
|
80 | if ((time(NULL) - lar->sent) > SECS_BEFORE_RESENDING_AUTORESPONSE) { |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
81 | last_auto_responses = g_slist_remove(last_auto_responses, lar); |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
82 | g_free(lar); |
|
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 | } |
|
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 | return FALSE; /* do not run again */ |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
87 | } |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
88 | |
|
10850
6889f793b918
[gaim-migrate @ 12522]
Mark Doliner <markdoliner@pidgin.im>
parents:
10827
diff
changeset
|
89 | static struct last_auto_response * |
| 15884 | 90 | get_last_auto_response(PurpleConnection *gc, const char *name) |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
91 | { |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
92 | GSList *tmp; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
93 | struct last_auto_response *lar; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
94 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
95 | /* because we're modifying or creating a lar, schedule the |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
96 | * function to expire them as the pref dictates */ |
|
18068
b6554e3c8224
merge of '1442df274a24edc9a31194327bd00dfbcf478720'
Richard Laager <rlaager@pidgin.im>
diff
changeset
|
97 | 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
|
98 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
99 | tmp = last_auto_responses; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
100 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
101 | while (tmp) { |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
102 | lar = (struct last_auto_response *)tmp->data; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
103 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
104 | if (gc == lar->gc && !strncmp(name, lar->name, sizeof(lar->name))) |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
105 | return lar; |
|
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 | tmp = tmp->next; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
108 | } |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
109 | |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
110 | 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
|
111 | g_snprintf(lar->name, sizeof(lar->name), "%s", name); |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
112 | lar->gc = gc; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
113 | lar->sent = 0; |
|
13791
df2a8738c602
[gaim-migrate @ 16201]
Richard Laager <rlaager@pidgin.im>
parents:
13664
diff
changeset
|
114 | last_auto_responses = g_slist_prepend(last_auto_responses, lar); |
|
6479
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 | return lar; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
117 | } |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
118 | |
| 15884 | 119 | int serv_send_im(PurpleConnection *gc, const char *name, const char *message, |
| 120 | PurpleMessageFlags flags) | |
| 1 | 121 | { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
122 | PurpleConversation *conv = NULL; |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
123 | PurpleAccount *account = NULL; |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
124 | PurplePresence *presence = NULL; |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
125 | PurplePlugin *prpl = NULL; |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
126 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
2123
4cfdde0aa3f1
[gaim-migrate @ 2133]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2108
diff
changeset
|
127 | int val = -EINVAL; |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
128 | const gchar *auto_reply_pref = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
129 | |
|
13422
0221ca926ebe
[gaim-migrate @ 15796]
Richard Laager <rlaager@pidgin.im>
parents:
13418
diff
changeset
|
130 | g_return_val_if_fail(gc != NULL, val); |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
131 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
132 | prpl = purple_connection_get_prpl(gc); |
|
13422
0221ca926ebe
[gaim-migrate @ 15796]
Richard Laager <rlaager@pidgin.im>
parents:
13418
diff
changeset
|
133 | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
134 | g_return_val_if_fail(prpl != NULL, val); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
135 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
136 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
137 | |
| 15884 | 138 | account = purple_connection_get_account(gc); |
| 139 | presence = purple_account_get_presence(account); | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
140 | |
|
34625
03d62b1660fc
Refactor code to remove conversation type from some instances of purple_conversations_find_with_account()
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
141 | conv = purple_conversations_find_im_with_account(name, account); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
142 | |
|
28577
513297aa5f42
Minor cleanup. gc->prpl is guarranteed to be a PurplePlugin with
Mark Doliner <markdoliner@pidgin.im>
parents:
28236
diff
changeset
|
143 | if (prpl_info->send_im) |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12116
diff
changeset
|
144 | val = prpl_info->send_im(gc, name, message, flags); |
|
94
0c6ba3d3fa90
[gaim-migrate @ 104]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
79
diff
changeset
|
145 | |
|
9594
7a1f902b9494
[gaim-migrate @ 10437]
Mark Doliner <markdoliner@pidgin.im>
parents:
9584
diff
changeset
|
146 | /* |
|
7a1f902b9494
[gaim-migrate @ 10437]
Mark Doliner <markdoliner@pidgin.im>
parents:
9584
diff
changeset
|
147 | * 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
|
148 | * this only reset lar->sent if we're away AND idle? |
|
7a1f902b9494
[gaim-migrate @ 10437]
Mark Doliner <markdoliner@pidgin.im>
parents:
9584
diff
changeset
|
149 | */ |
|
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
|
150 | auto_reply_pref = purple_prefs_get_string("/purple/away/auto_reply"); |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
151 | if((purple_connection_get_flags(gc) & PURPLE_CONNECTION_AUTO_RESP) && |
| 15884 | 152 | !purple_presence_is_available(presence) && |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
25854
diff
changeset
|
153 | !purple_strequal(auto_reply_pref, "never")) { |
|
5545
a8b1a1262402
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
154 | |
|
6479
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
155 | struct last_auto_response *lar; |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
156 | lar = get_last_auto_response(gc, name); |
|
ed29d5b112b5
[gaim-migrate @ 6992]
Robert McQueen <robot101@debian.org>
parents:
6478
diff
changeset
|
157 | lar->sent = time(NULL); |
|
3815
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
158 | } |
|
111911707a8c
[gaim-migrate @ 3962]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents:
3792
diff
changeset
|
159 | |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
160 | if(conv && purple_im_conversation_get_send_typed_timeout(PURPLE_CONV_IM(conv))) |
|
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
161 | purple_im_conversation_stop_send_typed_timeout(PURPLE_CONV_IM(conv)); |
| 3601 | 162 | |
|
2123
4cfdde0aa3f1
[gaim-migrate @ 2133]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2108
diff
changeset
|
163 | return val; |
| 1 | 164 | } |
| 165 | ||
| 15884 | 166 | void serv_get_info(PurpleConnection *gc, const char *name) |
| 1 | 167 | { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
168 | PurplePlugin *prpl; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
169 | PurplePluginProtocolInfo *prpl_info; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
170 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
171 | if (gc) { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
172 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
173 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
174 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
175 | if (prpl_info->get_info) |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
176 | prpl_info->get_info(gc, name); |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
177 | } |
|
249
14b7e4f943ff
[gaim-migrate @ 259]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
248
diff
changeset
|
178 | } |
|
14b7e4f943ff
[gaim-migrate @ 259]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
248
diff
changeset
|
179 | |
| 15884 | 180 | void serv_set_info(PurpleConnection *gc, const char *info) |
| 1 | 181 | { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
182 | PurplePlugin *prpl; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
183 | PurplePluginProtocolInfo *prpl_info; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
184 | PurpleAccount *account; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
185 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
186 | if (gc) { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
187 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
188 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
189 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
190 | if (prpl_info->set_info) { |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
191 | account = purple_connection_get_account(gc); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
192 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
193 | if (purple_signal_emit_return_1(purple_accounts_get_handle(), |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
194 | "account-setting-info", account, info)) |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
195 | return; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
196 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
197 | prpl_info->set_info(gc, info); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
198 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
199 | purple_signal_emit(purple_accounts_get_handle(), |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
200 | "account-set-info", account, info); |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
201 | } |
| 1749 | 202 | } |
|
237
83ff5f92ee7e
[gaim-migrate @ 247]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
200
diff
changeset
|
203 | } |
|
83ff5f92ee7e
[gaim-migrate @ 247]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
200
diff
changeset
|
204 | |
| 3136 | 205 | /* |
| 206 | * Set buddy's alias on server roster/list | |
| 207 | */ | |
| 15884 | 208 | void serv_alias_buddy(PurpleBuddy *b) |
| 3136 | 209 | { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
210 | PurpleAccount *account; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
211 | PurpleConnection *gc; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
212 | PurplePlugin *prpl; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
213 | PurplePluginProtocolInfo *prpl_info; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
214 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
215 | if (b) { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
216 | account = purple_buddy_get_account(b); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
217 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
218 | if (account) { |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
219 | gc = purple_account_get_connection(account); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
220 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
221 | if (gc) { |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
222 | prpl = purple_connection_get_prpl(gc); |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
223 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
224 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
225 | if (prpl_info->alias_buddy) |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
226 | prpl_info->alias_buddy(gc, |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
227 | purple_buddy_get_name(b), |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
228 | purple_buddy_get_local_buddy_alias(b)); |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
229 | } |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
230 | } |
| 3136 | 231 | } |
| 232 | } | |
| 233 | ||
| 9135 | 234 | void |
| 15884 | 235 | serv_got_alias(PurpleConnection *gc, const char *who, const char *alias) |
| 9135 | 236 | { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
237 | PurpleAccount *account; |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
238 | GSList *buddies; |
| 15884 | 239 | PurpleBuddy *b; |
| 240 | PurpleConversation *conv; | |
|
6058
0d5c66a5da5d
[gaim-migrate @ 6508]
Mark Doliner <markdoliner@pidgin.im>
parents:
6019
diff
changeset
|
241 | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
242 | account = purple_connection_get_account(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
243 | buddies = purple_find_buddies(account, who); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
244 | |
|
16863
b98303c15033
Change a few functions to free a linked list while iterating through
Mark Doliner <markdoliner@pidgin.im>
parents:
16795
diff
changeset
|
245 | while (buddies != NULL) |
| 9135 | 246 | { |
|
24957
647853a842da
A couple of minor fixes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24955
diff
changeset
|
247 | const char *server_alias; |
|
24955
77727fac30c6
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24526
diff
changeset
|
248 | |
|
16863
b98303c15033
Change a few functions to free a linked list while iterating through
Mark Doliner <markdoliner@pidgin.im>
parents:
16795
diff
changeset
|
249 | 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
|
250 | 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
|
251 | |
|
24957
647853a842da
A couple of minor fixes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24955
diff
changeset
|
252 | server_alias = purple_buddy_get_server_alias(b); |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
25854
diff
changeset
|
253 | |
|
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
25854
diff
changeset
|
254 | if (purple_strequal(server_alias, alias)) |
| 14546 | 255 | continue; |
|
16863
b98303c15033
Change a few functions to free a linked list while iterating through
Mark Doliner <markdoliner@pidgin.im>
parents:
16795
diff
changeset
|
256 | |
| 15884 | 257 | purple_blist_server_alias_buddy(b, alias); |
| 9135 | 258 | |
|
34625
03d62b1660fc
Refactor code to remove conversation type from some instances of purple_conversations_find_with_account()
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
259 | conv = purple_conversations_find_im_with_account(purple_buddy_get_name(b), account); |
|
28880
4c23a5930374
*** Plucked rev 212bd3655451599364562cabe553c5b7a19134ae (zacw@adiumx.com):
Paul Aurich <darkrain42@pidgin.im>
parents:
28724
diff
changeset
|
260 | if (conv != NULL && alias != NULL && !purple_strequal(alias, who)) |
| 9135 | 261 | { |
|
24526
c302510b1137
escape nick change message
Ka-Hing Cheung <khc@pidgin.im>
parents:
23875
diff
changeset
|
262 | char *escaped = g_markup_escape_text(who, -1); |
|
c302510b1137
escape nick change message
Ka-Hing Cheung <khc@pidgin.im>
parents:
23875
diff
changeset
|
263 | char *escaped2 = g_markup_escape_text(alias, -1); |
| 9135 | 264 | char *tmp = g_strdup_printf(_("%s is now known as %s.\n"), |
|
24526
c302510b1137
escape nick change message
Ka-Hing Cheung <khc@pidgin.im>
parents:
23875
diff
changeset
|
265 | escaped, escaped2); |
| 9135 | 266 | |
| 18090 | 267 | purple_conversation_write(conv, NULL, tmp, |
| 268 | PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, | |
| 269 | time(NULL)); | |
| 9135 | 270 | |
| 271 | g_free(tmp); | |
|
24526
c302510b1137
escape nick change message
Ka-Hing Cheung <khc@pidgin.im>
parents:
23875
diff
changeset
|
272 | g_free(escaped2); |
|
c302510b1137
escape nick change message
Ka-Hing Cheung <khc@pidgin.im>
parents:
23875
diff
changeset
|
273 | g_free(escaped); |
| 9135 | 274 | } |
| 8870 | 275 | } |
| 4227 | 276 | } |
| 277 | ||
|
22474
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
278 | void |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
279 | purple_serv_got_private_alias(PurpleConnection *gc, const char *who, const char *alias) |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
280 | { |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
281 | PurpleAccount *account = NULL; |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
282 | GSList *buddies = NULL; |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
283 | PurpleBuddy *b = NULL; |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
284 | |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
285 | account = purple_connection_get_account(gc); |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
286 | buddies = purple_find_buddies(account, who); |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
287 | |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
288 | while(buddies != NULL) { |
|
24957
647853a842da
A couple of minor fixes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24955
diff
changeset
|
289 | const char *balias; |
|
22474
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
290 | b = buddies->data; |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
291 | |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
292 | buddies = g_slist_delete_link(buddies, buddies); |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
293 | |
|
24957
647853a842da
A couple of minor fixes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24955
diff
changeset
|
294 | balias = purple_buddy_get_local_buddy_alias(b); |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
25854
diff
changeset
|
295 | if (purple_strequal(balias, alias)) |
|
22474
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
296 | continue; |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
297 | |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
298 | purple_blist_alias_buddy(b, alias); |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
299 | } |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
300 | } |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
301 | |
|
d08590a6660c
This is part of a patch from felipec, also known as shx, that adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
302 | |
|
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 | 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
|
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 | 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
|
306 | 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
|
307 | 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
|
308 | |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
309 | 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
|
310 | |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
311 | 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
|
312 | |
|
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
|
313 | /* 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
|
314 | 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
|
315 | 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
|
316 | 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
|
317 | |
|
19641
4a93c044199c
Change serv_send_attention() to call prpl_info->send_attention(), and
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19639
diff
changeset
|
318 | 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
|
319 | 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
|
320 | } 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
|
321 | 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
|
322 | } |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
323 | |
|
93a56951f439
In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19632
diff
changeset
|
324 | 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
|
325 | } |
|
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 | |
|
19604
ae3d7cc7063d
Attention API for nudges/buzzes/zaps of various protocols.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
18311
diff
changeset
|
327 | |
| 3136 | 328 | /* |
| 329 | * Move a buddy from one group to another on server. | |
| 330 | * | |
| 331 | * 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
|
332 | * it should be possible. Probably needs to be done, someday. Although, |
| 15884 | 333 | * the UI for that would be difficult, because groups are Purple-wide. |
| 3136 | 334 | */ |
| 15884 | 335 | void serv_move_buddy(PurpleBuddy *b, PurpleGroup *og, PurpleGroup *ng) |
| 3136 | 336 | { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
337 | PurpleAccount *account; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
338 | PurpleConnection *gc; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
339 | PurplePlugin *prpl; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
340 | PurplePluginProtocolInfo *prpl_info; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
341 | |
|
13418
676c3eb505dc
[gaim-migrate @ 15792]
Richard Laager <rlaager@pidgin.im>
parents:
13294
diff
changeset
|
342 | g_return_if_fail(b != NULL); |
|
676c3eb505dc
[gaim-migrate @ 15792]
Richard Laager <rlaager@pidgin.im>
parents:
13294
diff
changeset
|
343 | g_return_if_fail(og != NULL); |
|
676c3eb505dc
[gaim-migrate @ 15792]
Richard Laager <rlaager@pidgin.im>
parents:
13294
diff
changeset
|
344 | g_return_if_fail(ng != NULL); |
|
676c3eb505dc
[gaim-migrate @ 15792]
Richard Laager <rlaager@pidgin.im>
parents:
13294
diff
changeset
|
345 | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
346 | account = purple_buddy_get_account(b); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
347 | gc = purple_account_get_connection(account); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
348 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
349 | if (gc) { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
350 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
351 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
352 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
353 | if (prpl_info->group_buddy) |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
354 | prpl_info->group_buddy(gc, purple_buddy_get_name(b), |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
355 | purple_group_get_name(og), |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
356 | purple_group_get_name(ng)); |
| 3136 | 357 | } |
| 358 | } | |
| 359 | ||
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
360 | void serv_add_permit(PurpleConnection *gc, const char *name) |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
361 | { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
362 | PurplePlugin *prpl; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
363 | PurplePluginProtocolInfo *prpl_info; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
364 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
365 | if (gc) { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
366 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
367 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
368 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
369 | if (prpl_info->add_permit) |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
370 | prpl_info->add_permit(gc, name); |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
371 | } |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
372 | } |
|
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
373 | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
374 | void serv_add_deny(PurpleConnection *gc, const char *name) |
| 1 | 375 | { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
376 | PurplePlugin *prpl; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
377 | PurplePluginProtocolInfo *prpl_info; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
378 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
379 | if (gc) { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
380 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
381 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
382 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
383 | if (prpl_info->add_deny) |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
384 | prpl_info->add_deny(gc, name); |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
385 | } |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
386 | } |
|
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
387 | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
388 | void serv_rem_permit(PurpleConnection *gc, const char *name) |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
389 | { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
390 | PurplePlugin *prpl; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
391 | PurplePluginProtocolInfo *prpl_info; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
392 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
393 | if (gc) { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
394 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
395 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
396 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
397 | if (prpl_info->rem_permit) |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
398 | prpl_info->rem_permit(gc, name); |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
399 | } |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
400 | } |
| 1 | 401 | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
402 | void serv_rem_deny(PurpleConnection *gc, const char *name) |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
403 | { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
404 | PurplePlugin *prpl; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
405 | PurplePluginProtocolInfo *prpl_info; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
406 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
407 | if (gc) { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
408 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
409 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
410 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
411 | if (prpl_info->rem_deny) |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
412 | prpl_info->rem_deny(gc, name); |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
413 | } |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
414 | } |
|
678
6e2cb341573a
[gaim-migrate @ 688]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
660
diff
changeset
|
415 | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
416 | void serv_set_permit_deny(PurpleConnection *gc) |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1026
diff
changeset
|
417 | { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
418 | PurplePlugin *prpl; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
419 | PurplePluginProtocolInfo *prpl_info; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
420 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
421 | if (gc) { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
422 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
423 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
424 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
425 | /* |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
426 | * this is called when either you import a buddy list, and make lots |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
427 | * of changes that way, or when the user toggles the permit/deny mode |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
428 | * in the prefs. In either case you should probably be resetting and |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
429 | * resending the permit/deny info when you get this. |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
430 | */ |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
431 | if (prpl_info->set_permit_deny) |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
432 | prpl_info->set_permit_deny(gc); |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
433 | } |
| 1 | 434 | } |
| 435 | ||
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
436 | void serv_join_chat(PurpleConnection *gc, GHashTable *data) |
| 1 | 437 | { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
438 | PurplePlugin *prpl; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
439 | PurplePluginProtocolInfo *prpl_info; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
440 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
441 | if (gc) { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
442 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
443 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
444 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
445 | if (prpl_info->join_chat) |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
446 | prpl_info->join_chat(gc, data); |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
447 | } |
| 1 | 448 | } |
| 449 | ||
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
450 | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
451 | void serv_reject_chat(PurpleConnection *gc, GHashTable *data) |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
452 | { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
453 | PurplePlugin *prpl; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
454 | PurplePluginProtocolInfo *prpl_info; |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
455 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
456 | if (gc) { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
457 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
458 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
459 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
460 | if (prpl_info->reject_chat) |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
461 | prpl_info->reject_chat(gc, data); |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
462 | } |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
463 | } |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
464 | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
465 | void serv_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name) |
| 1 | 466 | { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
467 | PurplePlugin *prpl = NULL; |
| 15884 | 468 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 469 | PurpleConversation *conv; | |
|
2359
27c1207ca513
[gaim-migrate @ 2372]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2345
diff
changeset
|
470 | char *buffy = message && *message ? g_strdup(message) : NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
471 | |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
472 | conv = purple_conversations_find_chat(gc, id); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
473 | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
474 | if(conv == NULL) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
475 | return; |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
476 | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
477 | if(gc) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
478 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
479 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
480 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
481 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
482 | |
| 15884 | 483 | purple_signal_emit(purple_conversations_get_handle(), "chat-inviting-user", |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
484 | conv, name, &buffy); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
485 | |
|
14669
df3f48ab4aff
[gaim-migrate @ 17335]
Mark Doliner <markdoliner@pidgin.im>
parents:
14558
diff
changeset
|
486 | if (prpl_info && prpl_info->chat_invite) |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
487 | prpl_info->chat_invite(gc, id, buffy, name); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
488 | |
| 15884 | 489 | purple_signal_emit(purple_conversations_get_handle(), "chat-invited-user", |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
490 | conv, name, buffy); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
491 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13995
diff
changeset
|
492 | g_free(buffy); |
| 1 | 493 | } |
| 494 | ||
| 15884 | 495 | /* Ya know, nothing uses this except purple_conversation_destroy(), |
| 8256 | 496 | * I think I'll just merge it into that later... |
| 497 | * Then again, something might want to use this, from outside prpl-land | |
| 498 | * to leave a chat without destroying the conversation. | |
| 499 | */ | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
500 | void serv_chat_leave(PurpleConnection *gc, int id) |
| 1 | 501 | { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
502 | PurplePlugin *prpl; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
503 | PurplePluginProtocolInfo *prpl_info; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
504 | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
505 | prpl = purple_connection_get_prpl(gc); |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
506 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
507 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
508 | if (prpl_info->chat_leave) |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
509 | prpl_info->chat_leave(gc, id); |
| 1 | 510 | } |
| 511 | ||
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
512 | void serv_chat_whisper(PurpleConnection *gc, int id, const char *who, const char *message) |
| 1 | 513 | { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
514 | PurplePlugin *prpl; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
515 | PurplePluginProtocolInfo *prpl_info; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
516 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
517 | if (gc) { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
518 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
519 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
520 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
521 | if (prpl_info->chat_whisper) |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
522 | prpl_info->chat_whisper(gc, id, who, message); |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
523 | } |
| 1 | 524 | } |
| 525 | ||
| 15884 | 526 | int serv_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) |
| 1 | 527 | { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
528 | PurplePlugin *prpl; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
529 | PurplePluginProtocolInfo *prpl_info; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
530 | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
531 | prpl = purple_connection_get_prpl(gc); |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
532 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
533 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
534 | if (prpl_info->chat_send) |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
535 | return prpl_info->chat_send(gc, id, message, flags); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5170
diff
changeset
|
536 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
537 | return -EINVAL; |
| 1 | 538 | } |
| 539 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
540 | /* |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
541 | * 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
|
542 | * sure to follow along, kids |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
543 | */ |
| 15884 | 544 | void serv_got_im(PurpleConnection *gc, const char *who, const char *msg, |
| 545 | PurpleMessageFlags flags, time_t mtime) | |
| 1 | 546 | { |
| 15884 | 547 | PurpleAccount *account; |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
548 | PurpleConversation *conv; |
| 5136 | 549 | char *message, *name; |
|
6622
277eb0b14653
[gaim-migrate @ 7146]
Robert McQueen <robot101@debian.org>
parents:
6621
diff
changeset
|
550 | char *angel, *buffy; |
|
277eb0b14653
[gaim-migrate @ 7146]
Robert McQueen <robot101@debian.org>
parents:
6621
diff
changeset
|
551 | int plugin_return; |
|
2273
b7c08d737d81
[gaim-migrate @ 2283]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2231
diff
changeset
|
552 | |
|
11903
56ae8af14a0d
[gaim-migrate @ 14194]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11818
diff
changeset
|
553 | g_return_if_fail(msg != NULL); |
|
56ae8af14a0d
[gaim-migrate @ 14194]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11818
diff
changeset
|
554 | |
| 15884 | 555 | account = purple_connection_get_account(gc); |
| 12849 | 556 | |
|
25721
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
557 | /* |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
558 | * XXX: Should we be setting this here, or relying on prpls to set it? |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
559 | */ |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
560 | flags |= PURPLE_MESSAGE_RECV; |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
561 | |
|
34583
476c39afcaae
Refactored the libpurple core to use the GObject-based PurpleAccount
Ankit Vani <a@nevitus.org>
parents:
32678
diff
changeset
|
562 | if (!purple_account_privacy_check(account, who)) { |
|
28236
3827fe6f94e0
Check in a change that does dumb client-side blocking of people
Mark Doliner <markdoliner@pidgin.im>
parents:
27935
diff
changeset
|
563 | purple_signal_emit(purple_conversations_get_handle(), "blocked-im-msg", |
|
3827fe6f94e0
Check in a change that does dumb client-side blocking of people
Mark Doliner <markdoliner@pidgin.im>
parents:
27935
diff
changeset
|
564 | account, who, msg, flags, (unsigned int)mtime); |
|
3827fe6f94e0
Check in a change that does dumb client-side blocking of people
Mark Doliner <markdoliner@pidgin.im>
parents:
27935
diff
changeset
|
565 | return; |
| 12849 | 566 | } |
| 567 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
568 | /* |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
569 | * We should update the conversation window buttons and menu, |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
570 | * if it exists. |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
571 | */ |
|
34625
03d62b1660fc
Refactor code to remove conversation type from some instances of purple_conversations_find_with_account()
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
572 | conv = purple_conversations_find_im_with_account(who, purple_connection_get_account(gc)); |
|
2106
ecd1bec6376c
[gaim-migrate @ 2116]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2104
diff
changeset
|
573 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
574 | /* |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
575 | * Make copies of the message and the sender in case plugins want |
|
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
576 | * 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
|
577 | */ |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
578 | buffy = g_strdup(msg); |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
579 | angel = g_strdup(who); |
| 1339 | 580 | |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
581 | plugin_return = GPOINTER_TO_INT( |
| 15884 | 582 | purple_signal_emit_return_1(purple_conversations_get_handle(), |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
583 | "receiving-im-msg", purple_connection_get_account(gc), |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
584 | &angel, &buffy, conv, &flags)); |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
585 | |
|
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
586 | if (!buffy || !angel || plugin_return) { |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13995
diff
changeset
|
587 | g_free(buffy); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13995
diff
changeset
|
588 | g_free(angel); |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
589 | return; |
|
1100
efc7d10c7826
[gaim-migrate @ 1110]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1089
diff
changeset
|
590 | } |
| 8619 | 591 | |
| 8999 | 592 | name = angel; |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6885
diff
changeset
|
593 | message = buffy; |
|
2104
8d12ab6f798c
[gaim-migrate @ 2114]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2090
diff
changeset
|
594 | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
595 | purple_signal_emit(purple_conversations_get_handle(), "received-im-msg", purple_connection_get_account(gc), |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
596 | name, message, conv, flags); |
| 8999 | 597 | |
|
12288
d3452b226853
[gaim-migrate @ 14592]
Casey Harkins <charkins@pidgin.im>
parents:
12281
diff
changeset
|
598 | /* search for conversation again in case it was created by received-im-msg handler */ |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
599 | if (conv == NULL) |
|
34625
03d62b1660fc
Refactor code to remove conversation type from some instances of purple_conversations_find_with_account()
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
600 | conv = purple_conversations_find_im_with_account(name, purple_connection_get_account(gc)); |
|
12288
d3452b226853
[gaim-migrate @ 14592]
Casey Harkins <charkins@pidgin.im>
parents:
12281
diff
changeset
|
601 | |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
602 | if (conv == NULL) |
|
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
603 | 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
|
604 | |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
605 | purple_im_conversation_write_message(PURPLE_CONV_IM(conv), name, message, flags, mtime); |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
606 | g_free(message); |
|
12116
17bf39d2678f
[gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents:
12114
diff
changeset
|
607 | |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
608 | /* |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
609 | * Don't autorespond if: |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
610 | * |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
611 | * - it's not supported on this connection |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
612 | * - we are available |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
613 | * - or it's disabled |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
614 | * - 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
|
615 | * is set |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
616 | */ |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
617 | if (purple_connection_get_flags(gc) & PURPLE_CONNECTION_AUTO_RESP) |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
618 | { |
| 15884 | 619 | PurplePresence *presence; |
| 620 | PurpleStatus *status; | |
| 621 | PurpleStatusType *status_type; | |
| 622 | PurpleStatusPrimitive primitive; | |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
623 | const gchar *auto_reply_pref; |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
624 | const char *away_msg = NULL; |
|
23523
43487fb86f1e
Mobile status are created as independant statuses, which cannot be the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23436
diff
changeset
|
625 | gboolean mobile = FALSE; |
|
1775
16de02b8c378
[gaim-migrate @ 1785]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1774
diff
changeset
|
626 | |
|
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
|
627 | 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
|
628 | |
| 15884 | 629 | presence = purple_account_get_presence(account); |
| 630 | status = purple_presence_get_active_status(presence); | |
| 631 | status_type = purple_status_get_type(status); | |
| 632 | primitive = purple_status_type_get_primitive(status_type); | |
|
23523
43487fb86f1e
Mobile status are created as independant statuses, which cannot be the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23436
diff
changeset
|
633 | mobile = purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOBILE); |
| 15884 | 634 | if ((primitive == PURPLE_STATUS_AVAILABLE) || |
| 635 | (primitive == PURPLE_STATUS_INVISIBLE) || | |
|
23523
43487fb86f1e
Mobile status are created as independant statuses, which cannot be the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23436
diff
changeset
|
636 | mobile || |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
25854
diff
changeset
|
637 | purple_strequal(auto_reply_pref, "never") || |
|
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
25854
diff
changeset
|
638 | (!purple_presence_is_idle(presence) && purple_strequal(auto_reply_pref, "awayidle"))) |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
639 | { |
|
2104
8d12ab6f798c
[gaim-migrate @ 2114]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2090
diff
changeset
|
640 | g_free(name); |
|
1775
16de02b8c378
[gaim-migrate @ 1785]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1774
diff
changeset
|
641 | return; |
|
2104
8d12ab6f798c
[gaim-migrate @ 2114]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2090
diff
changeset
|
642 | } |
|
1775
16de02b8c378
[gaim-migrate @ 1785]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1774
diff
changeset
|
643 | |
| 15884 | 644 | away_msg = purple_value_get_string( |
| 645 | purple_status_get_attr_value(status, "message")); | |
|
1775
16de02b8c378
[gaim-migrate @ 1785]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1774
diff
changeset
|
646 | |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
647 | if ((away_msg != NULL) && (*away_msg != '\0')) { |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
648 | struct last_auto_response *lar; |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
649 | time_t now = time(NULL); |
|
10052
329dad7e2da3
[gaim-migrate @ 11013]
Dave West <kat@users.sourceforge.net>
parents:
10011
diff
changeset
|
650 | |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
651 | /* |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
652 | * 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
|
653 | * 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
|
654 | * 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
|
655 | * 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
|
656 | * 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
|
657 | * 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
|
658 | * if necessary. |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
659 | */ |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
660 | lar = get_last_auto_response(gc, name); |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
661 | if ((now - lar->sent) >= SECS_BEFORE_RESENDING_AUTORESPONSE) |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
662 | { |
|
13995
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
663 | /* |
|
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
664 | * 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
|
665 | * 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
|
666 | * _next_ message, so we still set lar->sent to now. |
|
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
667 | */ |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
668 | lar->sent = now; |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13995
diff
changeset
|
669 | |
| 15884 | 670 | if (!(flags & PURPLE_MESSAGE_AUTO_RESP)) |
|
13995
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
671 | { |
| 15884 | 672 | 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
|
673 | |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
674 | purple_im_conversation_write_message(PURPLE_CONV_IM(conv), NULL, away_msg, |
| 15884 | 675 | PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_AUTO_RESP, |
|
13995
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
676 | mtime); |
|
d49d169477cd
[gaim-migrate @ 16461]
Evan Schoenberg <evands@pidgin.im>
parents:
13985
diff
changeset
|
677 | } |
|
12949
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
678 | } |
|
525bbe926760
[gaim-migrate @ 15302]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12894
diff
changeset
|
679 | } |
| 1 | 680 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
681 | |
|
2104
8d12ab6f798c
[gaim-migrate @ 2114]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2090
diff
changeset
|
682 | g_free(name); |
| 1 | 683 | } |
| 684 | ||
| 15884 | 685 | void serv_got_typing(PurpleConnection *gc, const char *name, int timeout, |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
686 | PurpleIMConversationTypingState state) { |
| 15884 | 687 | PurpleConversation *conv; |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
688 | PurpleIMConversation *im = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
689 | |
|
34625
03d62b1660fc
Refactor code to remove conversation type from some instances of purple_conversations_find_with_account()
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
690 | conv = purple_conversations_find_im_with_account(name, purple_connection_get_account(gc)); |
|
11706
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
691 | if (conv != NULL) { |
| 15884 | 692 | im = PURPLE_CONV_IM(conv); |
|
5032
2276c67b0243
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
693 | |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
694 | purple_im_conversation_set_typing_state(im, state); |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12677
diff
changeset
|
695 | } 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
|
696 | switch (state) |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12677
diff
changeset
|
697 | { |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
698 | case PURPLE_IM_CONVERSATION_TYPING: |
|
17107
fbdf9f73f9f8
Emit the buddy-typing-stopped signal even if we don't have a conversation, and use swtich rather than if
Evan Schoenberg <evands@pidgin.im>
parents:
16863
diff
changeset
|
699 | purple_signal_emit(purple_conversations_get_handle(), |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
700 | "buddy-typing", purple_connection_get_account(gc), name); |
|
17107
fbdf9f73f9f8
Emit the buddy-typing-stopped signal even if we don't have a conversation, and use swtich rather than if
Evan Schoenberg <evands@pidgin.im>
parents:
16863
diff
changeset
|
701 | break; |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
702 | case PURPLE_IM_CONVERSATION_TYPED: |
|
17107
fbdf9f73f9f8
Emit the buddy-typing-stopped signal even if we don't have a conversation, and use swtich rather than if
Evan Schoenberg <evands@pidgin.im>
parents:
16863
diff
changeset
|
703 | purple_signal_emit(purple_conversations_get_handle(), |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
704 | "buddy-typed", purple_connection_get_account(gc), name); |
|
17107
fbdf9f73f9f8
Emit the buddy-typing-stopped signal even if we don't have a conversation, and use swtich rather than if
Evan Schoenberg <evands@pidgin.im>
parents:
16863
diff
changeset
|
705 | break; |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
706 | case PURPLE_IM_CONVERSATION_NOT_TYPING: |
|
17107
fbdf9f73f9f8
Emit the buddy-typing-stopped signal even if we don't have a conversation, and use swtich rather than if
Evan Schoenberg <evands@pidgin.im>
parents:
16863
diff
changeset
|
707 | purple_signal_emit(purple_conversations_get_handle(), |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
708 | "buddy-typing-stopped", purple_connection_get_account(gc), name); |
|
17107
fbdf9f73f9f8
Emit the buddy-typing-stopped signal even if we don't have a conversation, and use swtich rather than if
Evan Schoenberg <evands@pidgin.im>
parents:
16863
diff
changeset
|
709 | break; |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12677
diff
changeset
|
710 | } |
|
11706
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
711 | } |
|
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
712 | |
|
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
713 | if (conv != NULL && timeout > 0) |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
714 | purple_im_conversation_start_typing_timeout(im, timeout); |
| 2993 | 715 | } |
| 1 | 716 | |
| 15884 | 717 | void serv_got_typing_stopped(PurpleConnection *gc, const char *name) { |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
718 | |
| 15884 | 719 | PurpleConversation *conv; |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
720 | PurpleIMConversation *im; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
721 | |
|
34625
03d62b1660fc
Refactor code to remove conversation type from some instances of purple_conversations_find_with_account()
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
722 | conv = purple_conversations_find_im_with_account(name, purple_connection_get_account(gc)); |
|
11706
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
723 | if (conv != NULL) |
|
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
724 | { |
| 15884 | 725 | im = PURPLE_CONV_IM(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
726 | |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
727 | if (purple_im_conversation_get_typing_state(im) == PURPLE_IM_CONVERSATION_NOT_TYPING) |
|
11706
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
728 | return; |
|
5032
2276c67b0243
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
729 | |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
730 | purple_im_conversation_stop_typing_timeout(im); |
|
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
731 | purple_im_conversation_set_typing_state(im, PURPLE_IM_CONVERSATION_NOT_TYPING); |
|
11706
e45dd5c7b259
[gaim-migrate @ 13997]
Richard Laager <rlaager@pidgin.im>
parents:
11643
diff
changeset
|
732 | } |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
733 | else |
|
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
734 | { |
| 15884 | 735 | purple_signal_emit(purple_conversations_get_handle(), |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
736 | "buddy-typing-stopped", purple_connection_get_account(gc), name); |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13791
diff
changeset
|
737 | } |
| 2993 | 738 | } |
| 1 | 739 | |
| 4487 | 740 | struct chat_invite_data { |
| 15884 | 741 | PurpleConnection *gc; |
| 5234 | 742 | GHashTable *components; |
| 4487 | 743 | }; |
| 1723 | 744 | |
| 4487 | 745 | static void chat_invite_data_free(struct chat_invite_data *cid) |
| 1 | 746 | { |
| 5234 | 747 | if (cid->components) |
| 748 | g_hash_table_destroy(cid->components); | |
| 4487 | 749 | g_free(cid); |
| 750 | } | |
| 1723 | 751 | |
|
8562
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 | static void chat_invite_reject(struct chat_invite_data *cid) |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
754 | { |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
755 | serv_reject_chat(cid->gc, cid->components); |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
756 | chat_invite_data_free(cid); |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
757 | } |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
758 | |
|
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
759 | |
| 4487 | 760 | static void chat_invite_accept(struct chat_invite_data *cid) |
| 761 | { | |
| 5234 | 762 | serv_join_chat(cid->gc, cid->components); |
| 4487 | 763 | chat_invite_data_free(cid); |
| 1 | 764 | } |
| 765 | ||
| 766 | ||
| 767 | ||
| 15884 | 768 | void serv_got_chat_invite(PurpleConnection *gc, const char *name, |
|
5630
a05d97d87690
[gaim-migrate @ 6037]
Mark Doliner <markdoliner@pidgin.im>
parents:
5602
diff
changeset
|
769 | const char *who, const char *message, GHashTable *data) |
| 1 | 770 | { |
| 15884 | 771 | PurpleAccount *account; |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
772 | char buf2[BUF_LONG]; |
|
25291
52482ea6d188
Fix a potential leak "KuSh" discovered using "cppcheck". Fixes #7863.
Daniel Atallah <datallah@pidgin.im>
parents:
24640
diff
changeset
|
773 | struct chat_invite_data *cid; |
| 11064 | 774 | int plugin_return; |
| 1 | 775 | |
|
28724
bbe9259aebaa
Make sure the room name and the buddy who invited you are non-null
Mark Doliner <markdoliner@pidgin.im>
parents:
28723
diff
changeset
|
776 | g_return_if_fail(name != NULL); |
|
bbe9259aebaa
Make sure the room name and the buddy who invited you are non-null
Mark Doliner <markdoliner@pidgin.im>
parents:
28723
diff
changeset
|
777 | g_return_if_fail(who != NULL); |
|
bbe9259aebaa
Make sure the room name and the buddy who invited you are non-null
Mark Doliner <markdoliner@pidgin.im>
parents:
28723
diff
changeset
|
778 | |
| 15884 | 779 | account = purple_connection_get_account(gc); |
|
34583
476c39afcaae
Refactored the libpurple core to use the GObject-based PurpleAccount
Ankit Vani <a@nevitus.org>
parents:
32678
diff
changeset
|
780 | if (!purple_account_privacy_check(account, who)) { |
|
28723
93de66f644a9
Call purple_privacy_check() even when the protocol has some privacy
Mark Doliner <markdoliner@pidgin.im>
parents:
28578
diff
changeset
|
781 | purple_signal_emit(purple_conversations_get_handle(), "chat-invite-blocked", |
|
93de66f644a9
Call purple_privacy_check() even when the protocol has some privacy
Mark Doliner <markdoliner@pidgin.im>
parents:
28578
diff
changeset
|
782 | account, who, name, message, data); |
|
93de66f644a9
Call purple_privacy_check() even when the protocol has some privacy
Mark Doliner <markdoliner@pidgin.im>
parents:
28578
diff
changeset
|
783 | return; |
| 12849 | 784 | } |
| 1 | 785 | |
|
25291
52482ea6d188
Fix a potential leak "KuSh" discovered using "cppcheck". Fixes #7863.
Daniel Atallah <datallah@pidgin.im>
parents:
24640
diff
changeset
|
786 | cid = g_new0(struct chat_invite_data, 1); |
|
52482ea6d188
Fix a potential leak "KuSh" discovered using "cppcheck". Fixes #7863.
Daniel Atallah <datallah@pidgin.im>
parents:
24640
diff
changeset
|
787 | |
| 15884 | 788 | plugin_return = GPOINTER_TO_INT(purple_signal_emit_return_1( |
| 789 | purple_conversations_get_handle(), | |
| 11064 | 790 | "chat-invited", account, who, name, message, data)); |
| 1 | 791 | |
| 4487 | 792 | cid->gc = gc; |
| 5234 | 793 | cid->components = data; |
| 1 | 794 | |
| 11064 | 795 | if (plugin_return == 0) |
| 796 | { | |
| 797 | if (message != NULL) | |
| 798 | { | |
| 799 | g_snprintf(buf2, sizeof(buf2), | |
| 800 | _("%s has invited %s to the chat room %s:\n%s"), | |
| 15884 | 801 | who, purple_account_get_username(account), name, message); |
| 11064 | 802 | } |
| 803 | else | |
| 804 | g_snprintf(buf2, sizeof(buf2), | |
| 805 | _("%s has invited %s to the chat room %s\n"), | |
| 15884 | 806 | who, purple_account_get_username(account), name); |
| 11064 | 807 | |
| 808 | ||
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
809 | 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
|
810 | PURPLE_DEFAULT_ACTION_NONE, account, who, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
811 | cid, G_CALLBACK(chat_invite_accept), |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8413
diff
changeset
|
812 | G_CALLBACK(chat_invite_reject)); |
| 11064 | 813 | } |
| 814 | else if (plugin_return > 0) | |
| 815 | chat_invite_accept(cid); | |
| 816 | else | |
| 817 | chat_invite_reject(cid); | |
| 1 | 818 | } |
| 819 | ||
| 15884 | 820 | PurpleConversation *serv_got_joined_chat(PurpleConnection *gc, |
|
5630
a05d97d87690
[gaim-migrate @ 6037]
Mark Doliner <markdoliner@pidgin.im>
parents:
5602
diff
changeset
|
821 | int id, const char *name) |
| 1 | 822 | { |
| 15884 | 823 | PurpleConversation *conv; |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
824 | PurpleChatConversation *chat; |
| 15884 | 825 | PurpleAccount *account; |
| 1 | 826 | |
| 15884 | 827 | account = purple_connection_get_account(gc); |
| 1 | 828 | |
|
27789
5862eda3c24d
Commit the QQ null chat room name crash on the *right* branch.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
829 | g_return_val_if_fail(account != NULL, NULL); |
|
5862eda3c24d
Commit the QQ null chat room name crash on the *right* branch.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
830 | g_return_val_if_fail(name != NULL, NULL); |
|
5862eda3c24d
Commit the QQ null chat room name crash on the *right* branch.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
831 | |
| 15884 | 832 | conv = purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name); |
|
27789
5862eda3c24d
Commit the QQ null chat room name crash on the *right* branch.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
833 | g_return_val_if_fail(conv != NULL, NULL); |
|
5862eda3c24d
Commit the QQ null chat room name crash on the *right* branch.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
834 | |
| 15884 | 835 | chat = PURPLE_CONV_CHAT(conv); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
836 | |
| 8256 | 837 | if (!g_slist_find(gc->buddy_chats, conv)) |
| 838 | gc->buddy_chats = g_slist_append(gc->buddy_chats, conv); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
839 | |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
840 | purple_chat_conversation_set_id(chat, id); |
|
4476
bf88170ba269
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4440
diff
changeset
|
841 | |
| 15884 | 842 | purple_signal_emit(purple_conversations_get_handle(), "chat-joined", conv); |
| 3710 | 843 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
844 | return conv; |
| 1 | 845 | } |
| 846 | ||
| 15884 | 847 | void serv_got_chat_left(PurpleConnection *g, int id) |
| 1 | 848 | { |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
849 | GSList *bcs; |
| 15884 | 850 | PurpleConversation *conv = NULL; |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
851 | PurpleChatConversation *chat = NULL; |
| 1 | 852 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
853 | for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { |
| 15884 | 854 | conv = (PurpleConversation *)bcs->data; |
| 1 | 855 | |
| 15884 | 856 | chat = PURPLE_CONV_CHAT(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
857 | |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
858 | if (purple_chat_conversation_get_id(chat) == id) |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
859 | break; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
860 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
861 | conv = NULL; |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
862 | } |
| 1 | 863 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
864 | if (!conv) |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
865 | return; |
| 1 | 866 | |
| 15884 | 867 | purple_debug(PURPLE_DEBUG_INFO, "server", "Leaving room: %s\n", |
| 868 | purple_conversation_get_name(conv)); | |
| 1 | 869 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
870 | g->buddy_chats = g_slist_remove(g->buddy_chats, conv); |
| 1 | 871 | |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
872 | purple_chat_conversation_left(PURPLE_CONV_CHAT(conv)); |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12677
diff
changeset
|
873 | |
| 15884 | 874 | purple_signal_emit(purple_conversations_get_handle(), "chat-left", conv); |
| 1 | 875 | } |
| 876 | ||
|
23270
2b7db16e721a
As discussed on the devel list, purple_serv_got_join_chat_failed() and the
Evan Schoenberg <evands@pidgin.im>
parents:
22920
diff
changeset
|
877 | void purple_serv_got_join_chat_failed(PurpleConnection *gc, GHashTable *data) |
|
22920
6681f6f71dfc
applied changes from feb2303b4209e0eeb4e20beaf151b1e4368c4e03
Evan Schoenberg <evands@pidgin.im>
parents:
22919
diff
changeset
|
878 | { |
|
6681f6f71dfc
applied changes from feb2303b4209e0eeb4e20beaf151b1e4368c4e03
Evan Schoenberg <evands@pidgin.im>
parents:
22919
diff
changeset
|
879 | purple_signal_emit(purple_conversations_get_handle(), "chat-join-failed", |
|
23270
2b7db16e721a
As discussed on the devel list, purple_serv_got_join_chat_failed() and the
Evan Schoenberg <evands@pidgin.im>
parents:
22920
diff
changeset
|
880 | gc, data); |
|
22920
6681f6f71dfc
applied changes from feb2303b4209e0eeb4e20beaf151b1e4368c4e03
Evan Schoenberg <evands@pidgin.im>
parents:
22919
diff
changeset
|
881 | } |
|
6681f6f71dfc
applied changes from feb2303b4209e0eeb4e20beaf151b1e4368c4e03
Evan Schoenberg <evands@pidgin.im>
parents:
22919
diff
changeset
|
882 | |
| 15884 | 883 | void serv_got_chat_in(PurpleConnection *g, int id, const char *who, |
| 884 | PurpleMessageFlags flags, const char *message, time_t mtime) | |
| 1 | 885 | { |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
886 | GSList *bcs; |
| 15884 | 887 | PurpleConversation *conv = NULL; |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
888 | PurpleChatConversation *chat = NULL; |
| 3163 | 889 | char *buffy, *angel; |
| 890 | int plugin_return; | |
| 1 | 891 | |
|
12894
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
892 | g_return_if_fail(who != NULL); |
|
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
893 | g_return_if_fail(message != NULL); |
|
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
894 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
895 | for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { |
| 15884 | 896 | conv = (PurpleConversation *)bcs->data; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
897 | |
| 15884 | 898 | chat = PURPLE_CONV_CHAT(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
899 | |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
900 | if (purple_chat_conversation_get_id(chat) == id) |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
901 | break; |
| 1 | 902 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
903 | conv = NULL; |
|
1252
94fbface2d84
[gaim-migrate @ 1262]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
904 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
905 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
906 | if (!conv) |
|
1100
efc7d10c7826
[gaim-migrate @ 1110]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1089
diff
changeset
|
907 | return; |
|
391
677e4414a83f
[gaim-migrate @ 401]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
368
diff
changeset
|
908 | |
|
25721
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
909 | /* Did I send the message? */ |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
910 | if (purple_strequal(purple_chat_conversation_get_nick(chat), |
|
25721
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
911 | purple_normalize(purple_conversation_get_account(conv), who))) { |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
912 | flags |= PURPLE_MESSAGE_SEND; |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
913 | flags &= ~PURPLE_MESSAGE_RECV; /* Just in case some prpl sets it! */ |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
914 | } else { |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
915 | flags |= PURPLE_MESSAGE_RECV; |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
916 | } |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25291
diff
changeset
|
917 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
918 | /* |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
919 | * Make copies of the message and the sender in case plugins want |
|
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
920 | * 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
|
921 | */ |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
922 | buffy = g_strdup(message); |
| 3163 | 923 | angel = g_strdup(who); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
924 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6479
diff
changeset
|
925 | plugin_return = GPOINTER_TO_INT( |
| 15884 | 926 | purple_signal_emit_return_1(purple_conversations_get_handle(), |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
927 | "receiving-chat-msg", purple_connection_get_account(g), |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12116
diff
changeset
|
928 | &angel, &buffy, conv, &flags)); |
| 3163 | 929 | |
| 930 | if (!buffy || !angel || plugin_return) { | |
|
12894
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
931 | g_free(buffy); |
|
acc0a48a8dc8
[gaim-migrate @ 15247]
Christopher O'Brien <siege@pidgin.im>
parents:
12849
diff
changeset
|
932 | g_free(angel); |
|
2372
c24942700dfd
[gaim-migrate @ 2385]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2359
diff
changeset
|
933 | return; |
| 3163 | 934 | } |
|
20641
bb5367e64507
Richard pointed out that this was dumb in an email to the devel
Mark Doliner <markdoliner@pidgin.im>
parents:
20080
diff
changeset
|
935 | |
| 3163 | 936 | who = angel; |
| 937 | message = buffy; | |
| 1 | 938 | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
939 | purple_signal_emit(purple_conversations_get_handle(), "received-chat-msg", purple_connection_get_account(g), |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12116
diff
changeset
|
940 | who, message, conv, flags); |
| 8999 | 941 | |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34583
diff
changeset
|
942 | purple_chat_conversation_write_message(chat, who, message, flags, mtime); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
943 | |
| 6350 | 944 | g_free(angel); |
|
6062
a292fd631fdb
[gaim-migrate @ 6512]
Mark Doliner <markdoliner@pidgin.im>
parents:
6059
diff
changeset
|
945 | g_free(buffy); |
| 1 | 946 | } |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9453
diff
changeset
|
947 | |
| 15884 | 948 | 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
|
949 | { |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
950 | PurplePlugin *prpl; |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
951 | PurplePluginProtocolInfo *prpl_info; |
|
10751
e15f4f5927ce
[gaim-migrate @ 12354]
Mark Doliner <markdoliner@pidgin.im>
parents:
10745
diff
changeset
|
952 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
953 | if (gc) { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
954 | prpl = purple_connection_get_prpl(gc); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21175
diff
changeset
|
955 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9453
diff
changeset
|
956 | |
|
28578
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
957 | if (prpl_info->send_file && |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
958 | (!prpl_info->can_receive_file |
|
74b2a6dba113
Change the way we handle these if checks to hopefully be a little
Mark Doliner <markdoliner@pidgin.im>
parents:
28577
diff
changeset
|
959 | || prpl_info->can_receive_file(gc, who))) |
|
9647
7ae5b5933b5a
[gaim-migrate @ 10495]
Daniel Atallah <datallah@pidgin.im>
parents:
9620
diff
changeset
|
960 | prpl_info->send_file(gc, who, file); |
|
7ae5b5933b5a
[gaim-migrate @ 10495]
Daniel Atallah <datallah@pidgin.im>
parents:
9620
diff
changeset
|
961 | } |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9453
diff
changeset
|
962 | } |