XidusCore-v0.42/
; Works with XidusCore

;;; Localedit script
;
; Originally from Kipp, mods by Psyclone
;
; Server sends: #$# edit name: <name> upload: <cmd>
;
; Script takes input until a ".", loads an editor on it, then
;   sends <cmd> and the edited input with an extra "." for
;   good luck. <name> is ignored. wraplog should be off..

; set this to an absolute path.  /sys does not do tilde completion
/set loced_basedir /home/xidus/tf
/set loced_doc /home/xidus/tf/tf_edit.coldc

; set this to your favorite editor
/def pico=/sh emacs %1

; init..
/set shipping 0

; trigger to finish local editing
; this should really be defined _within_ the start macro but, ugh.

/def -mregexp -t"^\\.$" do_localedit = \
        /if /test %{shipping} %;\
           /then /set shipping 0 %;\
           /log -w off %;\
           /pico %loced_doc %;\
           /sys echo >> %{loced_doc} %;\
           /sys echo . >> %{loced_doc} %;\
           /send %{upload} %;\
           /quote -dsend -S !"tail +2 %{loced_doc}" %;\
        /endif

; if you want backups, move the document somewhere instead of deleting it

/def -mregexp -t"^#\\$# edit name: (.*) upload: (.*)$" localedit_trigger = \
        /set upload %P2%;\
        /set shipping 1%;\
        /sh rm %{loced_doc}%;\
        /log -w %loced_doc