ucs: fix Persona key extraction
[siplcs.git] / src / miranda / miranda-user.c
blobd2a15de04b8b0f74552402c75b3e2c71b43945fc
1 /**
2 * @file miranda-user.c
4 * pidgin-sipe
6 * Copyright (C) 2010-13 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_close_ask(gpointer key)
70 _NIF();
73 int sipe_miranda_SetAwayMsg(SIPPROTO *pr,
74 int m_iStatus,
75 const PROTOCHAR* msg)
77 const gchar *note = TCHAR2CHAR(msg);
79 SIPE_DEBUG_INFO("SetAwayMsg: status <%x> msg <%ls>", m_iStatus, msg);
80 sipe_miranda_setString(pr, "note", note);
81 LOCK;
82 if (pr->state == SIPE_MIRANDA_CONNECTED)
83 sipe_core_status_set(pr->sip, MirandaStatusToSipe(pr->proto.m_iStatus), note);
84 UNLOCK;
85 return 0;
88 int sipe_miranda_UserIsTyping( SIPPROTO *pr, HANDLE hContact, int type )
90 SIPE_DEBUG_INFO("type <%x>", type);
91 if (hContact)
93 DBVARIANT dbv;
94 char *name;
96 if ( !DBGetContactSettingString( hContact, pr->proto.m_szModuleName, SIP_UNIQUEID, &dbv )) {
97 name = g_strdup(dbv.pszVal);
98 DBFreeVariant(&dbv);
99 } else {
100 return 1;
103 switch (type) {
104 case PROTOTYPE_SELFTYPING_ON:
105 LOCK;
106 sipe_core_user_feedback_typing(pr->sip, name, TRUE);
107 UNLOCK;
108 g_free(name);
109 return 0;
111 case PROTOTYPE_SELFTYPING_OFF:
112 /* Not supported anymore? */
113 LOCK;
114 sipe_core_user_feedback_typing(pr->sip, name, FALSE);
115 UNLOCK;
116 g_free(name);
117 return 0;
120 g_free(name);
123 return 1;
128 Local Variables:
129 mode: c
130 c-file-style: "bsd"
131 indent-tabs-mode: t
132 tab-width: 8
133 End: