Permalink
Browse files

Allow leading '@' in usernames

With this patch, it is possible to invoke twidge as 'twidge follow @user'
(instead of 'twidge follow user' ; same for unfollow, block and unblock).
  • Loading branch information...
1 parent 59d2e28 commit e57161a6deb3ed645d921f6fdc23d1506a46c6d1 @emillon emillon committed Feb 17, 2011
Showing with 7 additions and 3 deletions.
  1. +7 −3 Commands/FollowBlock.hs
@@ -47,12 +47,16 @@ unblock = simpleCmd "unblock" "Stop blocking someone"
unblock_worker = generic_worker POST "/blocks/destroy/" "unblock"
unblock_help = generic_rm_help "block"
-generic_worker method urlbase cmdname _ cp ([], [user]) =
- do xmlstr <- sendAuthRequest method cp (urlbase ++ user ++ ".xml") [] [("id", user)]
+generic_worker method urlbase cmdname _ cp ([], [user_string]) =
+ do let user = strip_at user_string
+ xmlstr <- sendAuthRequest method cp (urlbase ++ user ++ ".xml") [] [("id", user)]
debugM cmdname $ "Got doc: " ++ xmlstr
-- let doc = getContent . xmlParse "follow" . stripUnicodeBOM $ xmlstr
-- return ()
-
+
+ where strip_at ('@':u) = u
+ strip_at u = u
+
generic_worker _ _ cmdname _ _ _ =
permFail $ "follow: syntax error; see twidge " ++ cmdname ++ " --help"

0 comments on commit e57161a

Please sign in to comment.