pidgin/pidgin

bc7b43e17b3a
Merged in rw_grim/pidgin (pull request #301)

Remove #if 0's from libpurple

Approved-by: Elliott Sales de Andrade
--- a/libpurple/conversationtypes.c Fri Dec 15 03:52:01 2017 +0000
+++ b/libpurple/conversationtypes.c Tue Dec 26 05:28:40 2017 +0000
@@ -806,14 +806,6 @@
return;
}
-#if 0
- PurpleAccount *account = purple_conversation_get_account(conv);
- /* XXX: this should not be necessary */
- if (purple_strequal(purple_normalize(account, who), priv->nick)) {
- flags |= PURPLE_MESSAGE_SEND;
- }
-#endif
-
flags = purple_message_get_flags(msg);
if (flags & PURPLE_MESSAGE_RECV) {
if (purple_utf8_has_word(purple_message_get_contents(msg), priv->nick)) {
@@ -1455,36 +1447,11 @@
{
/* Still connected */
int chat_id = purple_chat_conversation_get_id(chat);
-#if 0
+
/*
- * This is unfortunately necessary, because calling
- * purple_serv_chat_leave() calls this purple_conversation_destroy(),
- * which leads to two calls here.. We can't just return after
- * this, because then it'll return on the next pass. So, since
- * purple_serv_got_chat_left(), which is eventually called from the
- * protocol that purple_serv_chat_leave() calls, removes this conversation
- * from the gc's buddy_chats list, we're going to check to see
- * if this exists in the list. If so, we want to return after
- * calling this, because it'll be called again. If not, fall
- * through, because it'll have already been removed, and we'd
- * be on the 2nd pass.
- *
- * Long paragraph. <-- Short sentence.
- *
- * -- ChipX86
- */
-
- if (gc && g_slist_find(gc->buddy_chats, conv) != NULL) {
- purple_serv_chat_leave(gc, chat_id);
-
- return;
- }
-#endif
- /*
- * Instead of all of that, lets just close the window when
- * the user tells us to, and let the protocol deal with the
- * internals on it's own time. Don't do this if the protocol already
- * knows it left the chat.
+ * Close the window when the user tells us to, and let the protocol
+ * deal with the internals on it's own time. Don't do this if the
+ * protocol already knows it left the chat.
*/
if (!purple_chat_conversation_has_left(chat))
purple_serv_chat_leave(gc, chat_id);
--- a/libpurple/dbus-server.c Fri Dec 15 03:52:01 2017 +0000
+++ b/libpurple/dbus-server.c Tue Dec 26 05:28:40 2017 +0000
@@ -691,13 +691,7 @@
gboolean xboolean;
gpointer ptr = NULL;
gpointer val;
-#if 0
- if (purple_value_is_outgoing(purple_values[i]))
- {
- ptr = my_arg(gpointer);
- g_return_val_if_fail(ptr, TRUE);
- }
-#endif
+
switch (types[i])
{
case G_TYPE_INT:
@@ -768,13 +762,8 @@
DBusMessageIter iter;
char *newname;
-#if 0 /* this is noisy with no dbus connection */
- g_return_if_fail(purple_dbus_connection);
-#else
if (purple_dbus_connection == NULL)
return;
-#endif
-
/*
* The test below is a hack that prevents our "dbus-method-called"
--- a/libpurple/http.c Fri Dec 15 03:52:01 2017 +0000
+++ b/libpurple/http.c Tue Dec 26 05:28:40 2017 +0000
@@ -236,11 +236,6 @@
guint16 host_len1; /* host string length */
guint16 host_len2; /* host string length */
guint32 host_off; /* host string offset (always 0x00000020) */
-
-#if 0
- guint8 host[*]; /* host string (ASCII) */
- guint8 dom[*]; /* domain string (ASCII) */
-#endif
};
static time_t purple_http_rfc1123_to_time(const gchar *str);
--- a/libpurple/log.c Fri Dec 15 03:52:01 2017 +0000
+++ b/libpurple/log.c Tue Dec 26 05:28:40 2017 +0000
@@ -364,19 +364,6 @@
PurpleLogLogger *purple_log_logger_new(const char *id, const char *name, int functions, ...)
{
-#if 0
- void(*create)(PurpleLog *),
- gsize(*write)(PurpleLog *, PurpleMessageFlags, const char *, GDateTime *, const char *),
- void(*finalize)(PurpleLog *),
- GList*(*list)(PurpleLogType type, const char*, PurpleAccount*),
- char*(*read)(PurpleLog*, PurpleLogReadFlags*),
- int(*size)(PurpleLog*),
- int(*total_size)(PurpleLogType type, const char *name, PurpleAccount *account),
- GList*(*list_syslog)(PurpleAccount *account),
- void(*get_log_sets)(PurpleLogSetCallback cb, GHashTable *sets),
- gboolean(*remove)(PurpleLog *log),
- gboolean(*is_deletable)(PurpleLog *log))
-#endif
PurpleLogLogger *logger;
va_list args;
--- a/libpurple/media.c Fri Dec 15 03:52:01 2017 +0000
+++ b/libpurple/media.c Tue Dec 26 05:28:40 2017 +0000
@@ -499,15 +499,6 @@
g_hash_table_insert(media->priv->sessions, g_strdup(session->id), session);
}
-#if 0
-static gboolean
-purple_media_remove_session(PurpleMedia *media, PurpleMediaSession *session)
-{
- g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
- return g_hash_table_remove(media->priv->sessions, session->id);
-}
-#endif
-
static PurpleMediaStream *
purple_media_insert_stream(PurpleMediaSession *session,
const gchar *name, gboolean initiator)
--- a/libpurple/stun.c Fri Dec 15 03:52:01 2017 +0000
+++ b/libpurple/stun.c Tue Dec 26 05:28:40 2017 +0000
@@ -63,14 +63,6 @@
guint16 len;
};
-#if 0
-struct stun_change {
- struct stun_header hdr;
- struct stun_attrib attrib;
- char value[4];
-};
-#endif /* 0 */
-
struct stun_conn {
int fd;
struct sockaddr_in addr;
@@ -150,27 +142,6 @@
return TRUE;
}
-#if 0
-static void do_test2(struct stun_conn *sc) {
- struct stun_change data;
- data.hdr.type = htons(0x0001);
- data.hdr.len = 0;
- data.hdr.transid[0] = rand();
- data.hdr.transid[1] = ntohl(((int)'g' << 24) + ((int)'a' << 16) + ((int)'i' << 8) + (int)'m');
- data.hdr.transid[2] = rand();
- data.hdr.transid[3] = rand();
- data.attrib.type = htons(0x003);
- data.attrib.len = htons(4);
- data.value[3] = 6;
- sc->packet = (struct stun_header*)&data;
- sc->packetsize = sizeof(struct stun_change);
- sc->retry = 0;
- sc->test = 2;
- sendto(sc->fd, sc->packet, sc->packetsize, 0, (struct sockaddr *)&(sc->addr), sizeof(struct sockaddr_in));
- sc->timeout = g_timeout_add(500, (GSourceFunc) timeoutfunc, sc);
-}
-#endif /* 0 */
-
static void reply_cb(gpointer data, gint source, PurpleInputCondition cond) {
struct stun_conn *sc = data;
guchar buffer[65536];
--- a/libpurple/tests/test_util.c Fri Dec 15 03:52:01 2017 +0000
+++ b/libpurple/tests/test_util.c Tue Dec 26 05:28:40 2017 +0000
@@ -472,6 +472,10 @@
"aaaa\xef\xbb\xbf",
"aaaa\xef\xbb\xbf",
}, {
+ /* U+FFFE (should be stripped) */
+ "aaaa\xef\xbf\xbe",
+ "aaaa",
+ }, {
NULL,
NULL,
}
@@ -484,20 +488,12 @@
g_free(result);
+ /* NULL as input is a valid test, but it's the last test, so we break
+ * after it.
+ */
if(data[i].input == NULL)
break;
}
-
-#if 0
- /* invalid UTF-8 */
- /* disabled because make check fails on an assertion */
- fail_unless(NULL == purple_utf8_strip_unprintables("abc\x80\x7f"));
- /* disabled because make check fails on an assertion */
- /* U+DB80 (Private Use High Surrogate, First) -- should be stripped */
- assert_string_equal_free("aaaa", purple_utf8_strip_unprintables("aaaa\xed\xa0\x80"));
- /* U+FFFE (should be stripped) */
- assert_string_equal_free("aaaa", purple_utf8_strip_unprintables("aaaa\xef\xbf\xbe"));
-#endif
}
/******************************************************************************
--- a/libpurple/trie.c Fri Dec 15 03:52:01 2017 +0000
+++ b/libpurple/trie.c Tue Dec 26 05:28:40 2017 +0000
@@ -244,44 +244,6 @@
return state;
}
-#if 0
-static gchar *
-purple_trie_print(PurpleTrieState *state, int limit)
-{
- GString *str = g_string_new(NULL);
- int i;
-
- if (limit < 0)
- return g_strdup("{ LIMIT }");
-
- if (state->found_word)
- g_string_append(str, "*");
- g_string_append(str, "{ ");
- for (i = 0; i < 256; i++) {
- gchar *chp;
- if (!state->children)
- continue;
- if (!state->children[i])
- continue;
- if (i == 0)
- g_string_append(str, "(null)->");
- else
- g_string_append_printf(str, "%c->", i);
- if (state->children[i] == state)
- g_string_append(str, "loop");
- else {
- chp = purple_trie_print(state->children[i], limit - 1);
- g_string_append(str, chp);
- g_string_append_c(str, ' ');
- g_free(chp);
- }
- }
- g_string_append(str, "}");
-
- return g_string_free(str, FALSE);
-}
-#endif
-
static gboolean
purple_trie_states_build(PurpleTrie *trie)
{
--- a/libpurple/upnp.h Fri Dec 15 03:52:01 2017 +0000
+++ b/libpurple/upnp.h Tue Dec 26 05:28:40 2017 +0000
@@ -62,19 +62,6 @@
*/
void purple_upnp_discover(PurpleUPnPCallback cb, gpointer cb_data);
-#if 0
-/**
- * purple_upnp_get_control_info:
- *
- * Retrieve the current UPnP control info, if there is any available.
- * This will only be filled in if purple_upnp_discover() had been called,
- * and finished discovering.
- *
- * Returns: The control URL for the IGD we'll use to use the IGD services
- */
-const PurpleUPnPControlInfo* purple_upnp_get_control_info(void);
-#endif
-
/**
* purple_upnp_get_public_ip:
*
--- a/libpurple/util.c Fri Dec 15 03:52:01 2017 +0000
+++ b/libpurple/util.c Tue Dec 26 05:28:40 2017 +0000
@@ -2538,13 +2538,6 @@
str2[j++] = '\n';
}
/* Check for tags which begin CDATA and need to be closed */
-#if 0 /* FIXME.. option is end tag optional, we can't handle this right now */
- else if (g_ascii_strncasecmp(str2 + i, "<option", 7) == 0)
- {
- /* FIXME: We should not do this if the OPTION is SELECT'd */
- cdata_close_tag = "</option>";
- }
-#endif
else if (g_ascii_strncasecmp(str2 + i, "<script", 7) == 0)
{
cdata_close_tag = "</script>";
@@ -5074,69 +5067,3 @@
return ret;
}
-
-#if 0
-
-/* Temporarily removed - re-add this when you need ini file support. */
-
-#define PURPLE_KEY_FILE_DEFAULT_MAX_SIZE 102400
-#define PURPLE_KEY_FILE_HARD_LIMIT 10485760
-
-gboolean
-purple_key_file_load_from_ini(GKeyFile *key_file, const gchar *file,
- gsize max_size)
-{
- const gchar *header = "[default]\n\n";
- int header_len = strlen(header);
- int fd;
- GStatBuf st;
- gsize file_size, buff_size;
- gchar *buff;
- GError *error = NULL;
-
- g_return_val_if_fail(key_file != NULL, FALSE);
- g_return_val_if_fail(file != NULL, FALSE);
- g_return_val_if_fail(max_size < PURPLE_KEY_FILE_HARD_LIMIT, FALSE);
-
- if (max_size == 0)
- max_size = PURPLE_KEY_FILE_DEFAULT_MAX_SIZE;
-
- fd = g_open(file, O_RDONLY, S_IREAD);
- if (fd == -1) {
- purple_debug_error("util", "Failed to read ini file %s", file);
- return FALSE;
- }
-
- if (_purple_fstat(fd, &st) != 0) {
- purple_debug_error("util", "Failed to fstat ini file %s", file);
- return FALSE;
- }
-
- file_size = (st.st_size > max_size) ? max_size : st.st_size;
-
- buff_size = file_size + header_len;
- buff = g_new(gchar, buff_size);
- memcpy(buff, header, header_len);
- if (read(fd, buff + header_len, file_size) != (gssize)file_size) {
- purple_debug_error("util",
- "Failed to read whole ini file %s", file);
- g_close(fd, NULL);
- free(buff);
- return FALSE;
- }
- g_close(fd, NULL);
-
- g_key_file_load_from_data(key_file, buff, buff_size,
- G_KEY_FILE_NONE, &error);
-
- free(buff);
-
- if (error) {
- purple_debug_error("util", "Failed parsing ini file %s: %s",
- file, error->message);
- return FALSE;
- }
-
- return TRUE;
-}
-#endif
--- a/libpurple/xmlnode.c Fri Dec 15 03:52:01 2017 +0000
+++ b/libpurple/xmlnode.c Tue Dec 26 05:28:40 2017 +0000
@@ -74,19 +74,6 @@
node = new_node(name, PURPLE_XMLNODE_TYPE_TAG);
purple_xmlnode_insert_child(parent, node);
-#if 0
- /* This would give PurpleXmlNodes more appropriate namespacing
- * when creating them. Otherwise, unless an explicit namespace
- * is set, purple_xmlnode_get_namespace() will return NULL, when
- * there may be a default namespace.
- *
- * I'm unconvinced that it's useful, and concerned it may break things.
- *
- * _insert_child would need the same thing, probably (assuming
- * xmlns->node == NULL)
- */
- purple_xmlnode_set_namespace(node, purple_xmlnode_get_default_namespace(node))
-#endif
return node;
}