--- a/libpurple/ntlm.c Sun Oct 30 12:03:44 2016 +0300
+++ b/libpurple/ntlm.c Tue Dec 20 14:21:28 2016 +0300
@@ -255,7 +255,7 @@
for (i = red; i < 16; i++) {
- buffer[i] = (char)(rand() & 0xff);
+ buffer[i] = (char)(g_random_int() & 0xff); --- a/libpurple/protocols.c Sun Oct 30 12:03:44 2016 +0300
+++ b/libpurple/protocols.c Tue Dec 20 14:21:28 2016 +0300
@@ -794,8 +794,6 @@
protocol = g_object_new(protocol_type, NULL);
- klass = PURPLE_PROTOCOL_GET_CLASS(protocol);
g_set_error(error, PURPLE_PROTOCOLS_DOMAIN, 0,
_("Could not create protocol instance"));
@@ -820,6 +818,8 @@
/* Make sure the protocol implements the required functions */
+ klass = PURPLE_PROTOCOL_GET_CLASS(protocol); if (!klass->login || !klass->close ||
!klass->status_types || !klass->list_icon )
--- a/libpurple/protocols/facebook/api.c Sun Oct 30 12:03:44 2016 +0300
+++ b/libpurple/protocols/facebook/api.c Tue Dec 20 14:21:28 2016 +0300
@@ -600,6 +600,12 @@
+ /* 509 is used for "invalid attachment id" */ + errc = FB_API_ERROR_NONFATAL; str = fb_json_values_next_str(values, NULL);
if (purple_strequal(str, "ERROR_QUEUE_NOT_FOUND") ||
@@ -1949,6 +1955,28 @@
+fb_api_user_icon_checksum(gchar *icon) + if (G_UNLIKELY(icon == NULL)) { + prms = fb_http_params_new_parse(icon, TRUE); + csum = fb_http_params_dup_str(prms, "oh", NULL); + fb_http_params_free(prms); + if (G_UNLIKELY(csum == NULL)) { + /* Revert to the icon URL as the unique checksum */ fb_api_cb_contact(PurpleHttpConnection *con, PurpleHttpResponse *res,
@@ -1956,7 +1984,6 @@
@@ -1978,7 +2005,7 @@
values = fb_json_values_new(node);
fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE, "$.id");
fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE, "$.name");
- fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE,
+ fb_json_values_add(values, FB_JSON_TYPE_STR, FALSE, "$.profile_pic_large.uri");
fb_json_values_update(values, &err);
@@ -1994,14 +2021,7 @@
user.name = fb_json_values_next_str_dup(values, NULL);
user.icon = fb_json_values_next_str_dup(values, NULL);
- prms = fb_http_params_new_parse(user.icon, TRUE);
- user.csum = fb_http_params_dup_str(prms, "oh", NULL);
- fb_http_params_free(prms);
- if (G_UNLIKELY(user.csum == NULL)) {
- /* Revert to the icon URL as the unique checksum */
- user.csum = g_strdup(user.icon);
+ user.csum = fb_api_user_icon_checksum(user.icon); g_signal_emit_by_name(api, "contact", &user);
fb_api_user_reset(&user, TRUE);
@@ -2032,7 +2052,6 @@
FbApiPrivate *priv = api->priv;
@@ -2045,13 +2064,13 @@
values = fb_json_values_new(root);
- fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE,
+ fb_json_values_add(values, FB_JSON_TYPE_STR, FALSE, "$.represented_profile.id");
- fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE,
+ fb_json_values_add(values, FB_JSON_TYPE_STR, FALSE, "$.represented_profile.friendship_status");
- fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE,
+ fb_json_values_add(values, FB_JSON_TYPE_STR, FALSE, "$.structured_name.text");
- fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE,
+ fb_json_values_add(values, FB_JSON_TYPE_STR, FALSE, fb_json_values_set_array(values, FALSE, "$.viewer.messenger_contacts"
@@ -2061,8 +2080,8 @@
uid = FB_ID_FROM_STR(str);
str = fb_json_values_next_str(values, NULL);
- if (!purple_strequal(str, "ARE_FRIENDS") &&
+ if ((!purple_strequal(str, "ARE_FRIENDS") && + (uid != priv->uid)) || (uid == 0)) @@ -2072,14 +2091,7 @@
user->name = fb_json_values_next_str_dup(values, NULL);
user->icon = fb_json_values_next_str_dup(values, NULL);
- prms = fb_http_params_new_parse(user->icon, TRUE);
- user->csum = fb_http_params_dup_str(prms, "oh", NULL);
- fb_http_params_free(prms);
- if (G_UNLIKELY(user->csum == NULL)) {
- /* Revert to the icon URL as the unique checksum */
- user->csum = g_strdup(user->icon);
+ user->csum = fb_api_user_icon_checksum(user->icon); users = g_slist_prepend(users, user);
@@ -2174,6 +2186,7 @@
mid = FB_API_MSGID(g_get_real_time() / 1000, g_random_int());
--- a/libpurple/protocols/facebook/api.h Sun Oct 30 12:03:44 2016 +0300
+++ b/libpurple/protocols/facebook/api.h Tue Dec 20 14:21:28 2016 +0300
@@ -350,6 +350,7 @@
* @FB_API_ERROR_GENERAL: General failure.
* @FB_API_ERROR_AUTH: Authentication failure.
* @FB_API_ERROR_QUEUE: Queue failure.
+ * @FB_API_ERROR_NONFATAL: Other non-fatal errors. * The error codes for the #FB_API_ERROR domain.
@@ -357,7 +358,8 @@
--- a/libpurple/protocols/facebook/facebook.c Sun Oct 30 12:03:44 2016 +0300
+++ b/libpurple/protocols/facebook/facebook.c Tue Dec 20 14:21:28 2016 +0300
@@ -353,7 +353,10 @@
errc = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
- purple_connection_error(gc, errc, error->message);
+ if (!g_error_matches(error, FB_API_ERROR, FB_API_ERROR_NONFATAL)) { + purple_connection_error(gc, errc, error->message); --- a/libpurple/protocols/facebook/http.c Sun Oct 30 12:03:44 2016 +0300
+++ b/libpurple/protocols/facebook/http.c Tue Dec 20 14:21:28 2016 +0300
@@ -396,6 +396,10 @@
+ if (strstr(url1, url2) != NULL || strstr(url2, url1) != NULL) { purl1 = purple_http_url_parse(url1);
--- a/libpurple/protocols/gg/oauth/oauth.c Sun Oct 30 12:03:44 2016 +0300
+++ b/libpurple/protocols/gg/oauth/oauth.c Tue Dec 20 14:21:28 2016 +0300
@@ -40,7 +40,7 @@
- *buf++ = charset[(unsigned) (((float) sizeof(charset) - 1.0) * rand() / (RAND_MAX + 1.0))];
+ *buf++ = charset[(unsigned) (((float) sizeof(charset) - 1.0) * g_random_int() / (RAND_MAX + 1.0))]; --- a/libpurple/protocols/jabber/jabber.c Sun Oct 30 12:03:44 2016 +0300
+++ b/libpurple/protocols/jabber/jabber.c Tue Dec 20 14:21:28 2016 +0300
@@ -1124,8 +1124,8 @@
/* replace old default proxies with the new default: NULL
* TODO: these can eventually be removed */
- if (g_str_equal("proxy.jabber.org", purple_account_get_string(account, "ft_proxies", ""))
- || g_str_equal("proxy.eu.jabber.org", purple_account_get_string(account, "ft_proxies", "")))
+ if (purple_strequal("proxy.jabber.org", purple_account_get_string(account, "ft_proxies", "")) + || purple_strequal("proxy.eu.jabber.org", purple_account_get_string(account, "ft_proxies", ""))) purple_account_set_string(account, "ft_proxies", NULL);
--- a/libpurple/protocols/oscar/family_chat.c Sun Oct 30 12:03:44 2016 +0300
+++ b/libpurple/protocols/oscar/family_chat.c Tue Dec 20 14:21:28 2016 +0300
@@ -174,8 +174,13 @@
* XXX mkcookie should generate the cookie and cache it in one
* operation to preserve uniqueness.
- for (i = 0; i < 8; i++)
- ckstr[i] = (guint8)rand();
+ for (i = 0; i < 8; i += 4) { + gint32 rnd = g_random_int(); + ckstr[i] = (guint8)((rnd & 0xFF000000) >> 24); + ckstr[i+1] = (guint8)((rnd & 0xFF0000) >> 16); + ckstr[i+2] = (guint8)((rnd & 0xFF00) >> 8); + ckstr[i+3] = (guint8)(rnd & 0xFF); cookie = aim_mkcookie(ckstr, AIM_COOKIETYPE_CHAT, NULL);
cookie->data = NULL; /* XXX store something useful here */
--- a/libpurple/protocols/oscar/family_icbm.c Sun Oct 30 12:03:44 2016 +0300
+++ b/libpurple/protocols/oscar/family_icbm.c Tue Dec 20 14:21:28 2016 +0300
@@ -100,7 +100,7 @@
/* Should be like "21CBF95" and null terminated */
- cookie[i] = 0x30 + ((guchar)rand() % 10);
+ cookie[i] = 0x30 + ((guchar)g_random_int() % 10); --- a/libpurple/protocols/simple/simple.c Sun Oct 30 12:03:44 2016 +0300
+++ b/libpurple/protocols/simple/simple.c Tue Dec 20 14:21:28 2016 +0300
@@ -44,21 +44,21 @@
static PurpleProtocol *my_protocol = NULL;
-static char *gentag(void) {
- return g_strdup_printf("%04d%04d", rand() & 0xFFFF, rand() & 0xFFFF);
+static gchar *gentag(void) { + return g_strdup_printf("%04d%04d", g_random_int(), g_random_int()); static char *genbranch(void) {
return g_strdup_printf("z9hG4bK%04X%04X%04X%04X%04X",
- rand() & 0xFFFF, rand() & 0xFFFF, rand() & 0xFFFF,
- rand() & 0xFFFF, rand() & 0xFFFF);
+ g_random_int(), g_random_int(), g_random_int(), + g_random_int(), g_random_int()); static char *gencallid(void) {
return g_strdup_printf("%04Xg%04Xa%04Xi%04Xm%04Xt%04Xb%04Xx%04Xx",
- rand() & 0xFFFF, rand() & 0xFFFF, rand() & 0xFFFF,
- rand() & 0xFFFF, rand() & 0xFFFF, rand() & 0xFFFF,
- rand() & 0xFFFF, rand() & 0xFFFF);
+ g_random_int(), g_random_int(), g_random_int(), + g_random_int(), g_random_int(), g_random_int(), + g_random_int(), g_random_int()); static const char *simple_list_icon(PurpleAccount *a, PurpleBuddy *b) {
@@ -858,7 +858,7 @@
/* resubscribe before subscription expires */
- buddy->resubscribe = time(NULL) + (expiration - 60) + (rand() % 50);
+ buddy->resubscribe = time(NULL) + (expiration - 60) + (g_random_int_range(0, 50)); buddy->resubscribe = time(NULL) + ((int) (expiration / 2));
@@ -1752,7 +1752,7 @@
conn = connection_create(sip, source);
- sip->registertimeout = purple_timeout_add((rand()%100)+10*1000, (GSourceFunc)subscribe_timeout, sip);
+ sip->registertimeout = purple_timeout_add(g_random_int_range(10000, 100000), (GSourceFunc)subscribe_timeout, sip); @@ -1795,7 +1795,7 @@
sip->listenpa = purple_input_add(sip->fd, PURPLE_INPUT_READ, simple_udp_process, sip->gc);
sip->resendtimeout = purple_timeout_add(2500, (GSourceFunc) resend_timeout, sip);
- sip->registertimeout = purple_timeout_add((rand()%100)+10*1000, (GSourceFunc)subscribe_timeout, sip);
+ sip->registertimeout = purple_timeout_add(g_random_int_range(10000, 100000), (GSourceFunc)subscribe_timeout, sip); --- a/libpurple/stun.c Sun Oct 30 12:03:44 2016 +0300
+++ b/libpurple/stun.c Tue Dec 20 14:21:28 2016 +0300
@@ -324,10 +324,10 @@
hdr_data.type = htons(MSGTYPE_BINDINGREQUEST);
- hdr_data.transid[0] = rand();
+ hdr_data.transid[0] = g_random_int(); hdr_data.transid[1] = ntohl(((int)'g' << 24) + ((int)'a' << 16) + ((int)'i' << 8) + (int)'m');
- hdr_data.transid[2] = rand();
- hdr_data.transid[3] = rand();
+ hdr_data.transid[2] = g_random_int(); + hdr_data.transid[3] = g_random_int(); if(sendto(sc->fd, &hdr_data, sizeof(struct stun_header), 0,
(struct sockaddr *)&(sc->addr),
--- a/pidgin/gtkconv.c Sun Oct 30 12:03:44 2016 +0300
+++ b/pidgin/gtkconv.c Tue Dec 20 14:21:28 2016 +0300
@@ -6069,12 +6069,11 @@
if (generated_nick_colors == NULL) {
- /* FIXME: No matter how I ask the GtkStyleContext, it always gives me
- * back black instead of the _actual_ background colour. */
color = gtk_widget_get_style(gtkconv->webview)->base[GTK_STATE_NORMAL];
rgba.red = color.red / 65535.0;
rgba.green = color.green / 65535.0;
rgba.blue = color.blue / 65535.0;
generated_nick_colors = generate_nick_colors(NICK_COLOR_GENERATE_COUNT, rgba);
@@ -11247,7 +11246,7 @@
while(i < numcolors && time(NULL) < breakout_time)
- GdkRGBA color = {rand() % 65536 / 65535.0, rand() % 65536 / 65535.0, rand() % 65536 / 65535.0, 1};
+ GdkRGBA color = {g_random_double_range(0, 1), g_random_double_range(0, 1), g_random_double_range(0, 1), 1}; if (color_is_visible(color, background, MIN_LUMINANCE_CONTRAST_RATIO) &&
color_is_visible(color, nick_highlight, MIN_LUMINANCE_CONTRAST_RATIO) &&
--- a/pidgin/gtkdialogs.c Sun Oct 30 12:03:44 2016 +0300
+++ b/pidgin/gtkdialogs.c Tue Dec 20 14:21:28 2016 +0300
@@ -180,7 +180,7 @@
{N_("Canadian English"), "en_CA", "Adam Weinberger", "adamw@gnome.org"},
{N_("Esperanto"), "eo", "Stéphane Fillod", "fillods@users.sourceforge.net"},
{N_("Spanish"), "es", "Javier Fernández-Sanguino Peña", "jfs@debian.org"},
- {N_("Argentine Spanish"), "es_AR", "KNTRO", "tskuhn@gmail.com"},
+ {N_("Argentine Spanish"), "es_AR", "KNTRO", "kntro@msn.com"}, {N_("Estonian"), "et", "Ivar Smolin", "okul@linux.ee"},
{N_("Basque"), "eu", "Mikel Pascual Aldabaldetreku", "mikel.paskual@gmail.com"},
{N_("Persian"), "fa", "Elnaz Sarbar", "elnaz@farsiweb.info"},