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