annotate libpurple/protocols/myspace/zap.c @ 19461:1b5e786d137a

In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im() instead of manually writing to the conversation window, as suggested by sadrul at http://pidgin.im/pipermail/devel/2007-August/002935.html. Yahoo and MSN already use this flag to indicate an attention/notify-type message. Also split off half of serv_got_attention() into serv_send_attention(), see http://pidgin.im/pipermail/devel/2007-August/002940.html. Now the attention API integrates well with the patch to add PURPLE_MESSAGE_NOTIFY at http://hiks.net/drop/adium/libgaim.diff. See also: https://sourceforge.net/tracker/?func=detail&atid=300235&aid=1672389&group_id=235
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Mon, 27 Aug 2007 01:36:21 +0000
parents 210f792efd7c
children 3f6f84d11ce2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19432
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
1 /* MySpaceIM Protocol Plugin - zap support
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
2 *
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
3 * Copyright (C) 2007, Jeff Connelly <jeff2@soc.pidgin.im>
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
4 *
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
7 * the Free Software Foundation; either version 2 of the License, or
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
8 * (at your option) any later version.
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
9 *
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
13 * GNU General Public License for more details.
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
14 *
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
16 * along with this program; if not, write to the Free Software
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
18 */
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
19
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
20 #include "myspace.h"
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
21 #include "zap.h"
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
22
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
23 static gboolean msim_send_zap(MsimSession *session, const gchar *username, guint code);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
24 static void msim_send_zap_from_menu(PurpleBlistNode *node, gpointer zap_num_ptr);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
25
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
26
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
27 /** Get zap types. */
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
28 GList *
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
29 msim_attention_types(PurpleAccount *acct)
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
30 {
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
31 static GList *types = NULL;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
32 MsimAttentionType* attn;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
33
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
34 if (!types) {
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
35 #define _MSIM_ADD_NEW_ATTENTION(icn, nme, incoming, outgoing) \
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
36 attn = g_new0(MsimAttentionType, 1); \
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
37 attn->icon_name = icn; \
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
38 attn->name = nme; \
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
39 attn->incoming_description = incoming; \
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
40 attn->outgoing_description = outgoing; \
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
41 types = g_list_append(types, attn);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
42
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
43 /* TODO: icons for each zap */
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
44 _MSIM_ADD_NEW_ATTENTION(NULL, _("zap"), _("zapped"), _("Zapping"));
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
45 _MSIM_ADD_NEW_ATTENTION(NULL, _("whack"), _("whacked"), _("Whacking"));
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
46 _MSIM_ADD_NEW_ATTENTION(NULL, _("torch"), _("torched"), _("Torching"));
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
47 _MSIM_ADD_NEW_ATTENTION(NULL, _("smooch"), _("smooched"), _("Smooching"));
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
48 _MSIM_ADD_NEW_ATTENTION(NULL, _("hug"), _("hugged"), _("Hugging"));
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
49 _MSIM_ADD_NEW_ATTENTION(NULL, _("bslap"), _("bslapped"), _("Bslapping"));
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
50 _MSIM_ADD_NEW_ATTENTION(NULL, _("goose"), _("goosed"), _("Goosing"));
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
51 _MSIM_ADD_NEW_ATTENTION(NULL, _("hi-five"), _("hi-fived"), _("Hi-fiving"));
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
52 _MSIM_ADD_NEW_ATTENTION(NULL, _("punk"), _("punk'd"), _("Punking"));
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
53 _MSIM_ADD_NEW_ATTENTION(NULL, _("raspberry"), _("raspberried"), _("Raspberry'ing"));
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
54 }
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
55
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
56 return types;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
57 }
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
58
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
59 /** Send a zap */
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
60 gboolean
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
61 msim_send_attention(PurpleConnection *gc, const gchar *username, guint code)
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
62 {
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
63 GList *types;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
64 MsimSession *session;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
65 MsimAttentionType *attn;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
66 PurpleBuddy *buddy;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
67
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
68 session = (MsimSession *)gc->proto_data;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
69
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
70 /* Look for this attention type, by the code index given. */
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
71 types = msim_attention_types(gc->account);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
72 attn = (MsimAttentionType *)g_list_nth_data(types, code);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
73
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
74 if (!attn) {
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
75 purple_debug_info("msim_send_attention", "got invalid zap code %d\n", code);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
76 return FALSE;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
77 }
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
78
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
79 buddy = purple_find_buddy(session->account, username);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
80 if (!buddy) {
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
81 return FALSE;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
82 }
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
83
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
84 /* TODO: make use of the MsimAttentionType we found, instead of
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
85 * doing it all over in msim_send_zap_from_menu. */
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
86 msim_send_zap_from_menu(&buddy->node, GUINT_TO_POINTER(code));
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
87
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
88 return TRUE;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
89 }
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
90
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
91 /** Send a zap to a user. */
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
92 static gboolean
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
93 msim_send_zap(MsimSession *session, const gchar *username, guint code)
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
94 {
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
95 gchar *zap_string;
19461
1b5e786d137a In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19432
diff changeset
96 gboolean rc;
19432
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
97 #ifndef MSIM_USE_ATTENTION_API
19461
1b5e786d137a In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19432
diff changeset
98 GList *types;
1b5e786d137a In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19432
diff changeset
99 MsimAttentionType *attn;
19432
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
100 gchar *zap_description;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
101 #endif
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
102
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
103 g_return_val_if_fail(session != NULL, FALSE);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
104 g_return_val_if_fail(username != NULL, FALSE);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
105
19461
1b5e786d137a In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19432
diff changeset
106
1b5e786d137a In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19432
diff changeset
107 #ifdef MSIM_USE_ATTENTION_API
1b5e786d137a In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19432
diff changeset
108 serv_send_attention(session->gc, username, code);
1b5e786d137a In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19432
diff changeset
109 #else
19432
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
110 types = msim_attention_types(session->account);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
111
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
112 attn = g_list_nth_data(types, code);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
113 if (!attn) {
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
114 return FALSE;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
115 }
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
116
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
117
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
118 zap_description = g_strdup_printf("*** Attention: %s %s ***", attn->outgoing_description,
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
119 username);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
120
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
121 serv_got_im(session->gc, username, zap_description,
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
122 PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_SYSTEM, time(NULL));
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
123
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
124 g_free(zap_description);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
125 #endif
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
126
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
127 /* Construct and send the actual zap command. */
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
128 zap_string = g_strdup_printf("!!!ZAP_SEND!!!=RTE_BTN_ZAPS_%d", code);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
129
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
130 if (!msim_send_bm(session, username, zap_string, MSIM_BM_ACTION)) {
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
131 purple_debug_info("msim_send_zap_from_menu", "msim_send_bm failed: zapping %s with %s",
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
132 username, zap_string);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
133 rc = FALSE;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
134 } else {
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
135 rc = TRUE;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
136 }
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
137
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
138 g_free(zap_string);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
139
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
140 return rc;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
141
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
142 }
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
143
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
144 /** Zap someone. Callback from msim_blist_node_menu zap menu. */
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
145 static void
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
146 msim_send_zap_from_menu(PurpleBlistNode *node, gpointer zap_num_ptr)
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
147 {
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
148 PurpleBuddy *buddy;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
149 PurpleAccount *account;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
150 PurpleConnection *gc;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
151 MsimSession *session;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
152 guint zap;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
153
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
154 if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) {
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
155 /* Only know about buddies for now. */
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
156 return;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
157 }
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
158
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
159 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
160
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
161 buddy = (PurpleBuddy *)node;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
162
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
163 /* Find the session */
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
164 account = buddy->account;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
165 gc = purple_account_get_connection(account);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
166 session = (MsimSession *)gc->proto_data;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
167
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
168 zap = GPOINTER_TO_INT(zap_num_ptr);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
169
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
170 g_return_if_fail(msim_send_zap(session, buddy->name, zap));
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
171 }
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
172
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
173 /** Return menu, if any, for a buddy list node. */
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
174 GList *
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
175 msim_blist_node_menu(PurpleBlistNode *node)
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
176 {
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
177 GList *menu, *zap_menu;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
178 GList *types;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
179 PurpleMenuAction *act;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
180 /* Warning: hardcoded to match that in msim_attention_types. */
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
181 const gchar *zap_names[10];
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
182 guint i;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
183
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
184 if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) {
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
185 /* Only know about buddies for now. */
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
186 return NULL;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
187 }
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
188
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
189 /* Names from official client. */
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
190 types = msim_attention_types(NULL);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
191 i = 0;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
192 do
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
193 {
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
194 MsimAttentionType *attn;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
195
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
196 attn = (MsimAttentionType *)types->data;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
197 zap_names[i] = attn->name;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
198 ++i;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
199 } while ((types = g_list_next(types)));
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
200
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
201 menu = zap_menu = NULL;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
202
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
203 /* TODO: get rid of once is accessible directly in GUI */
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
204 for (i = 0; i < sizeof(zap_names) / sizeof(zap_names[0]); ++i) {
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
205 act = purple_menu_action_new(zap_names[i], PURPLE_CALLBACK(msim_send_zap_from_menu),
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
206 GUINT_TO_POINTER(i), NULL);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
207 zap_menu = g_list_append(zap_menu, act);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
208 }
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
209
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
210 act = purple_menu_action_new(_("Zap"), NULL, NULL, zap_menu);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
211 menu = g_list_append(menu, act);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
212
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
213 return menu;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
214 }
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
215
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
216 /** Process an incoming zap. */
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
217 gboolean
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
218 msim_incoming_zap(MsimSession *session, MsimMessage *msg)
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
219 {
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
220 gchar *msg_text, *username;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
221 gint zap;
19461
1b5e786d137a In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19432
diff changeset
222 #ifndef MSIM_USE_ATTENTION_API
19432
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
223 const gchar *zap_past_tense[10];
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
224 gchar *zap_text;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
225
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
226 zap_past_tense[0] = _("zapped");
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
227 zap_past_tense[1] = _("whacked");
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
228 zap_past_tense[2] = _("torched");
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
229 zap_past_tense[3] = _("smooched");
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
230 zap_past_tense[4] = _("hugged");
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
231 zap_past_tense[5] = _("bslapped");
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
232 zap_past_tense[6] = _("goosed");
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
233 zap_past_tense[7] = _("hi-fived");
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
234 zap_past_tense[8] = _("punk'd");
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
235 zap_past_tense[9] = _("raspberried");
19461
1b5e786d137a In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19432
diff changeset
236 #endif
19432
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
237
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
238 msg_text = msim_msg_get_string(msg, "msg");
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
239 username = msim_msg_get_string(msg, "_username");
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
240
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
241 g_return_val_if_fail(msg_text != NULL, FALSE);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
242 g_return_val_if_fail(username != NULL, FALSE);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
243
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
244 g_return_val_if_fail(sscanf(msg_text, "!!!ZAP_SEND!!!=RTE_BTN_ZAPS_%d", &zap) == 1, FALSE);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
245
19461
1b5e786d137a In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19432
diff changeset
246 zap = CLAMP(zap, 0, 9);
19432
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
247
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
248 #ifdef MSIM_USE_ATTENTION_API
19461
1b5e786d137a In the attention API, use the PURPLE_NOTIFY_MESSAGE flag to serv_got_im()
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19432
diff changeset
249 serv_got_attention(session->gc, username, zap);
19432
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
250 #else
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
251 zap_text = g_strdup_printf(_("*** You have been %s! ***"), zap_past_tense[zap]);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
252 serv_got_im(session->gc, username, zap_text,
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
253 PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_SYSTEM, time(NULL));
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
254 g_free(zap_text);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
255 #endif
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
256
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
257 g_free(msg_text);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
258 g_free(username);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
259
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
260 return TRUE;
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
261 }
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
262
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
263