Tue, 17 Sep 2013 12:21:15 +0530
Started refactoring pidgin plugins to use the new plugin API
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
1 | /* |
| 15884 | 2 | * Music messaging plugin for Purple |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
3 | * |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
4 | * Copyright (C) 2005 Christian Muise. |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
5 | * |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
6 | * This program is free software; you can redistribute it and/or |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
7 | * modify it under the terms of the GNU General Public License as |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
8 | * published by the Free Software Foundation; either version 2 of the |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
9 | * License, or (at your option) any later version. |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
10 | * |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
11 | * This program is distributed in the hope that it will be useful, but |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
14 | * General Public License for more details. |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
15 | * |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
16 | * You should have received a copy of the GNU General Public License |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
17 | * along with this program; if not, write to the Free Software |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
19 | * 02111-1301, USA. |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
20 | */ |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
21 | |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
22 | #include "internal.h" |
| 15577 | 23 | #include "pidgin.h" |
|
11088
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
24 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
25 | #include "conversation.h" |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
26 | |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
27 | #include "gtkconv.h" |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
28 | #include "gtkplugin.h" |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
29 | #include "gtkutils.h" |
|
11088
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
30 | |
|
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
31 | #include "notify.h" |
|
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
32 | #include "version.h" |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
33 | #include "debug.h" |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
34 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
35 | #define DBUS_API_SUBJECT_TO_CHANGE |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
36 | #include <dbus/dbus.h> |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
37 | #include "dbus-maybe.h" |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
38 | #include "dbus-bindings.h" |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
39 | #include "dbus-server.h" |
| 15884 | 40 | #include "dbus-purple.h" |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
41 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
42 | #define MUSICMESSAGING_PLUGIN_ID "gtk-hazure-musicmessaging" |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
43 | #define MUSICMESSAGING_PREFIX "##MM##" |
|
13090
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
44 | #define MUSICMESSAGING_START_MSG _("A music messaging session has been requested. Please click the MM icon to accept.") |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
45 | #define MUSICMESSAGING_CONFIRM_MSG _("Music messaging session confirmed.") |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
46 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
47 | typedef struct { |
| 15884 | 48 | PurpleConversation *conv; /* pointer to the conversation */ |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
49 | GtkWidget *seperator; /* seperator in the conversation */ |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
50 | GtkWidget *button; /* button in the conversation */ |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
51 | GPid pid; /* the pid of the score editor */ |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
52 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
53 | gboolean started; /* session has started and editor run */ |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
54 | gboolean originator; /* started the mm session */ |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
55 | gboolean requested; /* received a request to start a session */ |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
56 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
57 | } MMConversation; |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
58 | |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
59 | static gboolean start_session(MMConversation *mmconv); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
60 | static void run_editor(MMConversation *mmconv); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
61 | static void kill_editor(MMConversation *mmconv); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
62 | static void add_button (MMConversation *mmconv); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
63 | static void remove_widget (GtkWidget *button); |
| 15884 | 64 | static void init_conversation (PurpleConversation *conv); |
| 65 | static void conv_destroyed(PurpleConversation *conv); | |
| 66 | static gboolean intercept_sent(PurpleAccount *account, const char *who, char **message, void* pData); | |
| 67 | static gboolean intercept_received(PurpleAccount *account, char **sender, char **message, PurpleConversation *conv, int *flags); | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
68 | static gboolean send_change_request (const int session, const char *id, const char *command, const char *parameters); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
69 | static gboolean send_change_confirmed (const int session, const char *command, const char *parameters); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
70 | static void session_end (MMConversation *mmconv); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
71 | |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
72 | /* Globals */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
73 | /* List of sessions */ |
|
19563
a94e00f90010
Fix #2726. (Segafault on click of unknow button.) It was a bug in the musicmessaging plugin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
74 | static GList *conversations; |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
75 | |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
76 | /* Pointer to this plugin */ |
|
19563
a94e00f90010
Fix #2726. (Segafault on click of unknow button.) It was a bug in the musicmessaging plugin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
77 | static PurplePlugin *plugin_pointer; |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
78 | |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
79 | /* Define types needed for DBus */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
80 | DBusGConnection *connection; |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
81 | DBusGProxy *proxy; |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
82 | #define DBUS_SERVICE_GSCORE "org.gscore.GScoreService" |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
83 | #define DBUS_PATH_GSCORE "/org/gscore/GScoreObject" |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
84 | #define DBUS_INTERFACE_GSCORE "org.gscore.GScoreInterface" |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
85 | |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
86 | /* Define the functions to export for use with DBus */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
87 | DBUS_EXPORT void music_messaging_change_request (const int session, const char *command, const char *parameters); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
88 | DBUS_EXPORT void music_messaging_change_confirmed (const int session, const char *command, const char *parameters); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
89 | DBUS_EXPORT void music_messaging_change_failed (const int session, const char *id, const char *command, const char *parameters); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
90 | DBUS_EXPORT void music_messaging_done_session (const int session); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
91 | |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
92 | /* This file has been generated by the #dbus-analize-functions.py |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
93 | script. It contains dbus wrappers for the four functions declared |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
94 | above. */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
95 | #include "music-messaging-bindings.c" |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
96 | |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
97 | /* Exported functions */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
98 | void music_messaging_change_request(const int session, const char *command, const char *parameters) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
99 | { |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
100 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
101 | MMConversation *mmconv = (MMConversation *)g_list_nth_data(conversations, session); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
102 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
103 | if (mmconv->started) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
104 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
105 | if (mmconv->originator) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
106 | { |
|
32619
1dc7c15bc3ef
More code changed to use the accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
107 | const char *name = purple_conversation_get_name(mmconv->conv); |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
108 | send_change_request (session, name, command, parameters); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
109 | } else |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
110 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
111 | GString *to_send = g_string_new(""); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
112 | g_string_append_printf(to_send, "##MM## request %s %s##MM##", command, parameters); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
113 | |
|
34660
68c776e3436e
Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
114 | purple_conversation_send(mmconv->conv, to_send->str); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
115 | |
|
19832
84b69b21672b
Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19563
diff
changeset
|
116 | purple_debug_misc("musicmessaging", "Sent request: %s\n", to_send->str); |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
117 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
118 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
119 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
120 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
121 | |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
122 | void music_messaging_change_confirmed(const int session, const char *command, const char *parameters) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
123 | { |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
124 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
125 | MMConversation *mmconv = (MMConversation *)g_list_nth_data(conversations, session); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
126 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
127 | if (mmconv->started) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
128 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
129 | if (mmconv->originator) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
130 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
131 | GString *to_send = g_string_new(""); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
132 | g_string_append_printf(to_send, "##MM## confirm %s %s##MM##", command, parameters); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
133 | |
|
34660
68c776e3436e
Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
134 | purple_conversation_send(mmconv->conv, to_send->str); |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
135 | } else |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
136 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
137 | /* Do nothing. If they aren't the originator, then they can't confirm. */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
138 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
139 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
140 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
141 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
142 | |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
143 | void music_messaging_change_failed(const int session, const char *id, const char *command, const char *parameters) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
144 | { |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
145 | MMConversation *mmconv = (MMConversation *)g_list_nth_data(conversations, session); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
146 | |
| 15884 | 147 | purple_notify_message(plugin_pointer, PURPLE_NOTIFY_MSG_INFO, command, |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
148 | parameters, NULL, NULL, NULL); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
149 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
150 | if (mmconv->started) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
151 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
152 | if (mmconv->originator) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
153 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
154 | GString *to_send = g_string_new(""); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
155 | g_string_append_printf(to_send, "##MM## failed %s %s %s##MM##", id, command, parameters); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
156 | |
|
34660
68c776e3436e
Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
157 | purple_conversation_send(mmconv->conv, to_send->str); |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
158 | } else |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
159 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
160 | /* Do nothing. If they aren't the originator, then they can't confirm. */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
161 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
162 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
163 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
164 | |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
165 | void music_messaging_done_session(const int session) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
166 | { |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
167 | MMConversation *mmconv = (MMConversation *)g_list_nth_data(conversations, session); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
168 | |
| 15884 | 169 | purple_notify_message(plugin_pointer, PURPLE_NOTIFY_MSG_INFO, "Session", |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
170 | "Session Complete", NULL, NULL, NULL); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
171 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
172 | session_end(mmconv); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
173 | } |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
174 | |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
175 | |
|
11355
8c34a2d54284
[gaim-migrate @ 13574]
Christian Muise <christian.muise@gmail.com>
parents:
11254
diff
changeset
|
176 | /* DBus commands that can be sent to the editor */ |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
177 | G_BEGIN_DECLS |
| 15884 | 178 | DBusConnection *purple_dbus_get_connection(void); |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
179 | G_END_DECLS |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
180 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
181 | static gboolean send_change_request (const int session, const char *id, const char *command, const char *parameters) |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
182 | { |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
183 | DBusMessage *message; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
184 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
185 | /* Create the signal we need */ |
| 15884 | 186 | message = dbus_message_new_signal (DBUS_PATH_PURPLE, DBUS_INTERFACE_PURPLE, "GscoreChangeRequest"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
187 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
188 | /* Append the string "Ping!" to the signal */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
189 | dbus_message_append_args (message, |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
190 | DBUS_TYPE_INT32, &session, |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
191 | DBUS_TYPE_STRING, &id, |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
192 | DBUS_TYPE_STRING, &command, |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
193 | DBUS_TYPE_STRING, ¶meters, |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
194 | DBUS_TYPE_INVALID); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
195 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
196 | /* Send the signal */ |
| 15884 | 197 | dbus_connection_send (purple_dbus_get_connection(), message, NULL); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
198 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
199 | /* Free the signal now we have finished with it */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
200 | dbus_message_unref (message); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
201 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
202 | /* Tell the user we sent a signal */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
203 | g_printerr("Sent change request signal: %d %s %s %s\n", session, id, command, parameters); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
204 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
205 | return TRUE; |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
206 | } |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
207 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
208 | static gboolean send_change_confirmed (const int session, const char *command, const char *parameters) |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
209 | { |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
210 | DBusMessage *message; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
211 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
212 | /* Create the signal we need */ |
| 15884 | 213 | message = dbus_message_new_signal (DBUS_PATH_PURPLE, DBUS_INTERFACE_PURPLE, "GscoreChangeConfirmed"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
214 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
215 | /* Append the string "Ping!" to the signal */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
216 | dbus_message_append_args (message, |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
217 | DBUS_TYPE_INT32, &session, |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
218 | DBUS_TYPE_STRING, &command, |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
219 | DBUS_TYPE_STRING, ¶meters, |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
220 | DBUS_TYPE_INVALID); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
221 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
222 | /* Send the signal */ |
| 15884 | 223 | dbus_connection_send (purple_dbus_get_connection(), message, NULL); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
224 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
225 | /* Free the signal now we have finished with it */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
226 | dbus_message_unref (message); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
227 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
228 | /* Tell the user we sent a signal */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
229 | g_printerr("Sent change confirmed signal.\n"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
230 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
231 | return TRUE; |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
232 | } |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
233 | |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
234 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
235 | static int |
| 15884 | 236 | mmconv_from_conv_loc(PurpleConversation *conv) |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
237 | { |
|
15847
da522f9a7743
Don't use g_list_length() and g_slist_length() when all you want to
Mark Doliner <markdoliner@pidgin.im>
parents:
15577
diff
changeset
|
238 | GList *l; |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
239 | MMConversation *mmconv_current = NULL; |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
240 | guint i; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
241 | |
|
15847
da522f9a7743
Don't use g_list_length() and g_slist_length() when all you want to
Mark Doliner <markdoliner@pidgin.im>
parents:
15577
diff
changeset
|
242 | i = 0; |
|
da522f9a7743
Don't use g_list_length() and g_slist_length() when all you want to
Mark Doliner <markdoliner@pidgin.im>
parents:
15577
diff
changeset
|
243 | for (l = conversations; l != NULL; l = l->next) |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
244 | { |
|
15847
da522f9a7743
Don't use g_list_length() and g_slist_length() when all you want to
Mark Doliner <markdoliner@pidgin.im>
parents:
15577
diff
changeset
|
245 | mmconv_current = l->data; |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
246 | if (conv == mmconv_current->conv) |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
247 | { |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
248 | return i; |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
249 | } |
|
15847
da522f9a7743
Don't use g_list_length() and g_slist_length() when all you want to
Mark Doliner <markdoliner@pidgin.im>
parents:
15577
diff
changeset
|
250 | i++; |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
251 | } |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
252 | return -1; |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
253 | } |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
254 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
255 | static MMConversation* |
| 15884 | 256 | mmconv_from_conv(PurpleConversation *conv) |
|
11365
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
257 | { |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
258 | return (MMConversation *)g_list_nth_data(conversations, mmconv_from_conv_loc(conv)); |
|
11365
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
259 | } |
|
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
260 | |
|
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
261 | static gboolean |
| 15884 | 262 | intercept_sent(PurpleAccount *account, const char *who, char **message, void* pData) |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
263 | { |
|
19988
a0e2b3ea6d85
Fix crash in musicmessaging plugin when something else has set the message to NULL (in this case, I'm guessing the Offline Messaging plugin). Fixes #3050.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
264 | if (message == NULL || *message == NULL || **message == '\0') |
|
a0e2b3ea6d85
Fix crash in musicmessaging plugin when something else has set the message to NULL (in this case, I'm guessing the Offline Messaging plugin). Fixes #3050.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
265 | return FALSE; |
|
a0e2b3ea6d85
Fix crash in musicmessaging plugin when something else has set the message to NULL (in this case, I'm guessing the Offline Messaging plugin). Fixes #3050.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
266 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
267 | if (0 == strncmp(*message, MUSICMESSAGING_PREFIX, strlen(MUSICMESSAGING_PREFIX))) |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
268 | { |
| 15884 | 269 | purple_debug_misc("purple-musicmessaging", "Sent MM Message: %s\n", *message); |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
270 | message = 0; |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
271 | } |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
272 | else if (0 == strncmp(*message, MUSICMESSAGING_START_MSG, strlen(MUSICMESSAGING_START_MSG))) |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
273 | { |
| 15884 | 274 | purple_debug_misc("purple-musicmessaging", "Sent MM request.\n"); |
|
11420
7e38dc3d0f48
[gaim-migrate @ 13657]
Christian Muise <christian.muise@gmail.com>
parents:
11418
diff
changeset
|
275 | return FALSE; |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
276 | } |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
277 | else if (0 == strncmp(*message, MUSICMESSAGING_CONFIRM_MSG, strlen(MUSICMESSAGING_CONFIRM_MSG))) |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
278 | { |
| 15884 | 279 | purple_debug_misc("purple-musicmessaging", "Sent MM confirm.\n"); |
|
11420
7e38dc3d0f48
[gaim-migrate @ 13657]
Christian Muise <christian.muise@gmail.com>
parents:
11418
diff
changeset
|
280 | return FALSE; |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
281 | } |
|
11365
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
282 | else if (0 == strncmp(*message, "test1", strlen("test1"))) |
|
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
283 | { |
| 15884 | 284 | purple_debug_misc("purple-musicmessaging", "\n\nTEST 1\n\n"); |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
285 | send_change_request(0, "test-id", "test-command", "test-parameters"); |
|
11365
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
286 | return FALSE; |
|
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
287 | } |
|
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
288 | else if (0 == strncmp(*message, "test2", strlen("test2"))) |
|
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
289 | { |
| 15884 | 290 | purple_debug_misc("purple-musicmessaging", "\n\nTEST 2\n\n"); |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
291 | send_change_confirmed(1, "test-command", "test-parameters"); |
|
11365
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
292 | return FALSE; |
|
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
293 | } |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
294 | else |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
295 | { |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
296 | return FALSE; |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
297 | /* Do nothing...procceed as normal */ |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
298 | } |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
299 | return TRUE; |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
300 | } |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
301 | |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
302 | static gboolean |
| 15884 | 303 | intercept_received(PurpleAccount *account, char **sender, char **message, PurpleConversation *conv, int *flags) |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
304 | { |
|
19563
a94e00f90010
Fix #2726. (Segafault on click of unknow button.) It was a bug in the musicmessaging plugin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
305 | MMConversation *mmconv; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
306 | |
|
19563
a94e00f90010
Fix #2726. (Segafault on click of unknow button.) It was a bug in the musicmessaging plugin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
307 | if (conv == NULL) { |
|
a94e00f90010
Fix #2726. (Segafault on click of unknow button.) It was a bug in the musicmessaging plugin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
308 | /* XXX: This is just to avoid a crash (#2726). |
|
a94e00f90010
Fix #2726. (Segafault on click of unknow button.) It was a bug in the musicmessaging plugin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
309 | * We may want to create the conversation instead of returning from here |
|
a94e00f90010
Fix #2726. (Segafault on click of unknow button.) It was a bug in the musicmessaging plugin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
310 | */ |
|
a94e00f90010
Fix #2726. (Segafault on click of unknow button.) It was a bug in the musicmessaging plugin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
311 | return FALSE; |
|
a94e00f90010
Fix #2726. (Segafault on click of unknow button.) It was a bug in the musicmessaging plugin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
312 | } |
|
a94e00f90010
Fix #2726. (Segafault on click of unknow button.) It was a bug in the musicmessaging plugin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
313 | |
|
a94e00f90010
Fix #2726. (Segafault on click of unknow button.) It was a bug in the musicmessaging plugin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
314 | mmconv = mmconv_from_conv(conv); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
315 | |
| 15884 | 316 | purple_debug_misc("purple-musicmessaging", "Intercepted: %s\n", *message); |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
317 | if (strstr(*message, MUSICMESSAGING_PREFIX)) |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
318 | { |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
319 | char *parsed_message = strtok(strstr(*message, MUSICMESSAGING_PREFIX), "<"); |
| 15884 | 320 | purple_debug_misc("purple-musicmessaging", "Received an MM Message: %s\n", parsed_message); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
321 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
322 | if (mmconv->started) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
323 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
324 | if (strstr(parsed_message, "request")) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
325 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
326 | if (mmconv->originator) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
327 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
328 | int session = mmconv_from_conv_loc(conv); |
|
32619
1dc7c15bc3ef
More code changed to use the accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
329 | const char *id = purple_conversation_get_name(mmconv->conv); |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
330 | char *command; |
|
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
331 | char *parameters; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
332 | |
| 15884 | 333 | purple_debug_misc("purple-musicmessaging", "Sending request to gscore.\n"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
334 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
335 | /* Get past the first two terms - '##MM##' and 'request' */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
336 | strtok(parsed_message, " "); /* '##MM##' */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
337 | strtok(NULL, " "); /* 'request' */ |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
338 | |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
339 | command = strtok(NULL, " "); |
|
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
340 | parameters = strtok(NULL, "#"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
341 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
342 | send_change_request (session, id, command, parameters); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
343 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
344 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
345 | } else if (strstr(parsed_message, "confirm")) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
346 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
347 | if (!mmconv->originator) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
348 | { |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
349 | int session = mmconv_from_conv_loc(conv); |
|
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
350 | char *command; |
|
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
351 | char *parameters; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
352 | |
| 15884 | 353 | purple_debug_misc("purple-musicmessaging", "Sending confirmation to gscore.\n"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
354 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
355 | /* Get past the first two terms - '##MM##' and 'confirm' */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
356 | strtok(parsed_message, " "); /* '##MM##' */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
357 | strtok(NULL, " "); /* 'confirm' */ |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
358 | |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
359 | command = strtok(NULL, " "); |
|
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
360 | parameters = strtok(NULL, "#"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
361 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
362 | send_change_confirmed (session, command, parameters); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
363 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
364 | } else if (strstr(parsed_message, "failed")) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
365 | { |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
366 | char *id; |
|
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
367 | char *command; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
368 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
369 | /* Get past the first two terms - '##MM##' and 'confirm' */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
370 | strtok(parsed_message, " "); /* '##MM##' */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
371 | strtok(NULL, " "); /* 'failed' */ |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
372 | |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
373 | id = strtok(NULL, " "); |
|
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
374 | command = strtok(NULL, " "); |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
375 | /* char *parameters = strtok(NULL, "#"); DONT NEED PARAMETERS */ |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
376 | |
|
32619
1dc7c15bc3ef
More code changed to use the accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
377 | // TODO: Shouldn't this be strcmp() ? |
|
1dc7c15bc3ef
More code changed to use the accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
378 | if (purple_conversation_get_name(mmconv->conv) == id) |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
379 | { |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
380 | purple_notify_message(plugin_pointer, PURPLE_NOTIFY_MSG_ERROR, |
|
13090
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
381 | _("Music Messaging"), |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
382 | _("There was a conflict in running the command:"), command, NULL, NULL); |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
383 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
384 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
385 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
386 | |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
387 | message = 0; |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
388 | } |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
389 | else if (strstr(*message, MUSICMESSAGING_START_MSG)) |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
390 | { |
| 15884 | 391 | purple_debug_misc("purple-musicmessaging", "Received MM request.\n"); |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
392 | if (!(mmconv->originator)) |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
393 | { |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
394 | mmconv->requested = TRUE; |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
395 | return FALSE; |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
396 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
397 | |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
398 | } |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
399 | else if (strstr(*message, MUSICMESSAGING_CONFIRM_MSG)) |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
400 | { |
| 15884 | 401 | purple_debug_misc("purple-musicmessagin", "Received MM confirm.\n"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
402 | |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
403 | if (mmconv->originator) |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
404 | { |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
405 | start_session(mmconv); |
|
11420
7e38dc3d0f48
[gaim-migrate @ 13657]
Christian Muise <christian.muise@gmail.com>
parents:
11418
diff
changeset
|
406 | return FALSE; |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
407 | } |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
408 | } |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
409 | else |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
410 | { |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
411 | return FALSE; |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
412 | /* Do nothing. */ |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
413 | } |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
414 | return TRUE; |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
415 | } |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
416 | |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
417 | static void send_request(MMConversation *mmconv) |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
418 | { |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
419 | PurpleConnection *connection = purple_conversation_get_connection(mmconv->conv); |
| 15884 | 420 | const char *convName = purple_conversation_get_name(mmconv->conv); |
| 421 | serv_send_im(connection, convName, MUSICMESSAGING_START_MSG, PURPLE_MESSAGE_SEND); | |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
422 | } |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
423 | |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
424 | static void send_request_confirmed(MMConversation *mmconv) |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
425 | { |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
426 | PurpleConnection *connection = purple_conversation_get_connection(mmconv->conv); |
| 15884 | 427 | const char *convName = purple_conversation_get_name(mmconv->conv); |
| 428 | serv_send_im(connection, convName, MUSICMESSAGING_CONFIRM_MSG, PURPLE_MESSAGE_SEND); | |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
429 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
430 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
431 | |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
432 | static gboolean |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
433 | start_session(MMConversation *mmconv) |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
434 | { |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
435 | run_editor(mmconv); |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
436 | return TRUE; |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
437 | } |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
438 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
439 | static void session_end (MMConversation *mmconv) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
440 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
441 | mmconv->started = FALSE; |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
442 | mmconv->originator = FALSE; |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
443 | mmconv->requested = FALSE; |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
444 | kill_editor(mmconv); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
445 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
446 | |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
447 | static void music_button_toggled (GtkWidget *widget, gpointer data) |
|
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
448 | { |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
449 | MMConversation *mmconv = mmconv_from_conv(((MMConversation *) data)->conv); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
450 | if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
451 | { |
|
11418
9a84d5b27748
[gaim-migrate @ 13655]
Christian Muise <christian.muise@gmail.com>
parents:
11417
diff
changeset
|
452 | if (((MMConversation *) data)->requested) |
|
9a84d5b27748
[gaim-migrate @ 13655]
Christian Muise <christian.muise@gmail.com>
parents:
11417
diff
changeset
|
453 | { |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
454 | start_session(mmconv); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
455 | send_request_confirmed(mmconv); |
|
11418
9a84d5b27748
[gaim-migrate @ 13655]
Christian Muise <christian.muise@gmail.com>
parents:
11417
diff
changeset
|
456 | } |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
457 | else |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
458 | { |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
459 | ((MMConversation *) data)->originator = TRUE; |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
460 | send_request((MMConversation *) data); |
|
11418
9a84d5b27748
[gaim-migrate @ 13655]
Christian Muise <christian.muise@gmail.com>
parents:
11417
diff
changeset
|
461 | } |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
462 | } else { |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
463 | session_end((MMConversation *)data); |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
464 | } |
|
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
465 | } |
|
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
466 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
467 | static void set_editor_path (GtkWidget *button, GtkWidget *text_field) |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
468 | { |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
469 | const char * path = gtk_entry_get_text((GtkEntry*)text_field); |
| 15884 | 470 | purple_prefs_set_string("/plugins/gtk/musicmessaging/editor_path", path); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
471 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
472 | } |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
473 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
474 | static void run_editor (MMConversation *mmconv) |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
475 | { |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
476 | GError *spawn_error = NULL; |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
477 | GString *session_id; |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
478 | gchar * args[4]; |
| 15884 | 479 | args[0] = (gchar *)purple_prefs_get_string("/plugins/gtk/musicmessaging/editor_path"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
480 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
481 | args[1] = "-session_id"; |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
482 | session_id = g_string_new(""); |
|
26756
874b154f4220
More Pidgin updates for GTK+ 3.0. Removes any deprecated functions for GLib
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
20288
diff
changeset
|
483 | g_string_append_printf(session_id, "%d", mmconv_from_conv_loc(mmconv->conv)); |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
484 | args[2] = session_id->str; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
485 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
486 | args[3] = NULL; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
487 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
488 | if (!(g_spawn_async (".", args, NULL, 4, NULL, NULL, &(mmconv->pid), &spawn_error))) |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
489 | { |
| 15884 | 490 | purple_notify_error(plugin_pointer, _("Error Running Editor"), |
| 14754 | 491 | _("The following error has occurred:"), spawn_error->message); |
|
11254
3cbf29bdc44a
[gaim-migrate @ 13426]
Christian Muise <christian.muise@gmail.com>
parents:
11216
diff
changeset
|
492 | mmconv->started = FALSE; |
|
3cbf29bdc44a
[gaim-migrate @ 13426]
Christian Muise <christian.muise@gmail.com>
parents:
11216
diff
changeset
|
493 | } |
|
3cbf29bdc44a
[gaim-migrate @ 13426]
Christian Muise <christian.muise@gmail.com>
parents:
11216
diff
changeset
|
494 | else |
|
3cbf29bdc44a
[gaim-migrate @ 13426]
Christian Muise <christian.muise@gmail.com>
parents:
11216
diff
changeset
|
495 | { |
|
3cbf29bdc44a
[gaim-migrate @ 13426]
Christian Muise <christian.muise@gmail.com>
parents:
11216
diff
changeset
|
496 | mmconv->started = TRUE; |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
497 | } |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
498 | } |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
499 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
500 | static void kill_editor (MMConversation *mmconv) |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
501 | { |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
502 | if (mmconv->pid) |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
503 | { |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
504 | kill(mmconv->pid, SIGINT); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
505 | mmconv->pid = 0; |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
506 | } |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
507 | } |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
508 | |
| 15884 | 509 | static void init_conversation (PurpleConversation *conv) |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
510 | { |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
511 | MMConversation *mmconv; |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
512 | mmconv = g_malloc(sizeof(MMConversation)); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
513 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
514 | mmconv->conv = conv; |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
515 | mmconv->started = FALSE; |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
516 | mmconv->originator = FALSE; |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
517 | mmconv->requested = FALSE; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
518 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
519 | add_button(mmconv); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
520 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
521 | conversations = g_list_append(conversations, mmconv); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
522 | } |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
523 | |
| 15884 | 524 | static void conv_destroyed (PurpleConversation *conv) |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
525 | { |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
526 | MMConversation *mmconv = mmconv_from_conv(conv); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
527 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
528 | remove_widget(mmconv->button); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
529 | remove_widget(mmconv->seperator); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
530 | if (mmconv->started) |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
531 | { |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
532 | kill_editor(mmconv); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
533 | } |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
534 | conversations = g_list_remove(conversations, mmconv); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
535 | } |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
536 | |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
537 | static void add_button (MMConversation *mmconv) |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
538 | { |
|
34292
30107eb2ff81
Fix compiler warnings, make build even more silent
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
539 | #if 0 |
| 15884 | 540 | PurpleConversation *conv = mmconv->conv; |
|
34292
30107eb2ff81
Fix compiler warnings, make build even more silent
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
541 | #endif |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
542 | |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
543 | GtkWidget *button, *image, *sep; |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
544 | gchar *file_path; |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
545 | |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
546 | button = gtk_toggle_button_new(); |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
547 | gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
548 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
549 | g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(music_button_toggled), mmconv); |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
550 | |
| 15884 | 551 | file_path = g_build_filename(DATADIR, "pixmaps", "purple", "buttons", |
|
11659
65d522cdb2d6
[gaim-migrate @ 13944]
Gary Kramlich <grim@reaperworld.com>
parents:
11420
diff
changeset
|
552 | "music.png", NULL); |
|
11254
3cbf29bdc44a
[gaim-migrate @ 13426]
Christian Muise <christian.muise@gmail.com>
parents:
11216
diff
changeset
|
553 | image = gtk_image_new_from_file(file_path); |
|
11659
65d522cdb2d6
[gaim-migrate @ 13944]
Gary Kramlich <grim@reaperworld.com>
parents:
11420
diff
changeset
|
554 | g_free(file_path); |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
555 | |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
556 | gtk_container_add((GtkContainer *)button, image); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
557 | |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
558 | sep = gtk_vseparator_new(); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
559 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
560 | mmconv->seperator = sep; |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
561 | mmconv->button = button; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
562 | |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
563 | gtk_widget_show(sep); |
|
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
564 | gtk_widget_show(image); |
|
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
565 | gtk_widget_show(button); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
566 | |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32698
diff
changeset
|
567 | #if 0 |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
568 | gtk_box_pack_start(GTK_BOX(PIDGIN_CONVERSATION(conv)->toolbar), sep, FALSE, FALSE, 0); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
569 | gtk_box_pack_start(GTK_BOX(PIDGIN_CONVERSATION(conv)->toolbar), button, FALSE, FALSE, 0); |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32698
diff
changeset
|
570 | #endif |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
571 | } |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
572 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
573 | static void remove_widget (GtkWidget *button) |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
574 | { |
|
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
575 | gtk_widget_hide(button); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
576 | gtk_widget_destroy(button); |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
577 | } |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
578 | |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
579 | static GtkWidget * |
| 15884 | 580 | get_config_frame(PurplePlugin *plugin) |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
581 | { |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
582 | GtkWidget *ret; |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
583 | GtkWidget *vbox; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
584 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
585 | GtkWidget *editor_path; |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
586 | GtkWidget *editor_path_label; |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
587 | GtkWidget *editor_path_button; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
588 | |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
589 | /* Outside container */ |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
590 | ret = gtk_vbox_new(FALSE, 18); |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
591 | gtk_container_set_border_width(GTK_CONTAINER(ret), 10); |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
592 | |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
593 | /* Configuration frame */ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
594 | vbox = pidgin_make_frame(ret, _("Music Messaging Configuration")); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
595 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
596 | /* Path to the score editor */ |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
597 | editor_path = gtk_entry_new(); |
|
13090
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
598 | editor_path_label = gtk_label_new(_("Score Editor Path")); |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
599 | editor_path_button = gtk_button_new_with_mnemonic(_("_Apply")); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
600 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
601 | gtk_entry_set_text((GtkEntry*)editor_path, "/usr/local/bin/gscore"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
602 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
603 | g_signal_connect(G_OBJECT(editor_path_button), "clicked", |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
604 | G_CALLBACK(set_editor_path), editor_path); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
605 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
606 | gtk_box_pack_start(GTK_BOX(vbox), editor_path_label, FALSE, FALSE, 0); |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
607 | gtk_box_pack_start(GTK_BOX(vbox), editor_path, FALSE, FALSE, 0); |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
608 | gtk_box_pack_start(GTK_BOX(vbox), editor_path_button, FALSE, FALSE, 0); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
609 | |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
610 | gtk_widget_show_all(ret); |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
611 | |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
612 | return ret; |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
613 | } |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
614 | |
|
36754
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
615 | static PidginPluginInfo * |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
616 | plugin_query(GError **error) { |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
617 | const gchar * const authors[] = { |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
618 | "Christian Muise <christian.muise@gmail.com>", |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
619 | NULL |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
620 | }; |
|
11088
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
621 | |
|
36754
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
622 | return pidgin_plugin_info_new( |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
623 | "id", MUSICMESSAGING_PLUGIN_ID, |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
624 | "name", N_("Music Messaging"), |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
625 | "version", DISPLAY_VERSION, |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
626 | "category", N_("Music"), |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
627 | "summary", N_("Music Messaging Plugin for collaborative " |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
628 | "composition."), |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
629 | "description", N_("The Music Messaging Plugin allows a number " |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
630 | "of users to simultaneously work on a piece " |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
631 | "of music by editing a common score in " |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
632 | "real-time."), |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
633 | "authors", authors, |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
634 | "website", PURPLE_WEBSITE, |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
635 | "abi-version", PURPLE_ABI_VERSION, |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
636 | "pidgin-config-frame", get_config_frame, |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
637 | NULL |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
638 | ); |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
639 | } |
|
16749
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16175
diff
changeset
|
640 | |
|
36754
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
641 | static gboolean |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
642 | plugin_load(PurplePlugin *plugin, GError **error) { |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
643 | void *conv_list_handle; |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
644 | GList *l; |
|
11088
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
645 | |
|
36754
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
646 | PURPLE_DBUS_RETURN_FALSE_IF_DISABLED(plugin); |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
647 | |
| 15884 | 648 | purple_prefs_add_none("/plugins/gtk/musicmessaging"); |
|
16175
37cb9e5165ce
If we're going to keep this, let's not have default paths under /usr/local, k?
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
649 | purple_prefs_add_string("/plugins/gtk/musicmessaging/editor_path", "/usr/bin/gscore"); |
|
36754
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
650 | |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
651 | /* First, we have to register our four exported functions with the |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
652 | main purple dbus loop. Without this statement, the purple dbus |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
653 | code wouldn't know about our functions. */ |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
654 | PURPLE_DBUS_REGISTER_BINDINGS(plugin); |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
655 | |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
656 | /* Keep the plugin for reference (needed for notify's) */ |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
657 | plugin_pointer = plugin; |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
658 | |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
659 | /* Add the button to all the current conversations */ |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
660 | for (l = purple_conversations_get_all(); l != NULL; l = l->next) |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
661 | init_conversation((PurpleConversation *)l->data); |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
662 | |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
663 | /* Listen for any new conversations */ |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
664 | conv_list_handle = purple_conversations_get_handle(); |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
665 | |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
666 | purple_signal_connect(conv_list_handle, "conversation-created", |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
667 | plugin, PURPLE_CALLBACK(init_conversation), NULL); |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
668 | |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
669 | /* Listen for conversations that are ending */ |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
670 | purple_signal_connect(conv_list_handle, "deleting-conversation", |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
671 | plugin, PURPLE_CALLBACK(conv_destroyed), NULL); |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
672 | |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
673 | /* Listen for sending/receiving messages to replace tags */ |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
674 | purple_signal_connect(conv_list_handle, "sending-im-msg", |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
675 | plugin, PURPLE_CALLBACK(intercept_sent), NULL); |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
676 | purple_signal_connect(conv_list_handle, "receiving-im-msg", |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
677 | plugin, PURPLE_CALLBACK(intercept_received), NULL); |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
678 | |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
679 | return TRUE; |
|
11088
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
680 | } |
|
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
681 | |
|
36754
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
682 | static gboolean |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
683 | plugin_unload(PurplePlugin *plugin, GError **error) { |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
684 | MMConversation *mmconv = NULL; |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
685 | |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
686 | while (conversations != NULL) |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
687 | { |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
688 | mmconv = conversations->data; |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
689 | conv_destroyed(mmconv->conv); |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
690 | } |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
691 | return TRUE; |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
692 | } |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
693 | |
|
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34881
diff
changeset
|
694 | PURPLE_PLUGIN_INIT(musicmessaging, plugin_query, plugin_load, plugin_unload); |