Tips And Tricks
From Mcabber Wiki
Contents |
Multi-line messages
You can send multi-line messages with the /msay command (see the manpage for usage details).
You can bind /msay toggle and/or /msay toggle_verbatim so that you can switch quickly to/from multi-line mode:
# Alt-m to switch to/from multi-line mode bind M109 = msay toggle # Alt-M to switch to/from _verbatim_ multi-line mode bind M77 = msay toggle_verbatim
With mcabber 0.10 you can try the module extsay if you're using the screen utility (see the Modules page).
Jump to a contact
You can use /roster search to jump to a contact in your roster. You can even bind a key, for example if you talk very often with john.doe@jabber.foo, you can bind the F1 key:
bind 265 = roster search john.doe
Note: this command only looks for the contact in the displayed buddy, so if you hide offline buddies it won't find a disconnected contact.
You may want to create an alias for this command, if you use it a lot:
alias rsearch = roster search
With the completion, you only need to type '/rs<tab>' now.
One history for multiple buddies
(You'll need mcabber >=0.9.2 for that feature)
You're using jabber with several transports and you have some buddies who are using more than one chat protocol? mcabber is able to share one history file between all of them.
Let's say you have a contact abc@jabber.org and abc@icq.jabber.org. First of all, you have to merge both histories with merge_history.py, so that old data won't be lost.
$ cd ~/.mcabber/histo/ $ merge_history abc\@jabber.org abc\@icq.jabber.org > abc $ mv abc abc\@jabber.org $ rm abc\@icq.jabber.org
Now you have to create a symlink(abc@icq.jabber.org -> abc@jabber.org):
$ ln -sf abc\@jabber.org abc\@icq.jabber.org
After a restart, mcabber will load the history only once for both contacts. Both JIDs are sharing this history now. Commands relating to the chat buffer, such as /buffer scroll_lock/purge/clean on one buddy will change the buffer of the other buddy as well(because it's internally the same buffer).
Of course it is possible to link more than two buddies to one history... :)
Indication of transported buddies availability
Using FIFO feature and eventcmd script you can mark transported buddies with different color, when transport is not connected. In mcabberrc:
color roster clear color roster * * green color roster dn_? * brightblack color roster * *@icq.jabber.org red color roster dn_? *@icq.jabber.org red
This will mark transported buddies as unavailable initially. Then in eventcmd.sh, when processing STATUS event ( "$1" = 'STATUS' )
if [ "$3" = 'icq.jabber.org' ] ; then
if [ "$2" = '_' ] ; then
echo "color roster * *@icq.jabber.org red" > ~/.mcabber/fifo
echo "color roster dn_? *@icq.jabber.org red" > ~/.mcabber/fifo
else
echo "color roster * *@icq.jabber.org white" > ~/.mcabber/fifo
echo "color roster dn_? *@icq.jabber.org brightblack" > ~/.mcabber/fifo
fi
fi
This will change their color, when transport becomes available/unavailable.
Delayed actions (eg message for 'dnd' buddy)
You can delay some action until buddy becomes available or some other event happens. Add to eventcmd.sh:
if [ -f ~/.mcabber/jobs/"$1_$2_$3" ] ; then
cat ~/.mcabber/jobs/"$1_$2_$3" > ~/.mcabber/fifo
rm ~/.mcabber/jobs/"$1_$2_$3"
fi
and create jobs dir:
$ mkdir ~/.mcabber/jobs/
Then you can do something like this:
$ cat > ~/.mcabber/jobs/STATUS_O_buddy@jabber.org <<EOF > say_to -q buddy@jabber.org Hi, this is a jobbed message > say_to -q buddy@jabber.org Please, when you will have free time, do this and that. > EOF
That will not bother buddy while he is 'dnd', and you won't have to keep your message in mind.
Folding groups on start
With a hooks feature you can fold infrequently used groups (eg transports and other services) on startup. In mcabberrc:
set hook-post-connect = source ~/.mcabber/post-connect.rc set hook-pre-disconnect = source ~/.mcabber/pre-disconnect.rc
and in ~/.mcabber/post-connect.rc:
group fold Transports group fold Old
Auto-Away and Screen
So, we all want an auto-away but love to keep mcabber ticking away in a screen session. By putting the following into your '~/.logout' (or '~/.bash_logout' if you use BASH), you should get what you are looking for:
# mcabber auto-away - probably a Linux only solution as we use /proc
if [ -p .mcabber/mcabber.fifo ]; then
MCABBER_PID=$(pgrep -u $USER mcabber)
if [ -n $MCABBER_PID ]; then
MCABBER_STY=$(cat /proc/$MCABBER_PID/environ | tr '\0' '\n' | grep '^STY=' | cut -d'=' -f2)
if [ -n $MCABBER_STY ]; then
if [ -z "$(screen -list | grep $MCABBER_STY.*\(Attached\))" ]; then
echo /status notavail > .mcabber/mcabber.fifo
fi
fi
fi
fi