2 * @file miranda-notify.c
6 * Copyright (C) 2010-11 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
28 #include "newpluginapi.h"
29 #include "m_protosvc.h"
30 #include "m_protoint.h"
32 #include "m_database.h"
34 #include "sipe-common.h"
35 #include "sipe-backend.h"
36 #include "sipe-core.h"
37 #include "miranda-private.h"
39 static void notify_message(struct sipe_core_public
*sipe_public
,
40 struct sipe_backend_chat_session
*backend_session
,
47 SIPPROTO
*pr
= sipe_public
->backend_private
;
55 gcd
.pszModule
= pr
->proto
.m_szModuleName
;
56 gcd
.pszID
= backend_session
->conv
;
57 gcd
.iType
= GC_EVENT_INFORMATION
;
59 msg
= mir_alloc(strlen(message
)+strlen(prefix
)+1);
60 mir_snprintf(msg
, strlen(message
)+strlen(prefix
)+1, "%s%s", prefix
, message
);
62 gce
.cbSize
= sizeof(gce
);
65 // gce.time = mtime; // FIXME: Generate timestamp
67 CallService( MS_GC_EVENT
, 0, (LPARAM
)&gce
);
71 HANDLE hContact
= sipe_backend_buddy_find( sipe_public
, who
, NULL
);
74 sipe_miranda_AddEvent(pr
, hContact
, eventtype
, time(NULL
), DBEF_UTF
, strlen(message
), (PBYTE
)message
);
80 void sipe_backend_notify_message_error(struct sipe_core_public
*sipe_public
,
81 struct sipe_backend_chat_session
*backend_session
,
85 notify_message(sipe_public
, backend_session
, who
, message
, SIPE_EVENTTYPE_ERROR_NOTIFY
, "Error: ");
88 void sipe_backend_notify_message_info(struct sipe_core_public
*sipe_public
,
89 struct sipe_backend_chat_session
*backend_session
,
93 notify_message(sipe_public
, backend_session
, who
, message
, SIPE_EVENTTYPE_INFO_NOTIFY
, "Info: ");
96 void sipe_backend_notify_error(SIPE_UNUSED_PARAMETER
struct sipe_core_public
*sipe_public
,
100 sipe_miranda_msgbox(msg
, title
);