Fix refcounting of messages received from the network with purple3
purple3 takes the reference for the PurpleMessage passed to
purple_conversation_write_message(). The purple2 compat needs to
destroy the message. This patch removes the explicit calls to
purple_message_destroy() and changes the
purple_conversation_write_message() compat for purple2 to call
purple_message_destroy() internally.
/*
* Hangouts 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/>.
*/
#define PURPLE_PLUGINS
#include"hangouts_media.h"
#include<stdlib.h>
#include<stdio.h>
#include<unistd.h>
#include"hangouts_pblite.h"
#include"hangouts_json.h"
#include"hangout_media.pb-c.h"
#include"hangouts_connection.h"
#include"hangouts_conversation.h" //just for hangouts_get_request_header()
if libpurple isn't compiled with USE_VV then a bunch of functions don't end up being exported, so we'll try load them in at runtime so we dont have to have a million and one different versions of the .so