pidgin/pidgin

facebook: Prevent disconnections on 509 errors, "Invalid attachment id"

I'm still not sure about the origin of these errors (I suspect it's a
race condition between servers), but it's going to be fixed properly in
the future when the sync protocol is updated and doing HTTP requests to
get the attachment URL is no longer required (newer orca versions only
do HTTP requests to get the url of file attachments, everything else is
included in the MQTT stream)
/* purple
*
* Purple is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with this
* source distribution.
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#include "smiley-theme.h"
static PurpleSmileyTheme *current = NULL;
/*******************************************************************************
* API implementation
******************************************************************************/
PurpleSmileyList *
purple_smiley_theme_get_smileys(PurpleSmileyTheme *theme, gpointer ui_data)
{
PurpleSmileyThemeClass *klass;
g_return_val_if_fail(PURPLE_IS_SMILEY_THEME(theme), NULL);
klass = PURPLE_SMILEY_THEME_GET_CLASS(theme);
g_return_val_if_fail(klass != NULL, NULL);
g_return_val_if_fail(klass->get_smileys != NULL, NULL);
return klass->get_smileys(theme, ui_data);
}
void
purple_smiley_theme_set_current(PurpleSmileyTheme *theme)
{
PurpleSmileyThemeClass *klass;
g_return_if_fail(theme == NULL || PURPLE_IS_SMILEY_THEME(theme));
if (theme)
g_object_ref(theme);
if (current)
g_object_unref(current);
current = theme;
if (!theme)
return;
klass = PURPLE_SMILEY_THEME_GET_CLASS(theme);
g_return_if_fail(klass != NULL);
if (klass->activate)
klass->activate(theme);
}
PurpleSmileyTheme *
purple_smiley_theme_get_current(void)
{
return current;
}
void
_purple_smiley_theme_uninit(void)
{
purple_smiley_theme_set_current(NULL);
}
/*******************************************************************************
* Object stuff
******************************************************************************/
GType
purple_smiley_theme_get_type(void)
{
static GType type = 0;
if (G_UNLIKELY(type == 0)) {
static const GTypeInfo info = {
.class_size = sizeof(PurpleSmileyThemeClass),
.instance_size = sizeof(PurpleSmileyTheme),
};
type = g_type_register_static(G_TYPE_OBJECT,
"PurpleSmileyTheme", &info, G_TYPE_FLAG_ABSTRACT);
}
return type;
}