Mercurial > pidgin.yaz
diff src/gtkimhtml.c @ 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 | 6f549c1d0829 |
children | f1ca7e06e8de |
line wrap: on
line diff
--- 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;