Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make clear how URL shortening works

From Ernesto Hernández-Novich

shortenall.patch - Patches the manpage to make clear how URL shortening
works, along with patches to the code. Basically, shortenurls states
whether or not URLs should be shortened, with the same semantics it has
already (length > 140), whilst the new shortenall option shortens
everything everytime if set to yes. As you requested, shortenall
defaults to 'no'.
  • Loading branch information...
commit 87d2efff3e50387bad70bbf9dd53bd0f8bdca510 1 parent 160c70e
@jgoerzen authored
Showing with 53 additions and 10 deletions.
  1. +6 −3 Commands/Update.hs
  2. +1 −0  Config.hs
  3. +46 −7 doc/twidge-manpage.sgml
View
9 Commands/Update.hs
@@ -103,9 +103,12 @@ update_worker _ _ _ =
procStatus cp section status =
do poststatus <- case get cp section "shortenurls" of
- Right True | length status > 140
- -> shortenUrls cp status
- _ -> return status
+ Right True -> case get cp section "shortenall" of
+ Right True -> shortenUrls cp status
+ _ | length status > 140
+ -> shortenUrls cp status
+ _ -> return status
+ _ -> return status
when (length poststatus > 140)
(permFail $ "Your status update was " ++
show (length poststatus) ++
View
1  Config.hs
@@ -47,6 +47,7 @@ getDefaultCP =
cp <- set cp "DEFAULT" "oauthauthorize" "%(serverbase)s/oauth/authorize"
cp <- set cp "DEFAULT" "sendmail" "/usr/sbin/sendmail"
cp <- set cp "DEFAULT" "shortenurls" "yes"
+ cp <- set cp "DEFAULT" "shortenall" "no"
return cp
startingcp = emptyCP {accessfunc = interpolatingAccess 10}
View
53 doc/twidge-manpage.sgml
@@ -559,9 +559,20 @@
</para>
<para>
By default, Twidge will attempt to shorten URLs in your
- updates via the is.gd service. You can disable this by
- setting shortenurls = no in the [DEFAULT] or [dmsend] section of your
- configuration file.
+ updates via an URL shortening service, but only if your
+ update's length exceeds 140 characters. This means long
+ URLs shorter than 140 characters WILL NOT be shortened.
+ </para>
+ <para>
+ If you want all your URLs to be shortened all the time
+ regardless of their length, then set shortenall = yes
+ in the [DEFAULT] or [dmsend] section of your configuration
+ file.
+ </para>
+ <para>
+ You can disable URL shortening altogether by setting
+ shortenurls = no in the [DEFAULT] or [dmsend] section of
+ your configuration file.
</para>
</refsect2>
@@ -626,9 +637,20 @@
</para>
<para>
By default, Twidge will attempt to shorten URLs in your
- updates via the TinyURL.com service. You can disable this by
- setting shortenurls = no in the [DEFAULT] or [update] section of your
- configuration file.
+ updates via an URL shortening service, but only if your
+ update's length exceeds 140 characters. This means long
+ URLs shorter than 140 characters WILL NOT be shortened.
+ </para>
+ <para>
+ If you want all your URLs to be shortened all the time
+ regardless of their length, then set shortenall = yes
+ in the [DEFAULT] or [dmsend] section of your configuration
+ file.
+ </para>
+ <para>
+ You can disable URL shortening altogether by setting
+ shortenurls = no in the [DEFAULT] or [dmsend] section of
+ your configuration file.
</para>
<para>
When -r is given, &twidge; expects to read an RFC2822 email
@@ -855,7 +877,21 @@ lastid = 914881241
You may specify <literal>shortenurls</literal> in the
<literal>[update]</literal> section. It defaults to yes. If
set to no, will cause &twidge; to omit its attempt to shorten
- URLs in your updates via <literal>tinyurl.com</literal>.
+ URLs in your updates. If set to yes, will cause &twidge; to
+ shorten URLs in your updates, only if the latter's length
+ exceeds 140 characters. See <literal>shortenall</literal>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry><term>shortenall</term>
+ <listitem>
+ <para>
+ You may specify <literal>shortenall</literal> in the
+ <literal>[update]</literal> section. It defaults to no. If
+ set to yes, will cause &twidge; to shorten all URLs in
+ your updates, all the time. It only makes sense if
+ <literal>shortenurls</literal> is set to yes.
</para>
</listitem>
</varlistentry>
@@ -867,6 +903,9 @@ lastid = 914881241
<refsect2 id="twidge.config.shortening">
<title>URL Shortening Options</title>
<para>
+ &twidge; uses is.gd as its default URL shortening service.
+ </para>
+ <para>
To enable the bit.ly or j.ump URL shorteners, you must add a
<literal>[bitly]</literal> or <literal>[jmp]</literal> section
to the configuration file. This should contain two entries:
Please sign in to comment.
Something went wrong with that request. Please try again.