On Tue, 2010-08-31 at 15:35 -0500, John Goerzen wrote:
> On 08/31/2010 03:01 PM, Ernesto Hernández-Novich wrote:
> > I agree with you. However, shortening _every_ URL _every_ time seems to
> > be the common practice for Twitter clients, and that's the behaviour
> > implied by the man page.
[...]
> I would accept:
> 
>   * A patch to the manpage to make this clear
> 
>   * A patch that adds a setting for shorten all URLs, defaulting to 
> false, and documents it

Attached you'll find two patches against 1.0.6-1:

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'.

debian.patch - Improvements to the Debian packaging: install the
bash-completion in place; install the needed doc-base fragment for the
PDF manual (this gets rid of one lintian warning); use dh_install
instead of manually copying in debian/rules; use dh_auto_clean instead
of manually invoking make; use dh_prep instead of dh_clean. These
changes required bumping the versioned B-D for debhelper to 7.
-- 
Prof. Ernesto Hernández-Novich - MYS-220C - @iamemhn
Geek by nature, Linux by choice, Debian of course.
If you can't aptitude it, it isn't useful or doesn't exist.
GPG Key Fingerprint = 438C 49A2 A8C7 E7D7 1500 C507 96D6 A3D6 2F4C 85E3
diff -Naur twidge-1.0.6/Commands/Update.hs twidge-1.0.6+emhn/Commands/Update.hs
--- twidge-1.0.6/Commands/Update.hs	2010-06-03 08:09:19.000000000 -0430
+++ twidge-1.0.6+emhn/Commands/Update.hs	2010-11-06 22:39:57.482906834 -0430
@@ -103,9 +103,12 @@
 
 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) ++
diff -Naur twidge-1.0.6/Config.hs twidge-1.0.6+emhn/Config.hs
--- twidge-1.0.6/Config.hs	2010-09-01 11:30:08.000000000 -0430
+++ twidge-1.0.6+emhn/Config.hs	2010-11-06 22:02:15.102889901 -0430
@@ -47,6 +47,7 @@
                  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}
diff -Naur twidge-1.0.6/doc/twidge-manpage.sgml twidge-1.0.6+emhn/doc/twidge-manpage.sgml
--- twidge-1.0.6/doc/twidge-manpage.sgml	2010-10-25 20:33:26.000000000 -0430
+++ twidge-1.0.6+emhn/doc/twidge-manpage.sgml	2010-11-06 22:50:03.563888668 -0430
@@ -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 @@
               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 @@
     <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:
diff -Naur twidge-1.0.6/debian/control twidge-1.0.6+emhn//debian/control
--- twidge-1.0.6/debian/control	2010-06-02 16:14:51.000000000 -0430
+++ twidge-1.0.6+emhn//debian/control	2010-11-06 23:22:48.514906094 -0430
@@ -2,8 +2,8 @@
 Section: utils
 Priority: optional
 Maintainer: John Goerzen <jgoer...@complete.org>
-Build-Depends: debhelper (>= 5), groff, docbook-utils, jade, lynx, scons, poppler-utils, sgml2x, gtk-doc-tools, ghc6 (>= 6.8.2), haskell-devscripts (>= 0.6.6), libghc6-missingh-dev (>= 1.0.0), libghc6-network-dev, libghc6-unix-dev, libghc6-mtl-dev, libghc6-haxml-dev (>= 1.13.2-3), libghc6-filepath-dev, libghc6-configfile-dev (>= 1.0.4.5), libghc6-hslogger-dev (>= 1.0.7.1), libghc6-regex-posix-dev, libghc6-utf8-string-dev, libghc6-hsh-dev (>= 1.2.6.3), libghc6-hoauth-dev
-Standards-Version: 3.7.2
+Build-Depends: debhelper (>= 7), groff, docbook-utils, jade, lynx, scons, poppler-utils, sgml2x, gtk-doc-tools, ghc6 (>= 6.8.2), haskell-devscripts (>= 0.6.6), libghc6-missingh-dev (>= 1.0.0), libghc6-network-dev, libghc6-unix-dev, libghc6-mtl-dev, libghc6-haxml-dev (>= 1.13.2-3), libghc6-filepath-dev, libghc6-configfile-dev (>= 1.0.4.5), libghc6-hslogger-dev (>= 1.0.7.1), libghc6-regex-posix-dev, libghc6-utf8-string-dev, libghc6-hsh-dev (>= 1.2.6.3), libghc6-hoauth-dev
+Standards-Version: 3.9.1
 Homepage: http://software.complete.org/twidge
 Vcs-Browser: http://git.complete.org/twidge
 Vcs-Git: git://git.complete.org/twidge
