purple: add support for latest appstreamcli
[siplcs.git] / src / miranda / miranda-user.c
blob5b22b47a8e5327cd940b08fa6020b0653fd99465
1 /**
2 * @file miranda-user.c
4 * pidgin-sipe
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
23 #include <windows.h>
24 #include <stdio.h>
25 #include <glib.h>
27 #include "miranda-version.h"
28 #include "newpluginapi.h"
29 #include "m_protosvc.h"
30 #include "m_protoint.h"
31 #include "m_database.h"
33 #include "sipe-backend.h"
34 #include "sipe-core.h"
35 #include "miranda-private.h"
37 void sipe_backend_user_feedback_typing(struct sipe_core_public *sipe_public,
38 const gchar *from)
40 HANDLE hContact = sipe_backend_buddy_find( sipe_public, from, NULL );
42 if (!hContact)
43 return;
45 CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)6);
48 void sipe_backend_user_feedback_typing_stop(struct sipe_core_public *sipe_public,
49 const gchar *from)
51 HANDLE hContact = sipe_backend_buddy_find( sipe_public, from, NULL );
53 if (!hContact)
54 return;
56 CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)0);
59 void sipe_backend_user_ask(struct sipe_core_public *sipe_public,
60 const gchar *message,
61 const gchar *accept_label,
62 const gchar *decline_label,
63 gpointer key)
65 _NIF();
68 void sipe_backend_user_ask_choice(struct sipe_core_public *sipe_public,
69 const gchar *message,
70 GSList *choices,
71 gpointer key)
73 _NIF();
76 void sipe_backend_user_close_ask(gpointer key)
78 _NIF();
81 int sipe_miranda_SetAwayMsg(SIPPROTO *pr,
82 int m_iStatus,
83 const PROTOCHAR* msg)
85 const gchar *note = TCHAR2CHAR(msg);
87 SIPE_DEBUG_INFO("SetAwayMsg: status <%x> msg <%ls>", m_iStatus, msg);
88 sipe_miranda_setString(pr, "note", note);
89 LOCK;
90 if (pr->state == SIPE_MIRANDA_CONNECTED)
91 sipe_core_status_set(pr->sip, FALSE, MirandaStatusToSipe(pr->proto.m_iStatus), note);
92 UNLOCK;
93 return 0;
96 int sipe_miranda_UserIsTyping( SIPPROTO *pr, HANDLE hContact, int type )
98 SIPE_DEBUG_INFO("type <%x>", type);
99 if (hContact)
101 DBVARIANT dbv;
102 char *name;
104 if ( !DBGetContactSettingString( hContact, pr->proto.m_szModuleName, SIP_UNIQUEID, &dbv )) {
105 name = g_strdup(dbv.pszVal);
106 DBFreeVariant(&dbv);
107 } else {
108 return 1;
111 switch (type) {
112 case PROTOTYPE_SELFTYPING_ON:
113 LOCK;
114 sipe_core_user_feedback_typing(pr->sip, name, TRUE);
115 UNLOCK;
116 g_free(name);
117 return 0;
119 case PROTOTYPE_SELFTYPING_OFF:
120 /* Not supported anymore? */
121 LOCK;
122 sipe_core_user_feedback_typing(pr->sip, name, FALSE);
123 UNLOCK;
124 g_free(name);
125 return 0;
128 g_free(name);
131 return 1;
136 Local Variables:
137 mode: c
138 c-file-style: "bsd"
139 indent-tabs-mode: t
140 tab-width: 8
141 End: