Fri, 28 Sep 2007 17:05:20 +0000
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
re-application of the fix in 149d7d8284ccacaa774afaac83d3b5ee975c0372.
|
20153
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
1 | /* MySpaceIM Protocol Plugin - zap support |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
2 | * |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
3 | * Copyright (C) 2007, Jeff Connelly <jeff2@soc.pidgin.im> |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
4 | * |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
5 | * This program is free software; you can redistribute it and/or modify |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
7 | * the Free Software Foundation; either version 2 of the License, or |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
8 | * (at your option) any later version. |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
9 | * |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
13 | * GNU General Public License for more details. |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
14 | * |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
16 | * along with this program; if not, write to the Free Software |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
18 | */ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
19 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
20 | #include "myspace.h" |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
21 | #include "zap.h" |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
22 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
23 | static gboolean msim_send_zap(MsimSession *session, const gchar *username, guint code); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
24 | static void msim_send_zap_from_menu(PurpleBlistNode *node, gpointer zap_num_ptr); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
25 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
26 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
27 | /** Get zap types. */ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
28 | GList * |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
29 | msim_attention_types(PurpleAccount *acct) |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
30 | { |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
31 | static GList *types = NULL; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
32 | MsimAttentionType* attn; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
33 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
34 | if (!types) { |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
35 | #define _MSIM_ADD_NEW_ATTENTION(icn, nme, incoming, outgoing) \ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
36 | attn = g_new0(MsimAttentionType, 1); \ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
37 | attn->icon_name = icn; \ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
38 | attn->name = nme; \ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
39 | attn->incoming_description = incoming; \ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
40 | attn->outgoing_description = outgoing; \ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
41 | types = g_list_append(types, attn); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
42 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
43 | /* TODO: icons for each zap */ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
44 | _MSIM_ADD_NEW_ATTENTION(NULL, _("Zap"), _("%s has zapped you!"), _("Zapping %s...")); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
45 | _MSIM_ADD_NEW_ATTENTION(NULL, _("Whack"), _("%s has whacked you!"), _("Whacking %s...")); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
46 | _MSIM_ADD_NEW_ATTENTION(NULL, _("Torch"), _("%s has torched you!"), _("Torching %s...")); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
47 | _MSIM_ADD_NEW_ATTENTION(NULL, _("Smooch"), _("%s has smooched you!"), _("Smooching %s...")); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
48 | _MSIM_ADD_NEW_ATTENTION(NULL, _("Hug"), _("%s has hugged you!"), _("Hugging %s...")); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
49 | _MSIM_ADD_NEW_ATTENTION(NULL, _("Slap"), _("%s has slapped you!"), _("Slapping %s...")); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
50 | _MSIM_ADD_NEW_ATTENTION(NULL, _("Goose"), _("%s has goosed you!"), _("Goosing %s...")); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
51 | _MSIM_ADD_NEW_ATTENTION(NULL, _("High-five"), _("%s has high-fived you!"), _("High-fiving %s...")); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
52 | _MSIM_ADD_NEW_ATTENTION(NULL, _("Punk"), _("%s has punk'd you!"), _("Punking %s...")); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
53 | _MSIM_ADD_NEW_ATTENTION(NULL, _("Raspberry"), _("%s has raspberried you!"), _("Raspberrying %s...")); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
54 | } |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
55 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
56 | return types; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
57 | } |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
58 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
59 | /** Send a zap */ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
60 | gboolean |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
61 | msim_send_attention(PurpleConnection *gc, const gchar *username, guint code) |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
62 | { |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
63 | GList *types; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
64 | MsimSession *session; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
65 | MsimAttentionType *attn; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
66 | PurpleBuddy *buddy; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
67 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
68 | session = (MsimSession *)gc->proto_data; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
69 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
70 | /* Look for this attention type, by the code index given. */ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
71 | types = msim_attention_types(gc->account); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
72 | attn = (MsimAttentionType *)g_list_nth_data(types, code); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
73 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
74 | if (!attn) { |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
75 | purple_debug_info("msim_send_attention", "got invalid zap code %d\n", code); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
76 | return FALSE; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
77 | } |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
78 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
79 | buddy = purple_find_buddy(session->account, username); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
80 | if (!buddy) { |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
81 | return FALSE; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
82 | } |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
83 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
84 | msim_send_zap(session, username, code); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
85 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
86 | return TRUE; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
87 | } |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
88 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
89 | /** Send a zap to a user. */ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
90 | static gboolean |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
91 | msim_send_zap(MsimSession *session, const gchar *username, guint code) |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
92 | { |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
93 | gchar *zap_string; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
94 | gboolean rc; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
95 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
96 | g_return_val_if_fail(session != NULL, FALSE); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
97 | g_return_val_if_fail(username != NULL, FALSE); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
98 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
99 | /* Construct and send the actual zap command. */ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
100 | zap_string = g_strdup_printf("!!!ZAP_SEND!!!=RTE_BTN_ZAPS_%d", code); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
101 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
102 | if (!msim_send_bm(session, username, zap_string, MSIM_BM_ACTION)) { |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
103 | purple_debug_info("msim_send_zap_from_menu", "msim_send_bm failed: zapping %s with %s\n", |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
104 | username, zap_string); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
105 | rc = FALSE; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
106 | } else { |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
107 | rc = TRUE; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
108 | } |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
109 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
110 | g_free(zap_string); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
111 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
112 | return rc; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
113 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
114 | } |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
115 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
116 | /** Zap someone. Callback from msim_blist_node_menu zap menu. */ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
117 | static void |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
118 | msim_send_zap_from_menu(PurpleBlistNode *node, gpointer zap_num_ptr) |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
119 | { |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
120 | PurpleBuddy *buddy; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
121 | PurpleAccount *account; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
122 | PurpleConnection *gc; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
123 | MsimSession *session; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
124 | guint zap; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
125 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
126 | if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
127 | /* Only know about buddies for now. */ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
128 | return; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
129 | } |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
130 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
131 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
132 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
133 | buddy = (PurpleBuddy *)node; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
134 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
135 | /* Find the session */ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
136 | account = buddy->account; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
137 | gc = purple_account_get_connection(account); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
138 | session = (MsimSession *)gc->proto_data; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
139 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
140 | zap = GPOINTER_TO_INT(zap_num_ptr); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
141 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
142 | serv_send_attention(session->gc, buddy->name, zap); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
143 | } |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
144 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
145 | /** Return menu, if any, for a buddy list node. */ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
146 | GList * |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
147 | msim_blist_node_menu(PurpleBlistNode *node) |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
148 | { |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
149 | GList *menu, *zap_menu; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
150 | GList *types; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
151 | PurpleMenuAction *act; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
152 | guint i; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
153 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
154 | if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
155 | /* Only know about buddies for now. */ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
156 | return NULL; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
157 | } |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
158 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
159 | zap_menu = NULL; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
160 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
161 | /* TODO: get rid of once is accessible directly in GUI */ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
162 | types = msim_attention_types(NULL); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
163 | i = 0; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
164 | do |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
165 | { |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
166 | MsimAttentionType *attn; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
167 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
168 | attn = (MsimAttentionType *)types->data; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
169 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
170 | act = purple_menu_action_new(attn->name, PURPLE_CALLBACK(msim_send_zap_from_menu), |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
171 | GUINT_TO_POINTER(i), NULL); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
172 | zap_menu = g_list_append(zap_menu, act); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
173 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
174 | ++i; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
175 | } while ((types = g_list_next(types))); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
176 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
177 | act = purple_menu_action_new(_("Zap"), NULL, NULL, zap_menu); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
178 | menu = g_list_append(NULL, act); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
179 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
180 | return menu; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
181 | } |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
182 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
183 | /** Process an incoming zap. */ |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
184 | gboolean |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
185 | msim_incoming_zap(MsimSession *session, MsimMessage *msg) |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
186 | { |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
187 | gchar *msg_text, *username; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
188 | gint zap; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
189 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
190 | msg_text = msim_msg_get_string(msg, "msg"); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
191 | username = msim_msg_get_string(msg, "_username"); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
192 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
193 | g_return_val_if_fail(msg_text != NULL, FALSE); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
194 | g_return_val_if_fail(username != NULL, FALSE); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
195 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
196 | g_return_val_if_fail(sscanf(msg_text, "!!!ZAP_SEND!!!=RTE_BTN_ZAPS_%d", &zap) == 1, FALSE); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
197 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
198 | zap = CLAMP(zap, 0, 9); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
199 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
200 | serv_got_attention(session->gc, username, zap); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
201 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
202 | g_free(msg_text); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
203 | g_free(username); |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
204 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
205 | return TRUE; |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
206 | } |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
207 | |
|
7cdc9e4882df
Kill CRLF line-endings to make sure this compiles on Solaris. This is a
Richard Laager <rlaager@pidgin.im>
parents:
19915
diff
changeset
|
208 |