Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ZIRC - The 100% Zsh IRC client - a few updates
- X-seq: zsh-users 10476
- From: "Gergely Nagy" <gergely.nagy@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: ZIRC - The 100% Zsh IRC client - a few updates
- Date: Wed, 5 Jul 2006 11:25:07 +0200
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=rfFJuolj2/S1u3MpzDtA69+YZlqQn2F4y6EdvF5LiW/ghjlwfICjteL7k2i97FkqCArL3U2xsL/B/IETFQAjluO7fA/es5idH5hC342yOgdFuxEcQIXXMn6zADAu6x0/MoALY2oyk13+iFA3yRKGBk3LPcGtjAYM4Bu4tpsKG+g=
- In-reply-to: <20060630232142.GA29735@xxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <f5175f250606300510je968992ma5b548678dc57113@xxxxxxxxxxxxxx> <20060630232142.GA29735@xxxxxxxxxxxx>
*hangs head in shame* It has been my full-time IRC client as well since
I announced it on the list. Pathetic, I know, but it is pretty cool.
Anyway, if you don't mind (and I'm guessing you don't since you posted
your changes to a GPL program), I'll incorporate your changes into zIRC
and it is looking like I should probably put up some sort of repository
for the thing because I have been working on it quite a bit as well. :)
Hehe, of course I don't mind! :)
I'll get around to incorporating your changes whenever I can figure out
the diff since your editor totally destroyed all the whitespace
settings.
Ouch... sorry about that... I didn't notice my emacs screwed it up
that badly. I'll try to teach it not to, in the future.
I'm attaching a diff, which might not apply, but my changes can be
easily seen from it, and copy-pasted and fixing up the indentation.
=== modified file 'zirc'
--- zirc 2006-06-30 09:12:14 +0000
+++ zirc 2006-06-30 12:15:17 +0000
@@ -50,8 +50,7 @@
zirc_disconnect
fi
-ZIRC_VARS=( ZIRC_LAST ZIRC_CHANNELS ZIRC_CURRENT ZIRC_LOWERCASER ZIRC_FD ZIRC_S
-ERVER "${ZIRC_PARAMS[@]}" )
+ZIRC_VARS=( ZIRC_LAST ZIRC_CHANNELS ZIRC_CURRENT ZIRC_LOWERCASER ZIRC_FD ZIRC_SERVER "${ZIRC_PARAMS[@]}" )
ZIRC_UNSETSTRING="unset ${ZIRC_VARS[*]}"
eval "$ZIRC_UNSETSTRING"
@@ -919,6 +918,140 @@
! [[ -z "$ZIRC_FD" ]]
}
+# Sets channel modes
+function zirc_mode {
+ local modes="${(j: :)@}"
+
+ if [[ -z "$modes" ]]; then
+ echo "Usage: $0 <modes>"
+ echo "Set channel modes to <modes>."
+ echo "Sends to the current focus (Current: '$ZIRC_CURRENT')."
+ return 1
+ fi
+ zirc_connected || { echo "Not connected" ; return 1 }
+ _zirc_write "MODE ${ZIRC_CURRENT} ${modes}"
+}
+
+# Set a single mode for a list of users
+function _zirc_batch_mode {
+ local mode="$1"
+ shift
+ local users="${(j: :)@}"
+
+ for user in $users; do
+ zirc_mode "$mode" "$user"
+ done
+}
+
+# Give operator status to user(s)
+function zirc_op {
+ if [[ -z "$@" ]]; then
+ echo "Usage: $0 <users>"
+ echo "Give operator status to <users>."
+ echo "Works on the current focus (Current: '$ZIRC_CURRENT')."
+ return 1
+ fi
+
+ zirc_connected || { echo "Not connected" ; return 1}
+
+ _zirc_batch_mode "+o" $@
+}
+
+# Revoke operator status from user(s)
+function zirc_deop {
+ if [[ -z "$@" ]]; then
+ echo "Usage: $0 <users>"
+ echo "Revoke operator status from <users>."
+ echo "Works on the current focus (Current: '$ZIRC_CURRENT')."
+ return 1
+ fi
+
+ zirc_connected || { echo "Not connected" ; return 1}
+
+ _zirc_batch_mode "-o" $@
+}
+
+# Give a voice flag to user(s)
+function zirc_voice {
+ if [[ -z "$@" ]]; then
+ echo "Usage: $0 <users>"
+ echo "Give a voice flag to <users>."
+ echo "Works on the current focus (Current: '$ZIRC_CURRENT')."
+ return 1
+ fi
+
+ zirc_connected || { echo "Not connected" ; return 1}
+
+ _zirc_batch_mode "+v" $@
+}
+
+# Revoke the voice flag from user(s)
+function zirc_devoice {
+ if [[ -z "$@" ]]; then
+ echo "Usage: $0 <users>"
+ echo "Revoke the voice flag from <users>."
+ echo "Works on the current focus (Current: '$ZIRC_CURRENT')."
+ return 1
+ fi
+
+ zirc_connected || { echo "Not connected" ; return 1}
+
+ _zirc_batch_mode "-v" $@
+}
+
+# Query the names on a channel
+function zirc_names {
+ zirc_connected || { echo "Not connected" ; return 1}
+
+ _zirc_write "NAMES $ZIRC_CURRENT"
+}
+
+# Issue a WHOIS request
+function zirc_whois {
+ if [[ -z "$1" ]]; then
+ echo "Usage: $0 <user>"
+ echo "Get detailed information about <user>."
+ return 1
+ fi
+
+ zirc_connected || { echo "Not connected" ; return 1}
+
+ _zirc_write "WHOIS $1"
+}
+
+# Issue a WHO request
+function zirc_who {
+ local chan="${1:-${ZIRC_CURRENT}}"
+
+ zirc_connected || { echo "Not connected" ; return 1}
+
+ _zirc_write "WHO $chan"
+}
+
+# Kick user from the current channel
+function zirc_kick {
+ if [[ -z "$@" ]]; then
+ echo "Usage: $0 <user> [<reason>]"
+ echo "Kick <users> from the current channel, due to <reason>."
+ echo "Works on the current focus (Current: '$ZIRC_CURRENT')."
+ return 1
+ fi
+
+ zirc_connected || { echo "Not connected" ; return 1}
+
+ local user=$1
+ shift
+
+ _zirc_write "KICK $ZIRC_CURRENT $user ${@:+:$@}"
+}
+
+# Sets/unsets the automatic away message
+function zirc_away {
+ zirc_connected || { echo "Not connected" ; return 1}
+
+ _zirc_write "AWAY ${@:+:$@}"
+}
+
# Connect to a server
function zirc_connect {
if ! [[ -z "$ZIRC_FD" ]]; then
@@ -980,5 +1113,15 @@
alias query='zirc_query'
alias connect='zirc_connect'
alias help='zirc_help'
+ alias mode='zirc_mode'
+ alias op='zirc_op'
+ alias deop='zirc_deop'
+ alias voice='zirc_voice'
+ alias devoice='zirc_devoice'
+ alias names='zirc_names'
+ alias whois='zirc_whois'
+ alias who='zirc_who'
+ alias kick='zirc_kick'
+ alias away='zirc_away'
}
# }}}3
Messages sorted by:
Reverse Date,
Date,
Thread,
Author