;;; liece-message.el --- generate and display message line;; Copyright (C) 1999 Daiki Ueno;; Author: Daiki Ueno <ueno@unixuser.org>;; Created: 1999-05-30;; Keywords: message;; This file is part of Liece.;; This program is free software; you can redistribute it and/or modify;; it under the terms of the GNU General Public License as published by;; the Free Software Foundation; either version 2, or (at your option);; any later version.;; This program is distributed in the hope that it will be useful,;; but WITHOUT ANY WARRANTY; without even the implied warranty of;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the;; GNU General Public License for more details.;; You should have received a copy of the GNU General Public License;; along with GNU Emacs; see the file COPYING. If not, write to the;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,;; Boston, MA 02111-1307, USA.;;; Commentary:;; ;;; Code:(eval-when-compile(require'liece-misc))(defgroupliece-messagenil"Messages":tag"Message":prefix"liece-":group'liece)(defcustomliece-message-brackets'(((typenotice)("-""-"))((and(typeaction)(directionoutgoing))("]""["))((typeaction)("[""]"))((and(rangeprivate)(directionincoming))("=""="))((directionoutgoing)(">""<"))((rangeexternal)("("")"))(t("<"">")))"Brackets.":group'liece-message)(defcustomliece-message-tags'(((and(directionoutgoing)(rangeprivate))(liece-message-targetliece-message-target))((rangeprivate)(liece-message-speakerliece-message-speaker))(t(liece-message-speaker(concatliece-message-target":"liece-message-speaker))))"Primary tags.":group'liece-message)(defcustomliece-message-empty-predicate(function(lambda(message)(string-equal""message)))"Return non-nil if message is regarded as empty string.":group'liece-message)(defvarliece-message-typenil)(defvarliece-message-targetnil)(defvarliece-message-speakernil)(defvarliece-message-directionnil)(defunliece-message-predicate(val)(cond((nullval)nil)((eqvalt)t)((listpval)(let((pred(popval)))(cond((eqpred'or)(apply'liece-or(mapcar'liece-message-predicateval)))((eqpred'and)(apply'liece-and(mapcar'liece-message-predicateval)))((eqpred'not)(not(liece-message-predicate(carval))))((eqpred'type)(eqliece-message-type(carval)))((eqpred'direction)(cond((eq(carval)'outgoing)liece-message-direction)((eq(carval)'incoming)(notliece-message-direction))))((eqpred'mode)(eqliece-command-buffer-mode(carval)))((eqpred'range)(cond((eq(carval)'private)(not(liece-channel-p(liece-channel-realliece-message-target))))((eq(carval)'external)(not(liece-channel-memberliece-message-target(liece-nick-get-joined-channelsliece-message-speaker))))))((liece-functionppred)(liece-eval-form(conspredval)))(t(liece-message-predicatepred)))))(t(liece-eval-formval))))(defunliece-message-brackets-function()(let*((specsliece-message-brackets)spec(brackets(catch'found(whilespecs(setqspec(popspecs))(if(liece-message-predicate(carspec))(throw'found(cadrspec)))))))brackets))(defunliece-message-tags-function()(let*((specsliece-message-tags)spec(tags(catch'found(whilespecs(setqspec(popspecs))(if(liece-message-predicate(carspec))(throw'found(cadrspec)))))))(list(eval(cartags))(eval(cadrtags)))))(defunliece-message-buffer-function()(let*((target(if(liece-message-predicate'(and(rangeprivate)(directionincoming)))liece-message-speakerliece-message-target))(buffer(liece-pick-buffertarget)))(cond((carbuffer)buffer)(liece-auto-join-partner(liece-channel-prepare-partnertarget)(liece-pick-buffertarget)))))(defunliece-message-parent-buffer(cbuffer)(if(or(and(carcbuffer)(liece-frozen(carcbuffer)))(and(eqliece-command-buffer-mode'channel)liece-current-channel(not(liece-channel-equalliece-message-targetliece-current-channel)))(and(eqliece-command-buffer-mode'chat)liece-current-chat-partner(not(eqliece-message-direction'outgoing))(or(not(liece-nick-equalliece-message-speakerliece-current-chat-partner))(not(liece-nick-equalliece-message-target(liece-current-nickname))))))(appendliece-D-bufferliece-O-buffer)liece-D-buffer));;;###liece-autoload(defunliece-display-message(temp)(let*((brackets(liece-message-brackets-function))(tags(liece-message-tags-function))(buffer(liece-message-buffer-function))(parent(liece-message-parent-bufferbuffer)))(liece-insertbuffer(concat(carbrackets)(cartags)(cadrbrackets)" "temp"\n"))(liece-insertparent(concat(carbrackets)(cadrtags)(cadrbrackets)" "temp"\n"))(run-hook-with-args'liece-display-message-hooktemp)))(provide'liece-message);;; liece-message.el ends here