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-backend.h"
35 #include "sipe-core.h"
36 #include "miranda-private.h"
38 static void notify_message(struct sipe_core_public
*sipe_public
,
39 struct sipe_backend_chat_session
*backend_session
,
46 SIPPROTO
*pr
= sipe_public
->backend_private
;
54 gcd
.pszModule
= pr
->proto
.m_szModuleName
;
55 gcd
.pszID
= backend_session
->conv
;
56 gcd
.iType
= GC_EVENT_INFORMATION
;
58 msg
= mir_alloc(strlen(message
)+strlen(prefix
)+1);
59 mir_snprintf(msg
, strlen(message
)+strlen(prefix
)+1, "%s%s", prefix
, message
);
61 gce
.cbSize
= sizeof(gce
);
64 // gce.time = mtime; // FIXME: Generate timestamp
66 CallService( MS_GC_EVENT
, 0, (LPARAM
)&gce
);
70 HANDLE hContact
= sipe_backend_buddy_find( sipe_public
, who
, NULL
);
73 sipe_miranda_AddEvent(pr
, hContact
, eventtype
, time(NULL
), DBEF_UTF
, strlen(message
), (PBYTE
)message
);
79 void sipe_backend_notify_message_error(struct sipe_core_public
*sipe_public
,
80 struct sipe_backend_chat_session
*backend_session
,
84 notify_message(sipe_public
, backend_session
, who
, message
, SIPE_EVENTTYPE_ERROR_NOTIFY
, "Error: ");
87 void sipe_backend_notify_message_info(struct sipe_core_public
*sipe_public
,
88 struct sipe_backend_chat_session
*backend_session
,
92 notify_message(sipe_public
, backend_session
, who
, message
, SIPE_EVENTTYPE_INFO_NOTIFY
, "Info: ");
95 void sipe_backend_notify_error(const gchar
*title
,
98 sipe_miranda_msgbox(msg
, title
);