libpurple/protocols/myspace/zap.c

Mon, 01 Oct 2007 05:32:20 +0000

author
Mark Doliner <markdoliner@pidgin.im>
date
Mon, 01 Oct 2007 05:32:20 +0000
changeset 20794
f5cce8fbd243
parent 20376
40eb7fd73b9a
child 21076
bb293a21ce84
child 22225
6cd802a8c5ad
permissions
-rw-r--r--

Lots of comments for translators. I think I've seen these asked about
three times, and I don't often see translators ask about stuff.

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 static gboolean msim_send_zap(MsimSession *session, 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
24 static void 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
25
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 /** 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
28 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
29 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
30 {
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
31 static GList *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
32 MsimAttentionType* 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
33
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 if (!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
35 #define _MSIM_ADD_NEW_ATTENTION(icn, nme, incoming, outgoing) \
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 attn = g_new0(MsimAttentionType, 1); \
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
37 attn->icon_name = icn; \
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
38 attn->name = nme; \
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
39 attn->incoming_description = incoming; \
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
40 attn->outgoing_description = outgoing; \
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
41 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
42
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
43 /* 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
44
f5cce8fbd243 Lots of comments for translators. I think I've seen these asked about
Mark Doliner <markdoliner@pidgin.im>
parents: 20376
diff changeset
45 /* 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
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 /* 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
48 * 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
49 * 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
50 * he put a fork in the toaster." */
20376
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
51 _MSIM_ADD_NEW_ATTENTION(NULL, _("Zap"), _("%s has zapped you!"), _("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
52
f5cce8fbd243 Lots of comments for translators. I think I've seen these asked about
Mark Doliner <markdoliner@pidgin.im>
parents: 20376
diff changeset
53 /* Whack means "to hit or strike someone with a sharp blow" */
20376
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
54 _MSIM_ADD_NEW_ATTENTION(NULL, _("Whack"), _("%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
55
f5cce8fbd243 Lots of comments for translators. I think I've seen these asked about
Mark Doliner <markdoliner@pidgin.im>
parents: 20376
diff changeset
56 /* 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
57 * 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
58 * to translate it literally. */
20376
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
59 _MSIM_ADD_NEW_ATTENTION(NULL, _("Torch"), _("%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
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 /* Smooch means "to kiss someone, often enthusiastically" */
20376
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
62 _MSIM_ADD_NEW_ATTENTION(NULL, _("Smooch"), _("%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
63
f5cce8fbd243 Lots of comments for translators. I think I've seen these asked about
Mark Doliner <markdoliner@pidgin.im>
parents: 20376
diff changeset
64 /* A hug is a display of affection; wrapping your arms around someone */
20376
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
65 _MSIM_ADD_NEW_ATTENTION(NULL, _("Hug"), _("%s has hugged you!"), _("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
66
f5cce8fbd243 Lots of comments for translators. I think I've seen these asked about
Mark Doliner <markdoliner@pidgin.im>
parents: 20376
diff changeset
67 /* Slap means "to hit someone with an open/flat hand" */
20376
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
68 _MSIM_ADD_NEW_ATTENTION(NULL, _("Slap"), _("%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
69
f5cce8fbd243 Lots of comments for translators. I think I've seen these asked about
Mark Doliner <markdoliner@pidgin.im>
parents: 20376
diff changeset
70 /* Goose means "to pinch someone on their butt" */
20376
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
71 _MSIM_ADD_NEW_ATTENTION(NULL, _("Goose"), _("%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. */
20376
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
76 _MSIM_ADD_NEW_ATTENTION(NULL, _("High-five"), _("%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
77
f5cce8fbd243 Lots of comments for translators. I think I've seen these asked about
Mark Doliner <markdoliner@pidgin.im>
parents: 20376
diff changeset
78 /* 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
79 * 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
80 * someone to perform a mischievous trick or practical joke. */
20376
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
81 _MSIM_ADD_NEW_ATTENTION(NULL, _("Punk"), _("%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
82
f5cce8fbd243 Lots of comments for translators. I think I've seen these asked about
Mark Doliner <markdoliner@pidgin.im>
parents: 20376
diff changeset
83 /* 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
84 * 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
85 * 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
86 * 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
87 * 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
88 * 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
89 * with friends. */
20376
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
90 _MSIM_ADD_NEW_ATTENTION(NULL, _("Raspberry"), _("%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
91 }
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
92
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
93 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
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 /** 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
97 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
98 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
99 {
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
100 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
101 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
102 MsimAttentionType *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
103 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
104
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
105 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
106
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
107 /* 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
108 types = msim_attention_types(gc->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
109 attn = (MsimAttentionType *)g_list_nth_data(types, 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
110
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
111 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
112 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
113 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
114 }
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
115
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
116 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
117 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
118 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
119 }
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
120
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
121 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
122
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
123 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
124 }
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
125
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 to a user. */
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 static 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_zap(MsimSession *session, 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 gchar *zap_string;
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 gboolean rc;
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
132
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 g_return_val_if_fail(session != 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
134 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
135
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 /* Construct and send the actual zap command. */
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 zap_string = g_strdup_printf("!!!ZAP_SEND!!!=RTE_BTN_ZAPS_%d", 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
138
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
139 if (!msim_send_bm(session, username, zap_string, MSIM_BM_ACTION)) {
20376
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
140 purple_debug_info("msim_send_zap_from_menu", "msim_send_bm failed: zapping %s with %s\n",
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
141 username, zap_string);
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 rc = 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
143 } else {
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 rc = 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
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
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 g_free(zap_string);
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
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 return rc;
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 }
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 /** 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
154 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
155 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
156 {
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 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
158 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
159 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
160 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
161 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
162
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 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
164 /* 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
165 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
166 }
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
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 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
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 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
171
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 /* Find the 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
173 account = buddy->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
174 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
175 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
176
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 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
178
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 serv_send_attention(session->gc, buddy->name, 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
180 }
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
149d7d8284cc Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19641
diff changeset
182 /** 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
183 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
184 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
185 {
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 *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
187 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
188 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
189 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
190
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 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
192 /* 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
193 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
194 }
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
20376
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
196 zap_menu = NULL;
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
197
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
198 /* 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
199 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
200 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
201 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
202 {
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 MsimAttentionType *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
204
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 attn = (MsimAttentionType *)types->data;
20376
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
206
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
207 act = purple_menu_action_new(attn->name, PURPLE_CALLBACK(msim_send_zap_from_menu),
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
208 GUINT_TO_POINTER(i), NULL);
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
209 zap_menu = g_list_append(zap_menu, act);
40eb7fd73b9a merge of 'f78451b4a2f7106eb8f8fa7275a7a29230593449'
Casey Harkins <charkins@pidgin.im>
parents: 19915 19795
diff changeset
210
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
211 ++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
212 } 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
213
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 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
215 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
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 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
218 }
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 /** 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
221 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
222 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
223 {
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 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
225 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
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 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
228 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
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 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
231 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
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(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
234
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 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
236
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 serv_got_attention(session->gc, username, 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
238
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 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
240 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
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 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
243 }
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

mercurial