libpurple/protocols/jabber/google/google_presence.c

Mon, 21 Dec 2015 14:46:12 -0500

author
Michael McConville <mmcco@mykolab.com>
date
Mon, 21 Dec 2015 14:46:12 -0500
changeset 37423
d2f0259aa43f
parent 36545
23b59a16c808
child 40125
a7acc7b00d79
permissions
-rw-r--r--

Remove NULL-checks before free(). No functional change.

29914
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
1 /**
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
2 * Purple is the legal property of its developers, whose names are too numerous
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
3 * to list here. Please refer to the COPYRIGHT file distributed with this
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
4 * source distribution.
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
5 *
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
9 * (at your option) any later version.
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
10 *
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
14 * GNU General Public License for more details.
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
15 *
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
19 */
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
20
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
21 #include "internal.h"
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
22 #include "debug.h"
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
23 #include "google_presence.h"
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
24
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
25 void jabber_google_presence_incoming(JabberStream *js, const char *user, JabberBuddyResource *jbr)
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
26 {
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
27 if (!js->googletalk)
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
28 return;
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
29 if (jbr->status && purple_str_has_prefix(jbr->status, "♫ ")) {
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 32438
diff changeset
30 purple_protocol_got_user_status(purple_connection_get_account(js->gc), user, "tune",
29914
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
31 PURPLE_TUNE_TITLE, jbr->status + strlen("♫ "), NULL);
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
32 g_free(jbr->status);
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
33 jbr->status = NULL;
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
34 } else {
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 32438
diff changeset
35 purple_protocol_got_user_status_deactive(purple_connection_get_account(js->gc), user, "tune");
29914
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
36 }
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
37 }
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
38
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
39 char *jabber_google_presence_outgoing(PurpleStatus *tune)
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
40 {
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
41 const char *attr = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE);
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
42 return attr ? g_strdup_printf("♫ %s", attr) : g_strdup("");
a4ed5999f6d0 Added new files in sub directory google
Marcus Lundblad <malu@pidgin.im>
parents:
diff changeset
43 }

mercurial