zsh-users
 help / color / mirror / code / Atom feed
From: "Gergely Nagy" <gergely.nagy@gmail.com>
To: zsh-users@sunsite.dk
Subject: Re: ZIRC - The 100% Zsh IRC client - a few updates
Date: Wed, 5 Jul 2006 11:25:07 +0200	[thread overview]
Message-ID: <f5175f250607050225j51317d8bj7b3665040dd0cbb3@mail.gmail.com> (raw)
In-Reply-To: <20060630232142.GA29735@goomba.ruder>

[-- Attachment #1: Type: text/plain, Size: 888 bytes --]

> *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.

[-- Attachment #2: zirc.diff --]
[-- Type: text/x-patch, Size: 3984 bytes --]

=== 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


      reply	other threads:[~2006-07-05  9:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-30 12:10 Gergely Nagy
2006-06-30 23:21 ` Andrew Ruder
2006-07-05  9:25   ` Gergely Nagy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f5175f250607050225j51317d8bj7b3665040dd0cbb3@mail.gmail.com \
    --to=gergely.nagy@gmail.com \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).