Tue, 11 Feb 2014 02:19:31 +0100
Fix gtk_[hv]box_new gtk3 deprecation warnings
|
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 | |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
27 | #include "gtk3compat.h" |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
28 | #include "gtkconv.h" |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
29 | #include "gtkplugin.h" |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
30 | #include "gtkutils.h" |
|
11088
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
31 | |
|
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
32 | #include "notify.h" |
|
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
33 | #include "version.h" |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
34 | #include "debug.h" |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
35 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
36 | #define DBUS_API_SUBJECT_TO_CHANGE |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
37 | #include <dbus/dbus.h> |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
38 | #include "dbus-maybe.h" |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
39 | #include "dbus-bindings.h" |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
40 | #include "dbus-server.h" |
| 15884 | 41 | #include "dbus-purple.h" |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
42 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
43 | #define MUSICMESSAGING_PLUGIN_ID "gtk-hazure-musicmessaging" |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
44 | #define MUSICMESSAGING_PREFIX "##MM##" |
|
13090
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
45 | #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
|
46 | #define MUSICMESSAGING_CONFIRM_MSG _("Music messaging session confirmed.") |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
47 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
48 | typedef struct { |
| 15884 | 49 | PurpleConversation *conv; /* pointer to the conversation */ |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
50 | GtkWidget *seperator; /* seperator in the conversation */ |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
51 | GtkWidget *button; /* button in the conversation */ |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
52 | GPid pid; /* the pid of the score editor */ |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
53 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
54 | gboolean started; /* session has started and editor run */ |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
55 | gboolean originator; /* started the mm session */ |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
56 | gboolean requested; /* received a request to start a session */ |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
57 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
58 | } MMConversation; |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
59 | |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
60 | static gboolean start_session(MMConversation *mmconv); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
61 | static void run_editor(MMConversation *mmconv); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
62 | static void kill_editor(MMConversation *mmconv); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
63 | static void add_button (MMConversation *mmconv); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
64 | static void remove_widget (GtkWidget *button); |
| 15884 | 65 | static void init_conversation (PurpleConversation *conv); |
| 66 | static void conv_destroyed(PurpleConversation *conv); | |
| 67 | static gboolean intercept_sent(PurpleAccount *account, const char *who, char **message, void* pData); | |
| 68 | 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
|
69 | 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
|
70 | 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
|
71 | static void session_end (MMConversation *mmconv); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
72 | |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
73 | /* Globals */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
74 | /* 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
|
75 | static GList *conversations; |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
76 | |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
77 | /* 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
|
78 | static PurplePlugin *plugin_pointer; |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
79 | |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
80 | /* Define types needed for DBus */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
81 | DBusGConnection *connection; |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
82 | DBusGProxy *proxy; |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
83 | #define DBUS_SERVICE_GSCORE "org.gscore.GScoreService" |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
84 | #define DBUS_PATH_GSCORE "/org/gscore/GScoreObject" |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
85 | #define DBUS_INTERFACE_GSCORE "org.gscore.GScoreInterface" |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
86 | |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
87 | /* Define the functions to export for use with DBus */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
88 | 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
|
89 | 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
|
90 | 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
|
91 | DBUS_EXPORT void music_messaging_done_session (const int session); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
92 | |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
93 | /* 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
|
94 | script. It contains dbus wrappers for the four functions declared |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
95 | above. */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
96 | #include "music-messaging-bindings.c" |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
97 | |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
98 | /* Exported functions */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
99 | 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
|
100 | { |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
101 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
102 | MMConversation *mmconv = (MMConversation *)g_list_nth_data(conversations, session); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
103 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
104 | if (mmconv->started) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
105 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
106 | if (mmconv->originator) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
107 | { |
|
32619
1dc7c15bc3ef
More code changed to use the accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
108 | const char *name = purple_conversation_get_name(mmconv->conv); |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
109 | send_change_request (session, name, command, parameters); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
110 | } else |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
111 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
112 | GString *to_send = g_string_new(""); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
113 | 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
|
114 | |
|
34660
68c776e3436e
Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
115 | purple_conversation_send(mmconv->conv, to_send->str); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
116 | |
|
19832
84b69b21672b
Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19563
diff
changeset
|
117 | 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
|
118 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
119 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
120 | |
|
11417
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 | |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
123 | 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
|
124 | { |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
125 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
126 | MMConversation *mmconv = (MMConversation *)g_list_nth_data(conversations, session); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
127 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
128 | if (mmconv->started) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
129 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
130 | if (mmconv->originator) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
131 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
132 | GString *to_send = g_string_new(""); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
133 | 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
|
134 | |
|
34660
68c776e3436e
Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
135 | purple_conversation_send(mmconv->conv, to_send->str); |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
136 | } else |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
137 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
138 | /* 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
|
139 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
140 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
141 | |
|
11417
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 | |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
144 | 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
|
145 | { |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
146 | MMConversation *mmconv = (MMConversation *)g_list_nth_data(conversations, session); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
147 | |
| 15884 | 148 | purple_notify_message(plugin_pointer, PURPLE_NOTIFY_MSG_INFO, command, |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34292
diff
changeset
|
149 | parameters, NULL, NULL, NULL, NULL); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
150 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
151 | if (mmconv->started) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
152 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
153 | if (mmconv->originator) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
154 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
155 | GString *to_send = g_string_new(""); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
156 | 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
|
157 | |
|
34660
68c776e3436e
Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
158 | purple_conversation_send(mmconv->conv, to_send->str); |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
159 | } else |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
160 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
161 | /* 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
|
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 | |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
166 | void music_messaging_done_session(const int session) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
167 | { |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
168 | MMConversation *mmconv = (MMConversation *)g_list_nth_data(conversations, session); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
169 | |
| 15884 | 170 | purple_notify_message(plugin_pointer, PURPLE_NOTIFY_MSG_INFO, "Session", |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34292
diff
changeset
|
171 | "Session Complete", NULL, NULL, NULL, NULL); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
172 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
173 | session_end(mmconv); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
174 | } |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
175 | |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
176 | |
|
11355
8c34a2d54284
[gaim-migrate @ 13574]
Christian Muise <christian.muise@gmail.com>
parents:
11254
diff
changeset
|
177 | /* DBus commands that can be sent to the editor */ |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
178 | G_BEGIN_DECLS |
| 15884 | 179 | DBusConnection *purple_dbus_get_connection(void); |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
180 | G_END_DECLS |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
181 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
182 | 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
|
183 | { |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
184 | DBusMessage *message; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
185 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
186 | /* Create the signal we need */ |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35037
diff
changeset
|
187 | message = dbus_message_new_signal (PURPLE_DBUS_PATH, PURPLE_DBUS_INTERFACE, "GscoreChangeRequest"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
188 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
189 | /* Append the string "Ping!" to the signal */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
190 | dbus_message_append_args (message, |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
191 | DBUS_TYPE_INT32, &session, |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
192 | DBUS_TYPE_STRING, &id, |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
193 | DBUS_TYPE_STRING, &command, |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
194 | DBUS_TYPE_STRING, ¶meters, |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
195 | DBUS_TYPE_INVALID); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
196 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
197 | /* Send the signal */ |
| 15884 | 198 | dbus_connection_send (purple_dbus_get_connection(), message, NULL); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
199 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
200 | /* Free the signal now we have finished with it */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
201 | dbus_message_unref (message); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
202 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
203 | /* Tell the user we sent a signal */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
204 | 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
|
205 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
206 | return TRUE; |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
207 | } |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
208 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
209 | 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
|
210 | { |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
211 | DBusMessage *message; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
212 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
213 | /* Create the signal we need */ |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35037
diff
changeset
|
214 | message = dbus_message_new_signal (PURPLE_DBUS_PATH, PURPLE_DBUS_INTERFACE, "GscoreChangeConfirmed"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
215 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
216 | /* Append the string "Ping!" to the signal */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
217 | dbus_message_append_args (message, |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
218 | DBUS_TYPE_INT32, &session, |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
219 | DBUS_TYPE_STRING, &command, |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
220 | DBUS_TYPE_STRING, ¶meters, |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
221 | DBUS_TYPE_INVALID); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
222 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
223 | /* Send the signal */ |
| 15884 | 224 | dbus_connection_send (purple_dbus_get_connection(), message, NULL); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
225 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
226 | /* Free the signal now we have finished with it */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
227 | dbus_message_unref (message); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
228 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
229 | /* Tell the user we sent a signal */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
230 | g_printerr("Sent change confirmed signal.\n"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
231 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
232 | return TRUE; |
|
11200
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 | |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
235 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
236 | static int |
| 15884 | 237 | mmconv_from_conv_loc(PurpleConversation *conv) |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
238 | { |
|
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
|
239 | GList *l; |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
240 | MMConversation *mmconv_current = NULL; |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
241 | guint i; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
242 | |
|
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
|
243 | 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
|
244 | for (l = conversations; l != NULL; l = l->next) |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
245 | { |
|
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
|
246 | mmconv_current = l->data; |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
247 | if (conv == mmconv_current->conv) |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
248 | { |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
249 | return i; |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
250 | } |
|
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
|
251 | i++; |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
252 | } |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
253 | return -1; |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
254 | } |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
255 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
256 | static MMConversation* |
| 15884 | 257 | mmconv_from_conv(PurpleConversation *conv) |
|
11365
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
258 | { |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
259 | 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
|
260 | } |
|
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
261 | |
|
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
262 | static gboolean |
| 15884 | 263 | plugin_load(PurplePlugin *plugin) { |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
264 | void *conv_list_handle; |
|
34660
68c776e3436e
Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
265 | GList *l; |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
266 | |
| 15884 | 267 | PURPLE_DBUS_RETURN_FALSE_IF_DISABLED(plugin); |
|
14018
0d82c17d8000
[gaim-migrate @ 16505]
Mark Doliner <markdoliner@pidgin.im>
parents:
13234
diff
changeset
|
268 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
269 | /* First, we have to register our four exported functions with the |
| 15884 | 270 | main purple dbus loop. Without this statement, the purple dbus |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
271 | code wouldn't know about our functions. */ |
| 15884 | 272 | PURPLE_DBUS_REGISTER_BINDINGS(plugin); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
273 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
274 | /* Keep the plugin for reference (needed for notify's) */ |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
275 | plugin_pointer = plugin; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
276 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
277 | /* Add the button to all the current conversations */ |
|
34660
68c776e3436e
Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
278 | for (l = purple_conversations_get_all(); l != NULL; l = l->next) |
|
68c776e3436e
Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
279 | init_conversation((PurpleConversation *)l->data); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
280 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
281 | /* Listen for any new conversations */ |
| 15884 | 282 | conv_list_handle = purple_conversations_get_handle(); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
283 | |
|
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
284 | purple_signal_connect(conv_list_handle, "conversation-created", |
| 15884 | 285 | plugin, PURPLE_CALLBACK(init_conversation), NULL); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
286 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
287 | /* Listen for conversations that are ending */ |
| 15884 | 288 | purple_signal_connect(conv_list_handle, "deleting-conversation", |
| 289 | plugin, PURPLE_CALLBACK(conv_destroyed), NULL); | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
290 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
291 | /* Listen for sending/receiving messages to replace tags */ |
| 15884 | 292 | purple_signal_connect(conv_list_handle, "sending-im-msg", |
| 293 | plugin, PURPLE_CALLBACK(intercept_sent), NULL); | |
| 294 | purple_signal_connect(conv_list_handle, "receiving-im-msg", | |
| 295 | plugin, PURPLE_CALLBACK(intercept_received), NULL); | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
296 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
297 | return TRUE; |
|
11088
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
298 | } |
|
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
299 | |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
300 | static gboolean |
| 15884 | 301 | plugin_unload(PurplePlugin *plugin) { |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
302 | MMConversation *mmconv = NULL; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
303 | |
|
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
|
304 | while (conversations != NULL) |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
305 | { |
|
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
|
306 | mmconv = conversations->data; |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
307 | conv_destroyed(mmconv->conv); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
308 | } |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
309 | return TRUE; |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
310 | } |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
311 | |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
312 | |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
313 | |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
314 | static gboolean |
| 15884 | 315 | 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
|
316 | { |
|
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
|
317 | 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
|
318 | 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
|
319 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
320 | if (0 == strncmp(*message, MUSICMESSAGING_PREFIX, strlen(MUSICMESSAGING_PREFIX))) |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
321 | { |
| 15884 | 322 | 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
|
323 | message = 0; |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
324 | } |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
325 | 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
|
326 | { |
| 15884 | 327 | purple_debug_misc("purple-musicmessaging", "Sent MM request.\n"); |
|
11420
7e38dc3d0f48
[gaim-migrate @ 13657]
Christian Muise <christian.muise@gmail.com>
parents:
11418
diff
changeset
|
328 | return FALSE; |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
329 | } |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
330 | 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
|
331 | { |
| 15884 | 332 | purple_debug_misc("purple-musicmessaging", "Sent MM confirm.\n"); |
|
11420
7e38dc3d0f48
[gaim-migrate @ 13657]
Christian Muise <christian.muise@gmail.com>
parents:
11418
diff
changeset
|
333 | return FALSE; |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
334 | } |
|
11365
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
335 | else if (0 == strncmp(*message, "test1", strlen("test1"))) |
|
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
336 | { |
| 15884 | 337 | 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
|
338 | 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
|
339 | return FALSE; |
|
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
340 | } |
|
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
341 | else if (0 == strncmp(*message, "test2", strlen("test2"))) |
|
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
342 | { |
| 15884 | 343 | 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
|
344 | send_change_confirmed(1, "test-command", "test-parameters"); |
|
11365
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
345 | return FALSE; |
|
9138f01151d7
[gaim-migrate @ 13589]
Christian Muise <christian.muise@gmail.com>
parents:
11362
diff
changeset
|
346 | } |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
347 | else |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
348 | { |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
349 | return FALSE; |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
350 | /* Do nothing...procceed as normal */ |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
351 | } |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
352 | return TRUE; |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
353 | } |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
354 | |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
355 | static gboolean |
| 15884 | 356 | 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
|
357 | { |
|
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
|
358 | MMConversation *mmconv; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
359 | |
|
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
|
360 | 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
|
361 | /* 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
|
362 | * 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
|
363 | */ |
|
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
|
364 | 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
|
365 | } |
|
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
|
366 | |
|
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
|
367 | mmconv = mmconv_from_conv(conv); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
368 | |
| 15884 | 369 | purple_debug_misc("purple-musicmessaging", "Intercepted: %s\n", *message); |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
370 | if (strstr(*message, MUSICMESSAGING_PREFIX)) |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
371 | { |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
372 | char *parsed_message = strtok(strstr(*message, MUSICMESSAGING_PREFIX), "<"); |
| 15884 | 373 | 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
|
374 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
375 | if (mmconv->started) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
376 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
377 | if (strstr(parsed_message, "request")) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
378 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
379 | if (mmconv->originator) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
380 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
381 | 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
|
382 | const char *id = purple_conversation_get_name(mmconv->conv); |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
383 | char *command; |
|
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
384 | char *parameters; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
385 | |
| 15884 | 386 | purple_debug_misc("purple-musicmessaging", "Sending request to gscore.\n"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
387 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
388 | /* Get past the first two terms - '##MM##' and 'request' */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
389 | strtok(parsed_message, " "); /* '##MM##' */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
390 | strtok(NULL, " "); /* 'request' */ |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
391 | |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
392 | command = strtok(NULL, " "); |
|
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
393 | parameters = strtok(NULL, "#"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
394 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
395 | send_change_request (session, id, command, parameters); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
396 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
397 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
398 | } else if (strstr(parsed_message, "confirm")) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
399 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
400 | if (!mmconv->originator) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
401 | { |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
402 | int session = mmconv_from_conv_loc(conv); |
|
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
403 | char *command; |
|
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
404 | char *parameters; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
405 | |
| 15884 | 406 | purple_debug_misc("purple-musicmessaging", "Sending confirmation to gscore.\n"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
407 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
408 | /* Get past the first two terms - '##MM##' and 'confirm' */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
409 | strtok(parsed_message, " "); /* '##MM##' */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
410 | strtok(NULL, " "); /* 'confirm' */ |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
411 | |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
412 | command = strtok(NULL, " "); |
|
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
413 | parameters = strtok(NULL, "#"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
414 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
415 | send_change_confirmed (session, command, parameters); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
416 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
417 | } else if (strstr(parsed_message, "failed")) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
418 | { |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
419 | char *id; |
|
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
420 | char *command; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
421 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
422 | /* Get past the first two terms - '##MM##' and 'confirm' */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
423 | strtok(parsed_message, " "); /* '##MM##' */ |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
424 | strtok(NULL, " "); /* 'failed' */ |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
425 | |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
426 | id = strtok(NULL, " "); |
|
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
427 | command = strtok(NULL, " "); |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
428 | /* char *parameters = strtok(NULL, "#"); DONT NEED PARAMETERS */ |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
429 | |
|
32619
1dc7c15bc3ef
More code changed to use the accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
430 | // 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
|
431 | if (purple_conversation_get_name(mmconv->conv) == id) |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
432 | { |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
433 | 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
|
434 | _("Music Messaging"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34292
diff
changeset
|
435 | _("There was a conflict in running the command:"), command, NULL, NULL, NULL); |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
436 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
437 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
438 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
439 | |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
440 | message = 0; |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
441 | } |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
442 | else if (strstr(*message, MUSICMESSAGING_START_MSG)) |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
443 | { |
| 15884 | 444 | purple_debug_misc("purple-musicmessaging", "Received MM request.\n"); |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
445 | if (!(mmconv->originator)) |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
446 | { |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
447 | mmconv->requested = TRUE; |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
448 | return FALSE; |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
449 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
450 | |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
451 | } |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
452 | else if (strstr(*message, MUSICMESSAGING_CONFIRM_MSG)) |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
453 | { |
| 15884 | 454 | purple_debug_misc("purple-musicmessagin", "Received MM confirm.\n"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
455 | |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
456 | if (mmconv->originator) |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
457 | { |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
458 | start_session(mmconv); |
|
11420
7e38dc3d0f48
[gaim-migrate @ 13657]
Christian Muise <christian.muise@gmail.com>
parents:
11418
diff
changeset
|
459 | return FALSE; |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
460 | } |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
461 | } |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
462 | else |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
463 | { |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
464 | return FALSE; |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
465 | /* Do nothing. */ |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
466 | } |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
467 | return TRUE; |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
468 | } |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
469 | |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
470 | static void send_request(MMConversation *mmconv) |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
471 | { |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
472 | PurpleConnection *connection = purple_conversation_get_connection(mmconv->conv); |
| 15884 | 473 | const char *convName = purple_conversation_get_name(mmconv->conv); |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35037
diff
changeset
|
474 | purple_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
|
475 | } |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
476 | |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
477 | static void send_request_confirmed(MMConversation *mmconv) |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
478 | { |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
479 | PurpleConnection *connection = purple_conversation_get_connection(mmconv->conv); |
| 15884 | 480 | const char *convName = purple_conversation_get_name(mmconv->conv); |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35037
diff
changeset
|
481 | purple_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
|
482 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
483 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
484 | |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
485 | static gboolean |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
486 | start_session(MMConversation *mmconv) |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
487 | { |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
488 | run_editor(mmconv); |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
489 | return TRUE; |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
490 | } |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
491 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
492 | static void session_end (MMConversation *mmconv) |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
493 | { |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
494 | mmconv->started = FALSE; |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
495 | mmconv->originator = FALSE; |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
496 | mmconv->requested = FALSE; |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
497 | kill_editor(mmconv); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
498 | } |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
499 | |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
500 | static void music_button_toggled (GtkWidget *widget, gpointer data) |
|
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
501 | { |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
502 | MMConversation *mmconv = mmconv_from_conv(((MMConversation *) data)->conv); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
503 | 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
|
504 | { |
|
11418
9a84d5b27748
[gaim-migrate @ 13655]
Christian Muise <christian.muise@gmail.com>
parents:
11417
diff
changeset
|
505 | if (((MMConversation *) data)->requested) |
|
9a84d5b27748
[gaim-migrate @ 13655]
Christian Muise <christian.muise@gmail.com>
parents:
11417
diff
changeset
|
506 | { |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
507 | start_session(mmconv); |
|
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
508 | send_request_confirmed(mmconv); |
|
11418
9a84d5b27748
[gaim-migrate @ 13655]
Christian Muise <christian.muise@gmail.com>
parents:
11417
diff
changeset
|
509 | } |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
510 | else |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
511 | { |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
512 | ((MMConversation *) data)->originator = TRUE; |
|
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
513 | send_request((MMConversation *) data); |
|
11418
9a84d5b27748
[gaim-migrate @ 13655]
Christian Muise <christian.muise@gmail.com>
parents:
11417
diff
changeset
|
514 | } |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
515 | } else { |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
516 | session_end((MMConversation *)data); |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
517 | } |
|
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
518 | } |
|
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
519 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
520 | static void set_editor_path (GtkWidget *button, GtkWidget *text_field) |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
521 | { |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
522 | const char * path = gtk_entry_get_text((GtkEntry*)text_field); |
| 15884 | 523 | purple_prefs_set_string("/plugins/gtk/musicmessaging/editor_path", path); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
524 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
525 | } |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
526 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
527 | static void run_editor (MMConversation *mmconv) |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
528 | { |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
529 | GError *spawn_error = NULL; |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
530 | GString *session_id; |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
531 | gchar * args[4]; |
| 15884 | 532 | 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
|
533 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
534 | args[1] = "-session_id"; |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
535 | 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
|
536 | 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
|
537 | args[2] = session_id->str; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
538 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
539 | args[3] = NULL; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
540 | |
|
11417
f5fea1b5986f
[gaim-migrate @ 13654]
Christian Muise <christian.muise@gmail.com>
parents:
11365
diff
changeset
|
541 | 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
|
542 | { |
| 15884 | 543 | purple_notify_error(plugin_pointer, _("Error Running Editor"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34292
diff
changeset
|
544 | _("The following error has occurred:"), spawn_error->message, NULL); |
|
11254
3cbf29bdc44a
[gaim-migrate @ 13426]
Christian Muise <christian.muise@gmail.com>
parents:
11216
diff
changeset
|
545 | mmconv->started = FALSE; |
|
3cbf29bdc44a
[gaim-migrate @ 13426]
Christian Muise <christian.muise@gmail.com>
parents:
11216
diff
changeset
|
546 | } |
|
3cbf29bdc44a
[gaim-migrate @ 13426]
Christian Muise <christian.muise@gmail.com>
parents:
11216
diff
changeset
|
547 | else |
|
3cbf29bdc44a
[gaim-migrate @ 13426]
Christian Muise <christian.muise@gmail.com>
parents:
11216
diff
changeset
|
548 | { |
|
3cbf29bdc44a
[gaim-migrate @ 13426]
Christian Muise <christian.muise@gmail.com>
parents:
11216
diff
changeset
|
549 | mmconv->started = TRUE; |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
550 | } |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
551 | } |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
552 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
553 | static void kill_editor (MMConversation *mmconv) |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
554 | { |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
555 | if (mmconv->pid) |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
556 | { |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
557 | kill(mmconv->pid, SIGINT); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
558 | mmconv->pid = 0; |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
559 | } |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
560 | } |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
561 | |
| 15884 | 562 | static void init_conversation (PurpleConversation *conv) |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
563 | { |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
564 | MMConversation *mmconv; |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
565 | mmconv = g_malloc(sizeof(MMConversation)); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
566 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
567 | mmconv->conv = conv; |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
568 | mmconv->started = FALSE; |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
569 | mmconv->originator = FALSE; |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
570 | mmconv->requested = FALSE; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
571 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
572 | add_button(mmconv); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
573 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
574 | conversations = g_list_append(conversations, mmconv); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
575 | } |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
576 | |
| 15884 | 577 | static void conv_destroyed (PurpleConversation *conv) |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
578 | { |
|
11362
d28bb616f412
[gaim-migrate @ 13586]
Christian Muise <christian.muise@gmail.com>
parents:
11355
diff
changeset
|
579 | MMConversation *mmconv = mmconv_from_conv(conv); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
580 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
581 | remove_widget(mmconv->button); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
582 | remove_widget(mmconv->seperator); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
583 | if (mmconv->started) |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
584 | { |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
585 | kill_editor(mmconv); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
586 | } |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
587 | conversations = g_list_remove(conversations, mmconv); |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
588 | } |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
589 | |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
590 | static void add_button (MMConversation *mmconv) |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
591 | { |
|
34292
30107eb2ff81
Fix compiler warnings, make build even more silent
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
592 | #if 0 |
| 15884 | 593 | PurpleConversation *conv = mmconv->conv; |
|
34292
30107eb2ff81
Fix compiler warnings, make build even more silent
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
594 | #endif |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
595 | |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
596 | GtkWidget *button, *image, *sep; |
|
11900
26ddf2b8a8fe
[gaim-migrate @ 14191]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11659
diff
changeset
|
597 | gchar *file_path; |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
598 | |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
599 | button = gtk_toggle_button_new(); |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
600 | gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
601 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
602 | 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
|
603 | |
| 15884 | 604 | file_path = g_build_filename(DATADIR, "pixmaps", "purple", "buttons", |
|
11659
65d522cdb2d6
[gaim-migrate @ 13944]
Gary Kramlich <grim@reaperworld.com>
parents:
11420
diff
changeset
|
605 | "music.png", NULL); |
|
11254
3cbf29bdc44a
[gaim-migrate @ 13426]
Christian Muise <christian.muise@gmail.com>
parents:
11216
diff
changeset
|
606 | image = gtk_image_new_from_file(file_path); |
|
11659
65d522cdb2d6
[gaim-migrate @ 13944]
Gary Kramlich <grim@reaperworld.com>
parents:
11420
diff
changeset
|
607 | g_free(file_path); |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
608 | |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
609 | gtk_container_add((GtkContainer *)button, image); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
610 | |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
611 | sep = gtk_vseparator_new(); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
612 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
613 | mmconv->seperator = sep; |
|
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
614 | mmconv->button = button; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
615 | |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
616 | gtk_widget_show(sep); |
|
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
617 | gtk_widget_show(image); |
|
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
618 | gtk_widget_show(button); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
619 | |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32698
diff
changeset
|
620 | #if 0 |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
621 | 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
|
622 | 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
|
623 | #endif |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
624 | } |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
625 | |
|
11200
082b8c63d9b1
[gaim-migrate @ 13328]
Christian Muise <christian.muise@gmail.com>
parents:
11169
diff
changeset
|
626 | static void remove_widget (GtkWidget *button) |
|
11169
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
627 | { |
|
96612b706d45
[gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents:
11166
diff
changeset
|
628 | gtk_widget_hide(button); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
629 | gtk_widget_destroy(button); |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
630 | } |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
631 | |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
632 | static GtkWidget * |
| 15884 | 633 | get_config_frame(PurplePlugin *plugin) |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
634 | { |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
635 | GtkWidget *ret; |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
636 | GtkWidget *vbox; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
637 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
638 | GtkWidget *editor_path; |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
639 | GtkWidget *editor_path_label; |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
640 | GtkWidget *editor_path_button; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
641 | |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
642 | /* Outside container */ |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
643 | ret = gtk_box_new(GTK_ORIENTATION_VERTICAL, 18); |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
644 | gtk_container_set_border_width(GTK_CONTAINER(ret), 10); |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
645 | |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
646 | /* Configuration frame */ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
647 | vbox = pidgin_make_frame(ret, _("Music Messaging Configuration")); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
648 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
649 | /* Path to the score editor */ |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
650 | editor_path = gtk_entry_new(); |
|
13090
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
651 | editor_path_label = gtk_label_new(_("Score Editor Path")); |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
652 | editor_path_button = gtk_button_new_with_mnemonic(_("_Apply")); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
653 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
654 | 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
|
655 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
656 | g_signal_connect(G_OBJECT(editor_path_button), "clicked", |
|
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
657 | G_CALLBACK(set_editor_path), editor_path); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
658 | |
|
11166
61bc885358db
[gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents:
11108
diff
changeset
|
659 | 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
|
660 | 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
|
661 | 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
|
662 | |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
663 | gtk_widget_show_all(ret); |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
664 | |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
665 | return ret; |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
666 | } |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
667 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
668 | static PidginPluginUiInfo ui_info = |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
669 | { |
|
12627
fa4c64a821d2
[gaim-migrate @ 14963]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12604
diff
changeset
|
670 | get_config_frame, |
|
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
|
671 | |
|
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
|
672 | /* padding */ |
|
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
|
673 | NULL, |
|
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
|
674 | NULL, |
|
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
|
675 | NULL, |
|
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
|
676 | NULL |
|
11108
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
677 | }; |
|
cd88f2093c73
[gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents:
11088
diff
changeset
|
678 | |
| 15884 | 679 | static PurplePluginInfo info = { |
| 680 | PURPLE_PLUGIN_MAGIC, | |
| 681 | PURPLE_MAJOR_VERSION, | |
| 682 | PURPLE_MINOR_VERSION, | |
| 683 | PURPLE_PLUGIN_STANDARD, /**< type */ | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
684 | PIDGIN_PLUGIN_TYPE, /**< ui_requirement */ |
|
13090
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
685 | 0, /**< flags */ |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
686 | NULL, /**< dependencies */ |
| 15884 | 687 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
|
11088
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
688 | |
|
13090
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
689 | MUSICMESSAGING_PLUGIN_ID, /**< id */ |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
690 | "Music Messaging", /**< name */ |
|
20288
5ca925a094e2
applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19988
diff
changeset
|
691 | DISPLAY_VERSION, /**< version */ |
|
13090
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
692 | N_("Music Messaging Plugin for collaborative composition."), |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
693 | /** summary */ |
|
27525
579b9d64b364
A semi-random collection of English spelling and grammatical changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26756
diff
changeset
|
694 | N_("The Music Messaging Plugin allows a number of users to simultaneously " |
|
579b9d64b364
A semi-random collection of English spelling and grammatical changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26756
diff
changeset
|
695 | "work on a piece of music by editing a common score in real-time."), |
|
13090
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
696 | /** description */ |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
697 | "Christian Muise <christian.muise@gmail.com>", /**< author */ |
| 15884 | 698 | PURPLE_WEBSITE, /**< homepage */ |
|
13090
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
699 | plugin_load, /**< load */ |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
700 | plugin_unload, /**< unload */ |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
701 | NULL, /**< destroy */ |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
702 | &ui_info, /**< ui_info */ |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12627
diff
changeset
|
703 | NULL, /**< extra_info */ |
|
11088
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
704 | NULL, |
|
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
|
705 | NULL, |
|
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
|
706 | |
|
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
|
707 | /* padding */ |
|
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
|
708 | NULL, |
|
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
|
709 | NULL, |
|
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
|
710 | NULL, |
|
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
|
711 | NULL |
|
11088
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
712 | }; |
|
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
713 | |
|
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
714 | static void |
| 15884 | 715 | init_plugin(PurplePlugin *plugin) { |
| 716 | 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
|
717 | purple_prefs_add_string("/plugins/gtk/musicmessaging/editor_path", "/usr/bin/gscore"); |
|
11088
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
718 | } |
|
a27865ae1e2b
[gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff
changeset
|
719 | |
| 15884 | 720 | PURPLE_INIT_PLUGIN(musicmessaging, init_plugin, info); |