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