annotate libpurple/protocols/myspace/zap.c @ 27027:fdc0035bea5a

Change the way we parse messages on MySpace a little bit. This fixes #8846: people using web myspaceIM can't respond to pidgin myspaceIM For some reason IMs send using the myspace web site are sent so that they won't become offline messages if the other person is offline. I'm not really sure why that decision was made. So now we treat messages with bm 1 the same as messages with bm 121. This means we have to combine the function that parses out typing notification with the function that parses IMs. And we check for typing notifications by looking for %typing%. Which means if someone sends the IM "%typing%" with no markup then we'll interpret it as a typing notification. And there's nothing we can do to differentiate between the two. I asked.
author Mark Doliner <mark@kingant.net>
date Thu, 04 Jun 2009 05:19:49 +0000
parents e22bc87b758b
children 5fbcfcbd6551
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19937
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
1 /* MySpaceIM Protocol Plugin - zap support
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
2 *
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
3 * Copyright (C) 2007, Jeff Connelly <jeff2@soc.pidgin.im>
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
4 *
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
5 * This program is free software; you can redistribute it and/or modify
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
6 * it under the terms of the GNU General Public License as published by
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
7 * the Free Software Foundation; either version 2 of the License, or
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
8 * (at your option) any later version.
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
9 *
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
10 * This program is distributed in the hope that it will be useful,
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
13 * GNU General Public License for more details.
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
14 *
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
15 * You should have received a copy of the GNU General Public License
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
16 * along with this program; if not, write to the Free Software
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19716 19937
diff changeset
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
19937
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
18 */
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
19
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
20 #include "myspace.h"
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
21 #include "zap.h"
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
22
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
23 /** Get zap types. */
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
24 GList *
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
25 msim_attention_types(PurpleAccount *acct)
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
26 {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
27 static GList *types = NULL;
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
28 PurpleAttentionType* attn;
19937
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
29
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
30 if (!types) {
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
31 #define _MSIM_ADD_NEW_ATTENTION(icn, ulname, nme, incoming, outgoing) \
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
32 attn = purple_attention_type_new(ulname, nme, incoming, outgoing); \
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
33 purple_attention_type_set_icon_name(attn, icn); \
19937
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
34 types = g_list_append(types, attn);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
35
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
36 /* TODO: icons for each zap */
20729
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
37
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
38 /* Lots of comments for translators: */
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
39
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
40 /* Zap means "to strike suddenly and forcefully as if with a
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
41 * projectile or weapon." This term often has an electrical
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
42 * connotation, for example, "he was zapped by electricity when
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
43 * he put a fork in the toaster." */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
44 _MSIM_ADD_NEW_ATTENTION(NULL, "Zap", _("Zap"), _("%s has zapped you!"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
45 _("Zapping %s..."));
20729
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
46
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
47 /* Whack means "to hit or strike someone with a sharp blow" */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
48 _MSIM_ADD_NEW_ATTENTION(NULL, "Whack", _("Whack"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
49 _("%s has whacked you!"), _("Whacking %s..."));
20729
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
50
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
51 /* Torch means "to set on fire." Don't worry, this doesn't
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
52 * make a whole lot of sense in English, either. Feel free
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
53 * to translate it literally. */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
54 _MSIM_ADD_NEW_ATTENTION(NULL, "Torch", _("Torch"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
55 _("%s has torched you!"), _("Torching %s..."));
20729
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
56
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
57 /* Smooch means "to kiss someone, often enthusiastically" */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
58 _MSIM_ADD_NEW_ATTENTION(NULL, "Smooch", _("Smooch"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
59 _("%s has smooched you!"), _("Smooching %s..."));
20729
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
60
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
61 /* A hug is a display of affection; wrapping your arms around someone */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
62 _MSIM_ADD_NEW_ATTENTION(NULL, "Hug", _("Hug"), _("%s has hugged you!"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
63 _("Hugging %s..."));
20729
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
64
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
65 /* Slap means "to hit someone with an open/flat hand" */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
66 _MSIM_ADD_NEW_ATTENTION(NULL, "Slap", _("Slap"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
67 _("%s has slapped you!"), _("Slapping %s..."));
20729
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
68
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
69 /* Goose means "to pinch someone on their butt" */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
70 _MSIM_ADD_NEW_ATTENTION(NULL, "Goose", _("Goose"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
71 _("%s has goosed you!"), _("Goosing %s..."));
20729
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
72
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
73 /* A high-five is when two people's hands slap each other
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
74 * in the air above their heads. It is done to celebrate
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
75 * something, often a victory, or to congratulate someone. */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
76 _MSIM_ADD_NEW_ATTENTION(NULL, "High-five", _("High-five"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
77 _("%s has high-fived you!"), _("High-fiving %s..."));
20729
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
78
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
79 /* We're not entirely sure what the MySpace people mean by
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
80 * this... but we think it's the equivalent of "prank." Or, for
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
81 * someone to perform a mischievous trick or practical joke. */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
82 _MSIM_ADD_NEW_ATTENTION(NULL, "Punk", _("Punk"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
83 _("%s has punk'd you!"), _("Punking %s..."));
20729
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
84
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
85 /* Raspberry is a slang term for the vibrating sound made
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
86 * when you stick your tongue out of your mouth with your
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
87 * lips closed and blow. It is typically done when
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
88 * gloating or bragging. Nowadays it's a pretty silly
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
89 * gesture, so it does not carry a harsh negative
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
90 * connotation. It is generally used in a playful tone
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
91 * with friends. */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
92 _MSIM_ADD_NEW_ATTENTION(NULL, "Raspberry", _("Raspberry"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
93 _("%s has raspberried you!"), _("Raspberrying %s..."));
19937
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
94 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
95
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
96 return types;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
97 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
98
24767
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
99 /** Send a zap to a user. */
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
100 static gboolean
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
101 msim_send_zap(MsimSession *session, const gchar *username, guint code)
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
102 {
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
103 gchar *zap_string;
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
104 gboolean rc;
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
105
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
106 g_return_val_if_fail(session != NULL, FALSE);
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
107 g_return_val_if_fail(username != NULL, FALSE);
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
108
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
109 /* Construct and send the actual zap command. */
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
110 zap_string = g_strdup_printf("!!!ZAP_SEND!!!=RTE_BTN_ZAPS_%d", code);
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
111
27027
fdc0035bea5a Change the way we parse messages on MySpace a little bit. This
Mark Doliner <mark@kingant.net>
parents: 25883
diff changeset
112 if (!msim_send_bm(session, username, zap_string, MSIM_BM_INSTANT_ACTION_OR_IM)) {
24767
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
113 purple_debug_info("msim_send_zap",
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
114 "msim_send_bm failed: zapping %s with %s\n",
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
115 username, zap_string);
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
116 rc = FALSE;
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
117 } else {
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
118 rc = TRUE;
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
119 }
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
120
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
121 g_free(zap_string);
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
122
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
123 return rc;
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
124 }
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
125
19937
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
126 /** Send a zap */
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
127 gboolean
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
128 msim_send_attention(PurpleConnection *gc, const gchar *username, guint code)
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
129 {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
130 GList *types;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
131 MsimSession *session;
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
132 PurpleAttentionType *attn;
19937
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
133 PurpleBuddy *buddy;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
134
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
135 session = (MsimSession *)gc->proto_data;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
136
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
137 /* Look for this attention type, by the code index given. */
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
138 types = msim_attention_types(gc->account);
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
139 attn = (PurpleAttentionType *)g_list_nth_data(types, code);
19937
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
140
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
141 if (!attn) {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
142 purple_debug_info("msim_send_attention", "got invalid zap code %d\n", code);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
143 return FALSE;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
144 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
145
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
146 buddy = purple_find_buddy(session->account, username);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
147 if (!buddy) {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
148 return FALSE;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
149 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
150
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
151 msim_send_zap(session, username, code);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
152
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
153 return TRUE;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
154 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
155
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
156 /** Zap someone. Callback from msim_blist_node_menu zap menu. */
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
157 static void
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
158 msim_send_zap_from_menu(PurpleBlistNode *node, gpointer zap_num_ptr)
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
159 {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
160 PurpleBuddy *buddy;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
161 PurpleAccount *account;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
162 PurpleConnection *gc;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
163 MsimSession *session;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
164 guint zap;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
165
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
166 if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
167 /* Only know about buddies for now. */
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
168 return;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
169 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
170
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
171 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
172
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
173 buddy = (PurpleBuddy *)node;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
174
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
175 /* Find the session */
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23693
diff changeset
176 account = purple_buddy_get_account(buddy);
19937
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
177 gc = purple_account_get_connection(account);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
178 session = (MsimSession *)gc->proto_data;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
179
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
180 zap = GPOINTER_TO_INT(zap_num_ptr);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
181
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23693
diff changeset
182 purple_prpl_send_attention(session->gc, purple_buddy_get_name(buddy), zap);
19937
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
183 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
184
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
185 /** Return menu, if any, for a buddy list node. */
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
186 GList *
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
187 msim_blist_node_menu(PurpleBlistNode *node)
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
188 {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
189 GList *menu, *zap_menu;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
190 GList *types;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
191 PurpleMenuAction *act;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
192 guint i;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
193
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
194 if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
195 /* Only know about buddies for now. */
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
196 return NULL;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
197 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
198
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19716 19937
diff changeset
199 zap_menu = NULL;
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19716 19937
diff changeset
200
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19716 19937
diff changeset
201 /* TODO: get rid of once is accessible directly in GUI */
19937
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
202 types = msim_attention_types(NULL);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
203 i = 0;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
204 do
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
205 {
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
206 PurpleAttentionType *attn;
19937
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
207
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
208 attn = (PurpleAttentionType *)types->data;
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19716 19937
diff changeset
209
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
210 act = purple_menu_action_new(purple_attention_type_get_name(attn),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
211 PURPLE_CALLBACK(msim_send_zap_from_menu), GUINT_TO_POINTER(i), NULL);
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19716 19937
diff changeset
212 zap_menu = g_list_append(zap_menu, act);
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19716 19937
diff changeset
213
19937
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
214 ++i;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
215 } while ((types = g_list_next(types)));
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
216
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
217 act = purple_menu_action_new(_("Zap"), NULL, NULL, zap_menu);
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19716 19937
diff changeset
218 menu = g_list_append(NULL, act);
19937
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
219
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
220 return menu;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
221 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
222
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
223 /** Process an incoming zap. */
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
224 gboolean
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
225 msim_incoming_zap(MsimSession *session, MsimMessage *msg)
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
226 {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
227 gchar *msg_text, *username;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
228 gint zap;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
229
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
230 msg_text = msim_msg_get_string(msg, "msg");
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
231 username = msim_msg_get_string(msg, "_username");
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
232
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
233 g_return_val_if_fail(msg_text != NULL, FALSE);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
234 g_return_val_if_fail(username != NULL, FALSE);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
235
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
236 g_return_val_if_fail(sscanf(msg_text, "!!!ZAP_SEND!!!=RTE_BTN_ZAPS_%d", &zap) == 1, FALSE);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
237
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
238 zap = CLAMP(zap, 0, 9);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
239
23693
797377cbd5bf Change the other prpls to use new purple_prpl_{send,got}_attention API.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22097
diff changeset
240 purple_prpl_got_attention(session->gc, username, zap);
19937
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
241
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
242 g_free(msg_text);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
243 g_free(username);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
244
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
245 return TRUE;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
246 }