libpurple/protocols/myspace/zap.c

Thu, 14 Jan 2010 19:49:03 +0000

author
Mark Doliner <markdoliner@pidgin.im>
date
Thu, 14 Jan 2010 19:49:03 +0000
changeset 29207
dcf281b384d2
parent 27377
fdb28b8d9ef4
child 32262
c764e87d4b34
child 32438
dc8991868906
child 35997
23e05a4a90b3
permissions
-rw-r--r--

Call msim_user_free here to make sure we cancel url_data and free one or
two other fields that could be set.

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

mercurial