diff -Naur twidge-1.0.6/debian/dirs twidge-1.0.6+emhn//debian/dirs
--- twidge-1.0.6/debian/dirs	2010-06-02 15:31:01.000000000 -0430
+++ twidge-1.0.6+emhn//debian/dirs	2010-11-06 23:04:06.343936998 -0430
@@ -1 +1,2 @@
 usr/bin
+etc/bash_completion.d
diff -Naur twidge-1.0.6/debian/doc-base twidge-1.0.6+emhn//debian/doc-base
--- twidge-1.0.6/debian/doc-base	1969-12-31 20:00:00.000000000 -0400
+++ twidge-1.0.6+emhn//debian/doc-base	2010-11-06 23:34:35.090906696 -0430
@@ -0,0 +1,9 @@
+Document: twidge-manual
+Title: Microblogging client for Twitter, Identica
+Author: John Goerzen
+Abstract: The user manual for Twidge in PDF format, as an alternative
+ to the usual manpage twidge(1).
+Section: Network/Communication
+
+Format: PDF
+Files: /usr/share/doc/twidge/twidge.pdf.gz
diff -Naur twidge-1.0.6/debian/install twidge-1.0.6+emhn//debian/install
--- twidge-1.0.6/debian/install	1969-12-31 20:00:00.000000000 -0400
+++ twidge-1.0.6+emhn//debian/install	2010-11-06 23:09:51.471901252 -0430
@@ -0,0 +1,2 @@
+twidge.bash_completion   etc/bash_completion.d/
+dist/build/twidge/twidge usr/bin/
diff -Naur twidge-1.0.6/debian/manpages twidge-1.0.6+emhn//debian/manpages
--- twidge-1.0.6/debian/manpages	1969-12-31 20:00:00.000000000 -0400
+++ twidge-1.0.6+emhn//debian/manpages	2010-11-06 23:15:50.590906058 -0430
@@ -0,0 +1 @@
+debian/tmp-doc/twidge.1
diff -Naur twidge-1.0.6/debian/rules twidge-1.0.6+emhn//debian/rules
--- twidge-1.0.6/debian/rules	2010-06-02 15:31:01.000000000 -0430
+++ twidge-1.0.6+emhn//debian/rules	2010-11-06 23:31:00.974901973 -0430
@@ -46,22 +46,17 @@
 	dh_testdir
 	dh_testroot
 	rm -f build-stamp configure-stamp
-
-	# Add here commands to clean up after the build process.
-	-$(MAKE) clean-code
+	dh_auto_clean -- clean-code
+	#	-$(MAKE) clean-code
 	-rm -rf debian/tmp-doc
-
 	dh_clean 
 
 install: build
 	dh_testdir
 	dh_testroot
-	dh_clean -k 
+	dh_prep
 	dh_installdirs
-
-	# Add here commands to install the package into debian/twidge.
-	#$(MAKE) install DESTDIR=$(CURDIR)/debian/twidge
-	cp dist/build/twidge/twidge debian/twidge/usr/bin/
+	dh_install
 
 # Build architecture-independent files here.
 binary-indep: build install
@@ -74,24 +69,11 @@
 	dh_installchangelogs 
 	dh_installdocs
 	dh_installexamples
-#	dh_install
-#	dh_installmenu
-#	dh_installdebconf	
-#	dh_installlogrotate
-#	dh_installemacsen
-#	dh_installpam
-#	dh_installmime
-#	dh_python
-#	dh_installinit
-#	dh_installcron
-#	dh_installinfo
-	dh_installman debian/tmp-doc/twidge.1
+	dh_installman
 	dh_link
 	dh_strip
 	dh_compress
 	dh_fixperms
-#	dh_perl
-#	dh_makeshlibs
 	dh_installdeb
 	dh_shlibdeps
 	dh_gencontrol

Reply via email to