Skip to content

Commit 46c19cc

Browse files
DrDubjgoerzen
authored andcommitted
Added support for in_reply_to_status_id via the -i command line argument
1 parent 2f8b6a0 commit 46c19cc

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Commands/Update.hs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import Utils
2121
import System.Log.Logger
2222
import Types
2323
import System.Console.GetOpt
24+
import System.Console.GetOpt.Utils
2425
import Data.List
2526
import Download
2627
import Control.Monad(when)
@@ -34,7 +35,10 @@ i = infoM "update"
3435
update = simpleCmd "update" "Update your status"
3536
update_help
3637
[Option "r" ["recvmail"] (NoArg ("m", ""))
37-
"Receive update as body of email on stdin"]
38+
"Receive update as body of email on stdin",
39+
Option "i" ["inreplyto"] (ReqArg (stdRequired "i") "MSGID")
40+
"Indicate this message is in reply to MSGID"
41+
]
3842
update_worker
3943

4044
update_worker x cp ([("m", "")], []) =
@@ -59,9 +63,21 @@ update_worker x cp ([("m", "")], []) =
5963
([("source", "twidge"), ("status", poststatus)] ++
6064
irt)
6165
debugM "update" $ "Got doc: " ++ xmlstr
66+
6267
update_worker x cp ([], []) =
6368
do l <- getLine
6469
update_worker x cp ([], [l])
70+
71+
update_worker x cp ([("i", id )], []) =
72+
do l <- getLine
73+
update_worker x cp ([("i", id)], [l])
74+
75+
update_worker _ cp ([("i", id)], [status]) =
76+
do poststatus <- procStatus cp "update" status
77+
xmlstr <- sendAuthRequest cp "/statuses/update.xml" []
78+
[("source", "Twidge"), ("status", poststatus), ("in_reply_to_status_id", id)]
79+
debugM "update" $ "Got doc: " ++ xmlstr
80+
6581
update_worker _ cp ([], [status]) =
6682
do poststatus <- procStatus cp "update" status
6783
xmlstr <- sendAuthRequest cp "/statuses/update.xml" []

0 commit comments

Comments
 (0)