pidgin: 4296be52: Sadrul and etan point out that using an ...
qulogic at pidgin.im
qulogic at pidgin.im
Fri Jul 3 02:05:50 EDT 2009
-----------------------------------------------------------------
Revision: 4296be52d5b80da450d41464433feee7c438d8f9
Ancestor: 6377d7ec730750111305379cc4a7faec3e2437ee
Author: qulogic at pidgin.im
Date: 2009-07-03T05:24:26
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/4296be52d5b80da450d41464433feee7c438d8f9
Modified files:
pidgin/gtkprefs.c
ChangeLog:
Sadrul and etan point out that using an existing function is better than
attempting to re-invent the wheel.
-------------- next part --------------
============================================================
--- pidgin/gtkprefs.c ccd79b83b36731f6f26a4f8a5d6de944293279c3
+++ pidgin/gtkprefs.c a7e8c419f447348484fd6245867530e5af31d9fc
@@ -1636,67 +1636,13 @@ conv_page(void)
return ret;
}
-/* This isn't a very strict check, but should give the user a clue. */
-static gboolean
-verify_ip_address(const gchar *text)
-{
- char *tmp;
- long octet;
-
- if (!text && !isdigit(*text))
- return FALSE;
-
- tmp = NULL;
- octet = strtol(text, &tmp, 10);
- if (octet < 0 || octet > 255)
- return FALSE;
-
- if (!tmp || *tmp != '.')
- return FALSE;
-
- text = tmp + 1;
- if (!isdigit(*text))
- return FALSE;
-
- tmp = NULL;
- octet = strtol(text, &tmp, 10);
- if (octet < 0 || octet > 255)
- return FALSE;
-
- if (!tmp || *tmp != '.')
- return FALSE;
-
- text = tmp + 1;
- if (!isdigit(*text))
- return FALSE;
-
- tmp = NULL;
- octet = strtol(text, &tmp, 10);
- if (octet < 0 || octet > 255)
- return FALSE;
-
- text = tmp + 1;
- if (!isdigit(*text))
- return FALSE;
-
- tmp = NULL;
- octet = strtol(text, &tmp, 10);
- if (octet < 0 || octet > 255)
- return FALSE;
-
- if (!tmp || *tmp != '\0')
- return FALSE;
-
- return TRUE;
-}
-
static void
network_ip_changed(GtkEntry *entry, gpointer data)
{
const gchar *text = gtk_entry_get_text(entry);
GdkColor color;
- if (verify_ip_address(text))
+ if (purple_ip_address_is_valid(text))
{
color.red = 0xAFFF;
color.green = 0xFFFF;
More information about the Commits
mailing list