6 * Copyright (C) 2010-2018 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
32 #include "purple-private.h"
34 #if PURPLE_VERSION_CHECK(3,0,0)
36 #define purple_serv_got_typing(c, n, t, s) serv_got_typing(c, n, t, s)
37 #define purple_serv_got_typing_stopped(c, n) serv_got_typing_stopped(c, n)
38 #define PURPLE_IM_TYPING PURPLE_TYPING
41 #include "sipe-backend.h"
42 #include "sipe-core.h"
45 #define SIPE_TYPING_RECV_TIMEOUT 6
47 void sipe_backend_user_feedback_typing(struct sipe_core_public
*sipe_public
,
50 struct sipe_backend_private
*purple_private
= sipe_public
->backend_private
;
51 purple_serv_got_typing(purple_private
->gc
, from
,
52 SIPE_TYPING_RECV_TIMEOUT
,
56 void sipe_backend_user_feedback_typing_stop(struct sipe_core_public
*sipe_public
,
59 struct sipe_backend_private
*purple_private
= sipe_public
->backend_private
;
60 purple_serv_got_typing_stopped(purple_private
->gc
, from
);
63 static void ask_cb(gpointer key
, int choice
)
65 sipe_core_user_ask_cb(key
, choice
== 1);
68 void sipe_backend_user_ask(struct sipe_core_public
*sipe_public
,
70 const gchar
*accept_label
,
71 const gchar
*decline_label
,
74 struct sipe_backend_private
*purple_private
= sipe_public
->backend_private
;
76 purple_request_action(key
, "Office Communicator", message
,
78 #if PURPLE_VERSION_CHECK(3,0,0)
79 purple_request_cpar_from_account(purple_private
->account
),
81 purple_private
->account
, NULL
, NULL
,
84 accept_label
, (PurpleRequestActionCb
) ask_cb
,
85 decline_label
, (PurpleRequestActionCb
) ask_cb
);
88 void sipe_backend_user_close_ask(gpointer key
)
90 purple_request_close_with_handle(key
);
93 static void ask_choice_accept_cb(gpointer key
, PurpleRequestFields
*fields
)
96 GPOINTER_TO_INT(purple_request_fields_get_choice(fields
, "choice"));
98 sipe_core_user_ask_choice_cb(key
, choice_id
);
101 static void ask_choice_cancel_cb(gpointer key
)
103 sipe_core_user_ask_choice_cb(key
, SIPE_CHOICE_CANCELLED
);
107 void sipe_backend_user_ask_choice(struct sipe_core_public
*sipe_public
,
108 const gchar
*message
,
112 struct sipe_backend_private
*purple_private
= sipe_public
->backend_private
;
114 PurpleRequestFields
*fields
= purple_request_fields_new();
115 PurpleRequestFieldGroup
*group
= purple_request_field_group_new(NULL
);
116 PurpleRequestField
*field
=
117 purple_request_field_choice_new("choice", message
, 0);
120 for (i
= 0; i
!= g_slist_length(choices
); ++i
) {
121 purple_request_field_choice_add(field
,
122 g_slist_nth_data(choices
, i
)
123 #if PURPLE_VERSION_CHECK(3,0,0)
124 , GUINT_TO_POINTER(i
)
129 purple_request_field_group_add_field(group
, field
);
130 purple_request_fields_add_group(fields
, group
);
132 purple_request_fields(key
, "Microsoft Lync",
134 _("OK"), (GCallback
)ask_choice_accept_cb
,
135 _("Cancel"), (GCallback
)ask_choice_cancel_cb
,
136 #if PURPLE_VERSION_CHECK(3,0,0)
137 purple_request_cpar_from_account(purple_private
->account
),
139 purple_private
->account
, NULL
, NULL
,