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