Re: [dev] sic - remove stdout formatting?

From: <stanio_AT_cs.tu-berlin.de>
Date: Tue, 20 Oct 2009 11:28:46 +0200

Is there anybody using sic not for bots only? I mean, I use it with bitlbee
for all my IM stuff -- primary jabber & icq, but occasionally, sadly yahoo
+ msn,too.

Actually, I patched sic to

- do something on particular string pattern, which I specify as command
  line argument, e.g. like this:
  
        % sic [other options] -e "<(contact1|contact2.*)> *beep?$HOME/.sic/beep"
  
  which will execute ~/.sic/beep every time contact1 send me the message
  'beep'.
- to set the default contact to the one I wrote to, every time I send a
  message.

Furhter, I hacked together a zsh wrapper and start sic like this:

        LOG="$HOME/.sic/log.`date +%F`"
        ZDOTDIR=~/.sic zsh |\
        sic \
        -h localhost \
        -p 12345 \
        -n stanio \
        -e "<(contact1|contact2.*)> *beep?$HOME/.sic/beep" |\
        tee -a "$LOG"

where .sic/.zshrc contains some functions like

        basic_send() { echo "$@" $REDIRECT }
        sic_send() { basic_send ":""$@" }
        msg() {
                rec=$1
                shift
                sic_send m "$rec" "$@"
                PROMPT="%n_AT_sic|$rec> "
        }
        multisend() {
                msg="$1"
                shift
                for contact in $@; do msg "$contact" "$msg"; done
        }
        PROMPT='%n_AT_sic> '
        RPROMPT="|%D{%Y-%m-%d %a %H:%M'%S}"
        # [...] + other stuff

The idea was to have
- some functions for convenience
- a prompt which shows me which is the current default contact,
- basic completion for contacts and commands using the zsh framework.
  
But I never got the latter done because I never got the time to figure out
how completion works in zsh, which turned out not to be as simple as I
assumed... So, now it's slightly more overhead than benefit.

I'll be glad to read some 'best practice's for sic, if anybody is
willing to share here?

cheers

-- 
 stanio_
Received on Tue Oct 20 2009 - 09:28:46 UTC

This archive was generated by hypermail 2.2.0 : Tue Oct 20 2009 - 09:36:01 UTC