2 * @file purple-dbus-bindings.c
6 * Copyright (C) 2017 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #include "purple-dbus.h"
32 * The contents of this file need to be updated when any line which starts
33 * with DBUS_EXPORT in purple-dbus.h gets added/removed/changed.
35 * You'll need access to the Pidgin source code to update this file:
37 * $ python <path to pidgin>/libpurple/dbus-analyze-functions.py \
39 * src/purple/purple-dbus.h \
40 * >> src/purple/purple-dbus-bindings.c
42 * You'll have to edit the contents manually after running the above command.
46 * The generated xxx_DBUS() functions need to be copied here
50 sipe_call_phone_number_DBUS(DBusMessage
*message_DBUS
, DBusError
*error_DBUS
) {
51 DBusMessage
*reply_DBUS
;
52 dbus_int32_t account_ID
;
53 PurpleAccount
*account
;
54 const char *phone_number
;
55 dbus_message_get_args(message_DBUS
, error_DBUS
, DBUS_TYPE_INT32
, &account_ID
, DBUS_TYPE_STRING
, &phone_number
, DBUS_TYPE_INVALID
);
56 CHECK_ERROR(error_DBUS
);
57 PURPLE_DBUS_ID_TO_POINTER(account
, account_ID
, PurpleAccount
, error_DBUS
);
58 phone_number
= (phone_number
&& phone_number
[0]) ? phone_number
: NULL
;
59 sipe_call_phone_number(account
, phone_number
);
60 reply_DBUS
= dbus_message_new_method_return (message_DBUS
);
61 dbus_message_append_args(reply_DBUS
, DBUS_TYPE_INVALID
);
67 sipe_join_conference_with_organizer_and_id_DBUS(DBusMessage
*message_DBUS
, DBusError
*error_DBUS
) {
68 DBusMessage
*reply_DBUS
;
69 dbus_int32_t account_ID
;
70 PurpleAccount
*account
;
71 const char *organizer
;
72 const char *meeting_id
;
73 dbus_message_get_args(message_DBUS
, error_DBUS
, DBUS_TYPE_INT32
, &account_ID
, DBUS_TYPE_STRING
, &organizer
, DBUS_TYPE_STRING
, &meeting_id
, DBUS_TYPE_INVALID
);
74 CHECK_ERROR(error_DBUS
);
75 PURPLE_DBUS_ID_TO_POINTER(account
, account_ID
, PurpleAccount
, error_DBUS
);
76 organizer
= (organizer
&& organizer
[0]) ? organizer
: NULL
;
77 meeting_id
= (meeting_id
&& meeting_id
[0]) ? meeting_id
: NULL
;
78 sipe_join_conference_with_organizer_and_id(account
, organizer
, meeting_id
);
79 reply_DBUS
= dbus_message_new_method_return (message_DBUS
);
80 dbus_message_append_args(reply_DBUS
, DBUS_TYPE_INVALID
);
85 sipe_join_conference_with_uri_DBUS(DBusMessage
*message_DBUS
, DBusError
*error_DBUS
) {
86 DBusMessage
*reply_DBUS
;
87 dbus_int32_t account_ID
;
88 PurpleAccount
*account
;
90 dbus_message_get_args(message_DBUS
, error_DBUS
, DBUS_TYPE_INT32
, &account_ID
, DBUS_TYPE_STRING
, &uri
, DBUS_TYPE_INVALID
);
91 CHECK_ERROR(error_DBUS
);
92 PURPLE_DBUS_ID_TO_POINTER(account
, account_ID
, PurpleAccount
, error_DBUS
);
93 uri
= (uri
&& uri
[0]) ? uri
: NULL
;
94 sipe_join_conference_with_uri(account
, uri
);
95 reply_DBUS
= dbus_message_new_method_return (message_DBUS
);
96 dbus_message_append_args(reply_DBUS
, DBUS_TYPE_INVALID
);
101 sipe_republish_calendar_DBUS(DBusMessage
*message_DBUS
, DBusError
*error_DBUS
) {
102 DBusMessage
*reply_DBUS
;
103 dbus_int32_t account_ID
;
104 PurpleAccount
*account
;
105 dbus_message_get_args(message_DBUS
, error_DBUS
, DBUS_TYPE_INT32
, &account_ID
, DBUS_TYPE_INVALID
);
106 CHECK_ERROR(error_DBUS
);
107 PURPLE_DBUS_ID_TO_POINTER(account
, account_ID
, PurpleAccount
, error_DBUS
);
108 sipe_republish_calendar(account
);
109 reply_DBUS
= dbus_message_new_method_return (message_DBUS
);
110 dbus_message_append_args(reply_DBUS
, DBUS_TYPE_INVALID
);
115 sipe_reset_status_DBUS(DBusMessage
*message_DBUS
, DBusError
*error_DBUS
) {
116 DBusMessage
*reply_DBUS
;
117 dbus_int32_t account_ID
;
118 PurpleAccount
*account
;
119 dbus_message_get_args(message_DBUS
, error_DBUS
, DBUS_TYPE_INT32
, &account_ID
, DBUS_TYPE_INVALID
);
120 CHECK_ERROR(error_DBUS
);
121 PURPLE_DBUS_ID_TO_POINTER(account
, account_ID
, PurpleAccount
, error_DBUS
);
122 sipe_reset_status(account
);
123 reply_DBUS
= dbus_message_new_method_return (message_DBUS
);
124 dbus_message_append_args(reply_DBUS
, DBUS_TYPE_INVALID
);
129 * The contents of bindings_DBUS[] need to be copied here
131 PurpleDBusBinding sipe_purple_dbus_bindings
[] = {
133 {"SipeCallPhoneNumber", "in\0i\0account\0in\0s\0phone_number\0", sipe_call_phone_number_DBUS
},
135 {"SipeJoinConferenceWithOrganizerAndId", "in\0i\0account\0in\0s\0organizer\0in\0s\0meeting_id\0", sipe_join_conference_with_organizer_and_id_DBUS
},
136 {"SipeJoinConferenceWithUri", "in\0i\0account\0in\0s\0uri\0", sipe_join_conference_with_uri_DBUS
},
137 {"SipeRepublishCalendar", "in\0i\0account\0", sipe_republish_calendar_DBUS
},
138 {"SipeResetStatus", "in\0i\0account\0", sipe_reset_status_DBUS
},