annotate libpurple/protocols/myspace/zap.c @ 23451:52a1f5950f46

fixed formatting and get/set properties
author Justin Rodriguez <ffdragon@soc.pidgin.im>
date Sat, 07 Jun 2008 01:55:23 +0000
parents eab7d03edfcb
children 797377cbd5bf
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;
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
32 PurpleAttentionType* attn;
19892
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) {
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
35 #define _MSIM_ADD_NEW_ATTENTION(icn, ulname, nme, incoming, outgoing) \
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
36 attn = purple_attention_type_new(ulname, nme, incoming, outgoing); \
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
37 purple_attention_type_set_icon_name(attn, icn); \
19892
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
38 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
39
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
40 /* 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
41
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
42 /* 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
43
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
44 /* 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
45 * 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
46 * 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
47 * he put a fork in the toaster." */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
48 _MSIM_ADD_NEW_ATTENTION(NULL, "Zap", _("Zap"), _("%s has zapped you!"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
49 _("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
50
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
51 /* Whack means "to hit or strike someone with a sharp blow" */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
52 _MSIM_ADD_NEW_ATTENTION(NULL, "Whack", _("Whack"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
53 _("%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
54
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
55 /* 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
56 * 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
57 * to translate it literally. */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
58 _MSIM_ADD_NEW_ATTENTION(NULL, "Torch", _("Torch"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
59 _("%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" */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
62 _MSIM_ADD_NEW_ATTENTION(NULL, "Smooch", _("Smooch"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
63 _("%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
64
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
65 /* A hug is a display of affection; wrapping your arms around someone */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
66 _MSIM_ADD_NEW_ATTENTION(NULL, "Hug", _("Hug"), _("%s has hugged you!"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
67 _("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
68
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
69 /* Slap means "to hit someone with an open/flat hand" */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
70 _MSIM_ADD_NEW_ATTENTION(NULL, "Slap", _("Slap"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
71 _("%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
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 /* Goose means "to pinch someone on their butt" */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
74 _MSIM_ADD_NEW_ATTENTION(NULL, "Goose", _("Goose"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
75 _("%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
76
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
77 /* 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
78 * 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
79 * something, often a victory, or to congratulate someone. */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
80 _MSIM_ADD_NEW_ATTENTION(NULL, "High-five", _("High-five"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
81 _("%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
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 /* 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
84 * 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
85 * someone to perform a mischievous trick or practical joke. */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
86 _MSIM_ADD_NEW_ATTENTION(NULL, "Punk", _("Punk"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
87 _("%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
88
c99f6ea2634d Lots of comments for translators. I think I've seen these asked about
Mark Doliner <mark@kingant.net>
parents: 20147
diff changeset
89 /* 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
90 * 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
91 * 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
92 * 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
93 * 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
94 * 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
95 * with friends. */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
96 _MSIM_ADD_NEW_ATTENTION(NULL, "Raspberry", _("Raspberry"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
97 _("%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
98 }
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 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
101 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
102
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
103 /** 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
104 gboolean
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
105 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
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 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
108 MsimSession *session;
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
109 PurpleAttentionType *attn;
19892
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
110 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
111
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
112 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
113
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
114 /* 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
115 types = msim_attention_types(gc->account);
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
116 attn = (PurpleAttentionType *)g_list_nth_data(types, code);
19892
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
117
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
118 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
119 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
120 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
121 }
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 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
124 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
125 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
126 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
127
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(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
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 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
131 }
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 /** 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
134 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
135 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
136 {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
137 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
138 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
139
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
140 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
141 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
142
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
143 /* 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
144 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
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 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
147 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
148 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
149 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
150 } else {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
151 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
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
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
154 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
155
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
156 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
157
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
158 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
159
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
160 /** 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
161 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
162 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
163 {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
164 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
165 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
166 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
167 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
168 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
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 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
171 /* 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
172 return;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
173 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
174
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
175 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
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 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
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 /* 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
180 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
181 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
182 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
183
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
184 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
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 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
187 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
188
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
189 /** 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
190 GList *
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
191 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
192 {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
193 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
194 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
195 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
196 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
197
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
198 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
199 /* 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
200 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
201 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
202
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
203 zap_menu = NULL;
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
204
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
205 /* 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
206 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
207 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
208 do
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
209 {
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
210 PurpleAttentionType *attn;
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
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
212 attn = (PurpleAttentionType *)types->data;
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
213
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
214 act = purple_menu_action_new(purple_attention_type_get_name(attn),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20729
diff changeset
215 PURPLE_CALLBACK(msim_send_zap_from_menu), GUINT_TO_POINTER(i), NULL);
20147
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
216 zap_menu = g_list_append(zap_menu, act);
51457cf3d27b merge of '0fb234fbd6f0cbba882df8df649a783fea7f312f'
Casey Harkins <charkins@pidgin.im>
parents: 19715 19892
diff changeset
217
19892
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
218 ++i;
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
219 } 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
220
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
221 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
222 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
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 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
225 }
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 /** 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
228 gboolean
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
229 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
230 {
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
231 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
232 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
233
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
234 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
235 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
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 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
238 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
239
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_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
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 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
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 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
245
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
246 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
247 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
248
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
249 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
250 }
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
251
36ba89a2b7da Replace all CRLF line-endings with LF line endings (Unix-style). This fixes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19463
diff changeset
252