annotate libpurple/protocols/myspace/zap.c @ 21709:b2c2e935a150

Remove useless cast I missed before.
author Kevin Stange <kevin@simguy.net>
date Sat, 01 Dec 2007 09:08:43 +0000
parents c99f6ea2634d
children 89c7be36fd61 eab7d03edfcb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19892
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: 19715 19892
diff changeset
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
19892
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 static gboolean msim_send_zap(MsimSession *session, 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
24 static void 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
25
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 /** 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
28 GList *
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
29 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
30 {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
31 static GList *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
32 MsimAttentionType* attn;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
33
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
34 if (!types) {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
35 #define _MSIM_ADD_NEW_ATTENTION(icn, nme, incoming, outgoing) \
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
36 attn = g_new0(MsimAttentionType, 1); \
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
37 attn->icon_name = icn; \
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
38 attn->name = nme; \
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
39 attn->incoming_description = incoming; \
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
40 attn->outgoing_description = outgoing; \
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
41 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
42
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
43 /* 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
44
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
45 /* 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
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 /* 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
48 * 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
49 * 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
50 * he put a fork in the toaster." */
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
51 _MSIM_ADD_NEW_ATTENTION(NULL, _("Zap"), _("%s has zapped you!"), _("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
52
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
53 /* Whack means "to hit or strike someone with a sharp blow" */
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
54 _MSIM_ADD_NEW_ATTENTION(NULL, _("Whack"), _("%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
55
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
56 /* 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
57 * 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
58 * to translate it literally. */
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
59 _MSIM_ADD_NEW_ATTENTION(NULL, _("Torch"), _("%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
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 /* Smooch means "to kiss someone, often enthusiastically" */
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
62 _MSIM_ADD_NEW_ATTENTION(NULL, _("Smooch"), _("%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
63
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
64 /* A hug is a display of affection; wrapping your arms around someone */
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
65 _MSIM_ADD_NEW_ATTENTION(NULL, _("Hug"), _("%s has hugged you!"), _("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
66
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
67 /* Slap means "to hit someone with an open/flat hand" */
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
68 _MSIM_ADD_NEW_ATTENTION(NULL, _("Slap"), _("%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
69
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
70 /* Goose means "to pinch someone on their butt" */
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
71 _MSIM_ADD_NEW_ATTENTION(NULL, _("Goose"), _("%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. */
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
76 _MSIM_ADD_NEW_ATTENTION(NULL, _("High-five"), _("%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
77
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
78 /* 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
79 * 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
80 * someone to perform a mischievous trick or practical joke. */
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
81 _MSIM_ADD_NEW_ATTENTION(NULL, _("Punk"), _("%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
82
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
83 /* 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
84 * 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
85 * 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
86 * 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
87 * 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
88 * 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
89 * with friends. */
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
90 _MSIM_ADD_NEW_ATTENTION(NULL, _("Raspberry"), _("%s has raspberried you!"), _("Raspberrying %s..."));
19892
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
91 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
92
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
93 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
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 /** 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
97 gboolean
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
98 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
99 {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
100 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
101 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
102 MsimAttentionType *attn;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
103 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
104
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
105 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
106
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
107 /* 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
108 types = msim_attention_types(gc->account);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
109 attn = (MsimAttentionType *)g_list_nth_data(types, code);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
110
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
111 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
112 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
113 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
114 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
115
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
116 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
117 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
118 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
119 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
120
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
121 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
122
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
123 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
124 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
125
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 to a user. */
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
127 static 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_zap(MsimSession *session, 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 gchar *zap_string;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
131 gboolean rc;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
132
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
133 g_return_val_if_fail(session != 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
134 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
135
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
136 /* Construct and send the actual zap command. */
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
137 zap_string = g_strdup_printf("!!!ZAP_SEND!!!=RTE_BTN_ZAPS_%d", code);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
138
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
139 if (!msim_send_bm(session, username, zap_string, MSIM_BM_ACTION)) {
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
140 purple_debug_info("msim_send_zap_from_menu", "msim_send_bm failed: zapping %s with %s\n",
19892
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
141 username, zap_string);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
142 rc = FALSE;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
143 } else {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
144 rc = TRUE;
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
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
147 g_free(zap_string);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
148
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
149 return rc;
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 }
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 /** 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
154 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
155 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
156 {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
157 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
158 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
159 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
160 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
161 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
162
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
163 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
164 /* 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
165 return;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
166 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
167
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
168 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
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 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
171
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
172 /* Find the session */
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
173 account = buddy->account;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
174 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
175 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
176
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
177 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
178
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
179 serv_send_attention(session->gc, buddy->name, zap);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
180 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
181
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
182 /** 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
183 GList *
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
184 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
185 {
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 *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
187 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
188 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
189 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
190
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
191 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
192 /* 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
193 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
194 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
195
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
196 zap_menu = NULL;
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
197
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
198 /* TODO: get rid of once is accessible directly in GUI */
19892
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
199 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
200 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
201 do
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
202 {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
203 MsimAttentionType *attn;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
204
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
205 attn = (MsimAttentionType *)types->data;
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
206
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
207 act = purple_menu_action_new(attn->name, PURPLE_CALLBACK(msim_send_zap_from_menu),
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
208 GUINT_TO_POINTER(i), NULL);
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
209 zap_menu = g_list_append(zap_menu, act);
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
210
19892
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
211 ++i;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
212 } 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
213
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
214 act = purple_menu_action_new(_("Zap"), NULL, NULL, zap_menu);
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
215 menu = g_list_append(NULL, act);
19892
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 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
218 }
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 /** 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
221 gboolean
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
222 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
223 {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
224 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
225 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
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 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
228 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
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 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
231 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
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(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
234
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
235 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
236
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
237 serv_got_attention(session->gc, username, zap);
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
238
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
239 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
240 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
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 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
243 }
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