Mercurial > pidgin
changeset 8334:0d1e5870d328
[gaim-migrate @ 9058]
you can now use :/ as a smiley safely thanks to Nathan Owens.
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 25 Feb 2004 21:26:58 +0000 |
parents | 85dbaac926a7 |
children | be7d78cf45f1 |
files | COPYRIGHT ChangeLog src/gtkimhtml.c |
diffstat | 3 files changed, 33 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/COPYRIGHT Wed Feb 25 20:04:36 2004 +0000 +++ b/COPYRIGHT Wed Feb 25 21:26:58 2004 +0000 @@ -82,6 +82,7 @@ Arkadiusz Miskiewicz Andrew Molloy Padraig O'Briain +Nathan (pianocomp81) Owens Matt Pandina Ricardo Fernandez Pascual Havoc Pennington
--- a/ChangeLog Wed Feb 25 20:04:36 2004 +0000 +++ b/ChangeLog Wed Feb 25 21:26:58 2004 +0000 @@ -26,6 +26,7 @@ (Send Message, Get User Info, and Insert Link dialogs) Bug Fixes: + * You can now use :/ as a smiley safely (Nathan Owens) * Various buffer overflow fixes (Stefan Esser) * Tabs now stay green when they are supposed to (Etan Reisner) * Fixed a bug where only the first user in a chat room list was removed
--- a/src/gtkimhtml.c Wed Feb 25 20:04:36 2004 +0000 +++ b/src/gtkimhtml.c Wed Feb 25 21:26:58 2004 +0000 @@ -1315,6 +1315,28 @@ return val; } +static const char *accepted_protocols[] = { + "http://", + "https://", + "ftp://" +}; + +static const int accepted_protocols_size = 3; + +/* returns if the beginning of the text is a protocol. If it is the protocol, returns the length so + the caller knows how long the protocol string is. */ +int gtk_imhtml_is_protocol(const char *text) +{ + gint i; + + for(i=0; i<accepted_protocols_size; i++){ + if( strncasecmp(text, accepted_protocols[i], strlen(accepted_protocols[i])) == 0 ){ + return strlen(accepted_protocols[i]); + } + } + return 0; +} + GString* gtk_imhtml_append_text_with_images (GtkIMHtml *imhtml, const gchar *text, GtkIMHtmlOptions options, @@ -1336,6 +1358,7 @@ gint type; const gchar *c; gchar *amp; + gint len_protocol; guint bold = 0, italics = 0, @@ -1871,6 +1894,14 @@ } c++; pos++; + } else if ((len_protocol = gtk_imhtml_is_protocol(c)) > 0){ + while(len_protocol--){ + /* Skip the next len_protocol characters, but make sure they're + copied into the ws array. + */ + ws [wpos++] = *c++; + pos++; + } } else if (imhtml->show_smileys && (gtk_imhtml_is_smiley (imhtml, fonts, c, &smilelen) || gtk_imhtml_is_smiley(imhtml, NULL, c, &smilelen))) { GtkIMHtmlFontDetail *fd;