-
Notifications
You must be signed in to change notification settings - Fork 13
/
googlechat_pblite.h
56 lines (46 loc) · 1.78 KB
/
googlechat_pblite.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* GoogleChat Plugin for libpurple/Pidgin
* Copyright (c) 2015-2016 Eion Robb, Mike Ruprecht
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _GOOGLECHAT_PBLITE_H_
#define _GOOGLECHAT_PBLITE_H_
#include <protobuf-c/protobuf-c.h>
#include "googlechat_json.h"
#include "googlechat.pb-c.h"
/**
* Decode a JsonArray into a ProtobufCMessage.
*
* \param message
* The message type to store as. Is also used as the output.
* \param pblite_array
* The JSON array of data to parse.
* \param ignore_first_item
* Whether to skip the first item in the array (sometimes it's garbage data to identify type).
* \return
* TRUE if successful, FALSE if there was an error.
*/
gboolean pblite_decode(ProtobufCMessage *message, JsonArray *pblite_array, gboolean ignore_first_item);
/**
* Encodes a ProtobufCMessage into a JsonArray.
*
* \param message
* The message to parse into the equivalent pblite array.
* \return
* The JSON array of data, ready to be sent.
*/
JsonArray *pblite_encode(ProtobufCMessage *message);
gchar *pblite_dump_json(ProtobufCMessage *message);
#endif /* _GOOGLECHAT_PBLITE_H_ */