Mercurial > pidgin
changeset 19633:96d8119d3fcc
merge of 'e9d960379b02a0d960ef604990fee9f4439995d0'
and 'fd1fb64c32414d4cc4fda6c200f15db96f436316'
author | William Ehlhardt <williamehlhardt@gmail.com> |
---|---|
date | Tue, 04 Sep 2007 05:30:44 +0000 |
parents | 61473f8a5e2b (current diff) 578b3c67d52c (diff) |
children | 0b8740878f9e |
files | |
diffstat | 3 files changed, 102 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/plugins/ssl/ssl-nss.c Tue Sep 04 05:23:50 2007 +0000 +++ b/libpurple/plugins/ssl/ssl-nss.c Tue Sep 04 05:30:44 2007 +0000 @@ -522,6 +522,9 @@ /* Make a hash! */ sha1sum = g_byte_array_sized_new(hashlen); + /* glib leaves the size as 0 by default */ + sha1sum->len = hashlen; + st = PK11_HashBuf(SEC_OID_SHA1, sha1sum->data, derCert->data, derCert->len);
--- a/libpurple/protocols/myspace/myspace.c Tue Sep 04 05:23:50 2007 +0000 +++ b/libpurple/protocols/myspace/myspace.c Tue Sep 04 05:30:44 2007 +0000 @@ -1410,6 +1410,91 @@ return TRUE; } +#ifdef MSIM_CHECK_NEWER_VERSION +/** Callback for when a currentversion.txt has been downloaded. */ +static void +msim_check_newer_version_cb(PurpleUtilFetchUrlData *url_data, + gpointer user_data, + const gchar *url_text, + gsize len, + const gchar *error_message) +{ + GKeyFile *keyfile; + GError *error; + GString *data; + gchar *newest_filever; + + if (!url_text) { + purple_debug_info("msim_check_newer_version_cb", + "got error: %s\n", error_message); + return; + } + + purple_debug_info("msim_check_newer_version_cb", + "url_text=%s\n", url_text ? url_text : "(NULL)"); + + /* Prepend [group] so that GKeyFile can parse it (requires a group). */ + data = g_string_new(url_text); + purple_debug_info("msim", "data=%s\n", data->str + ? data->str : "(NULL)"); + data = g_string_prepend(data, "[group]\n"); + + purple_debug_info("msim", "data=%s\n", data->str + ? data->str : "(NULL)"); + + /* url_text is variable=data\n... */ + + /* Check FILEVER, 1.0.716.0. 716 is build, MSIM_CLIENT_VERSION */ + /* New (english) version can be downloaded from SETUPURL+SETUPFILE */ + + error = NULL; + keyfile = g_key_file_new(); + + /* Default list seperator is ;, but currentversion.txt doesn't have + * these, so set to an unused character to avoid parsing problems. */ + g_key_file_set_list_separator(keyfile, '\0'); + + g_key_file_load_from_data(keyfile, data->str, data->len, + G_KEY_FILE_NONE, &error); + g_string_free(data, TRUE); + + if (error != NULL) { + purple_debug_info("msim_check_newer_version_cb", + "couldn't parse, error: %d %d %s\n", + error->domain, error->code, error->message); + g_error_free(error); + return; + } + + gchar **ks; + guint n; + ks = g_key_file_get_keys(keyfile, "group", &n, NULL); + purple_debug_info("msim", "n=%d\n", n); + guint i; + for (i = 0; ks[i] != NULL; ++i) + { + purple_debug_info("msim", "%d=%s\n", i, ks[i]); + } + + newest_filever = g_key_file_get_string(keyfile, "group", + "FILEVER", &error); + + purple_debug_info("msim_check_newer_version_cb", + "newest filever: %s\n", newest_filever ? + newest_filever : "(NULL)"); + if (error != NULL) { + purple_debug_info("msim_check_newer_version_cb", + "error: %d %d %s\n", + error->domain, error->code, error->message); + g_error_free(error); + } + + g_key_file_free(keyfile); + + exit(0); +} +#endif + /** Called when the session key arrives. */ static gboolean msim_we_are_logged_on(MsimSession *session, MsimMessage *msg) @@ -3153,6 +3238,16 @@ PurpleAccountOption *option; static gboolean initialized = FALSE; +#ifdef MSIM_CHECK_NEWER_VERSION + /* PROBLEM: MySpace's servers always return Content-Location, and + * libpurple redirects to it, infinitely, even though it is the same + * location we requested! */ + purple_util_fetch_url("http://im.myspace.com/nsis/currentversion.txt", + FALSE, /* not full URL */ + "MSIMAutoUpdateAgent", /* user agent */ + TRUE, /* use HTTP/1.1 */ + msim_check_newer_version_cb, NULL); +#endif /* TODO: default to automatically try different ports. Make the user be * able to set the first port to try (like LastConnectedPort in Windows client). */
--- a/libpurple/protocols/myspace/myspace.h Tue Sep 04 05:23:50 2007 +0000 +++ b/libpurple/protocols/myspace/myspace.h Tue Sep 04 05:30:44 2007 +0000 @@ -91,6 +91,10 @@ /* Build version of MySpaceIM to report to servers (1.0.xxx.0) */ #define MSIM_CLIENT_VERSION 697 +/* Check for a newer official MySpaceIM client on startup? + * (Mostly useful for developers) */ +/*#define MSIM_CHECK_NEWER_VERSION*/ + /* Language codes from http://www.microsoft.com/globaldev/reference/oslocversion.mspx */ #define MSIM_LANGUAGE_ID_ENGLISH 1033 #define MSIM_LANGUAGE_NAME_ENGLISH "ENGLISH"