things that happened in 2008

This commit is contained in:
psyc://psyced.org/~lynX 2009-01-26 21:12:53 +01:00
parent 8f98522570
commit 94530cc322
136 changed files with 3222 additions and 2873 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
CVS
.config
~$*
.DS_Store
.metadata

File diff suppressed because it is too large Load Diff

47
bin/psyconf Normal file → Executable file
View File

@ -6,7 +6,7 @@
# psyconf(8) - tool that generates psyc configuration
# files out of a common psyced.ini
#
# $Id: psyconf,v 1.75 2008/02/08 11:44:57 lynx Exp $
# $Id: psyconf,v 1.80 2008/10/26 15:24:01 lynx Exp $
=head1 NAME
@ -59,7 +59,7 @@ sub say {
use Getopt::Std;
&getopt;
print STDERR '$Id: psyconf,v 1.75 2008/02/08 11:44:57 lynx Exp $', "\n";
print STDERR '$Id: psyconf,v 1.80 2008/10/26 15:24:01 lynx Exp $', "\n";
my $conf = shift || 'psyced.ini';
$conf = '/etc/psyc/psyced.ini' unless -r $conf;
@ -127,31 +127,39 @@ sub say {
my $config = $c{_basic_path_configuration} || $base;
# this isn't taking $ARCH_DIR from install.sh into account
# but maybe it shouldn't anyway..
say "Looking for driver in $arch/$driver\n";
unless (-x $arch && -x "$arch/$driver") {
$arch = "$base/bin-$_type_system";
say "Looking for driver in $arch/$driver\n";
unless (-x $arch && -x "$arch/$driver") {
$arch = "$base/bin-linux";
say "Looking for driver in $arch/$driver\n";
if (-x $arch && -x "$arch/$driver") {
say "\nBug in $0: We didn't find $base/bin-linux in the appropriate way.\nThat's not nice. Continuing however.\n"
} elsif (not -x ($arch = "$base/bin") && -x "$arch/$driver") {
say "Looking for driver in $arch/$driver\n";
# bad place for psyclpc really..
# since it is usually of no commandline use
# but where else should psyclpc.ebuild
# install it? in /opt/psyclpc? for two files?
$arch = "/usr/sbin";
say "Looking for driver in $arch/$driver\n";
# the following is very unlikely to happen:
die <<X unless -x $arch && -x "$arch/$driver";
could not find any directory containing $driver.
Could not find any directory containing $driver.
X
}
}
}
say "Found driver in $arch/$driver\n";
my $user = $c{_basic_system_user} || 'daemon';
my ($login,$pass,$uid,$gid) = getpwnam($user)
or die "uid '$user' not defined on this system";
# this doesn't mean psyconf is intended to run as $user too!!
say "psyced will later be running as user $user ($uid:$gid)\n";
say "psyced must later be running as user $user ($uid:$gid)\n";
# will automatically, when started via etc/init.d but if you
# start it manually, you have to switch to that user yourself
my $ho = $c{_basic_host_name} || $ENV{HOST} || 'psyc';
my $chatname = $c{_basic_nick_server} ||
@ -259,6 +267,7 @@ X
// CAUTION! This file has been generated using $0.
// Don't edit unless you are no longer going to use the configuration tool.
// Edit $conf instead, then run $0 again.
// If you want to tune psyced, edit local.h instead!
X
if ( $c{_optional_config_HTTP} ) {
@ -365,25 +374,33 @@ X
#WARNING: Because of some funny bug the driver will probably not bind properly
#to _basic_host_IP as it also needs _basic_host_name and _basic_host_domain
#to be provided. Hopefully this shortcoming will soon be history.
#In the meantime please re-edit the psyconf.ini to provide all variables.
#In the meantime please re-edit the psyced.ini to provide all variables.
print STDERR <<X if $hc == 1;
WARNING: _basic_host_IP, _basic_host_name and _basic_host_domain need to be
provided together as the driver won't figure out the proper name for the IP
number or vice versa. Please re-edit the psyconf.ini to provide all variables.
number or vice versa. Please re-edit the psyced.ini to provide all variables.
X
if ($c{_protocols_use_encryption}) {
$psyced .= " --tls-key $config/$c{_basic_path_PEM_key}"
if $c{_basic_path_PEM_key};
$psyced .= " --tls-cert $config/$c{_basic_path_PEM_certificate}"
if $c{_basic_path_PEM_certificate};
$psyced .= " --tls-trustdirectory $config/$c{_basic_path_trust}"
if $c{_basic_path_trust};
my $t = $c{_basic_path_PEM_key};
if ($t) {
$t = "$config/$t" unless $t =~ m#^/#;
$psyced .= " --tls-key $t";
}
if ($t = $c{_basic_path_PEM_certificate}) {
$t = "$config/$t" unless $t =~ m#^/#;
$psyced .= " --tls-cert $t";
}
if ($t = $c{_basic_path_trust}) {
$t = "$config/$t" unless $t =~ m#^/#;
$psyced .= " --tls-trustdirectory $t";
}
# ldmud doesn't support this yet
# $psyced .= " --tlscrldirectory $config/$c{_basic_path_revocation}"
# if $c{_basic_path_revocation};
}
$psyced .= ' '. $c{_optional_extra_debug} if $c{_optional_extra_debug};
# you can divert UDP if you know what you are doing.
my $portUDP = $c{_protocols_port_UDP} || $c{_protocols_port_PSYC};
@ -545,6 +562,12 @@ X
chmod 0744, $t;
chown $uid, $gid, $t if $uid;
# TODO: generate a psyced.gdb file kind of like this
print <<X if 0;
file /bin/psyclpc
run -DDEBUG=1 -u 4404 4404 2323 6667 5222 9999 etc. whatever flags necessary
X
# PSYCED INIT.D SCRIPT
$t = "$base/etc";
mkdir($t);

View File

@ -1,8 +1,11 @@
# you can also create a ~/.cvsrc where you keep your favorite
# cvs flags. we recommend to put 'cvs -z9' in there
#alias cup cvs -q update -d # was, until de/irc was deleted
alias difvu 'vim -R "+set syntax=diff"'
alias cup cvs -q update -dP
alias sup svn update
alias gup '(git fetch origin && git diff master..origin/master && git merge origin) |& difvu -'
alias ci cvs ci
alias ci+ cvs ci -m +
@ -17,13 +20,21 @@ alias cvsaddr 'cvs add `find . -name "*CVS*" -prune -o -print`'
# how to add a binary file.. cause i never remember!!
alias cvsaddbin 'cvs add -kb'
alias canno 'cvs annotate \!*|vim -R -'
alias cdif 'cvs diff -bur HEAD \!* |& egrep -v " (Diffing |no longer exists)"|vim -R "+set syntax=diff" -'
alias cblame 'cvs annotate \!*|& $PAGER'
alias cdiff 'cvs diff -bpu8r'
alias gdiff 'git-diff -b'
alias cdifr 'cdiff \!* |& egrep -v " (Diffing |no longer exists)"|& difvu -'
alias sdifr 'svn diff -r \!* |& difvu -'
alias gdifr 'gdiff \!* |& difvu -'
alias cdif 'cdifr HEAD'
alias sdif 'sdifr HEAD'
alias gdif 'gdifr HEAD'
alias Ci '(cd $PSYCEDHOME;ci)'
alias Cup '(cd $PSYCEDHOME;cup)'
alias Cdif '(cd $PSYCEDHOME;cdif)'
alias ctoc '(cd $CVSHOME;cvs diff -bur HEAD CHANGESTODO|vim -R "+set syntax=diff" -)'
alias ctodo '(cd $PSYCEDHOME;cvs update CHANGESTODO;x CHANGESTODO;cvs ci -m + CHANGESTODO)'
alias ctoc '(cd $CVSHOME;cvs diff -bur HEAD CHANGESTODO|& difvu -'
alias ctodo '(cd $PSYCEDHOME;cvs update CHANGESTODO;$EDITOR CHANGESTODO;cvs ci -m + CHANGESTODO)'

View File

@ -1,35 +0,0 @@
banner.txt is the file that is shown to
telnet users at login
config.c is currently not being used, really.
config.h is of no interest.
hosts.h lets you specify ip ranges that are
particularely trustworthy or untrustworthy.
init.ls contains the list of classes that
will be compiled at boot-time. it is mostly
useful for debugging, as in a healthy
system any required class can be compiled
at the moment it is used for the first time.
so for production use this is kept to the
bare minimum. only the parts of psyced you
are actually using will be loaded.
local.h hosts your personal tunings to the
psyced system.
path.h lets you rearrange the directories
where the code for the protocol implementations
reside. you don't need to do that normally.
ports.h is generated by the installation
procedure and contains the port numbers you
chose for the services you want to use.
psyconf.h is also generated that way by the
psyconf utility. it contains the settings
from psyced.ini in a form pleasant for LPC.

View File

@ -1,8 +0,0 @@
[connected]
PROTOCOL for SYNCHRONOUS CONFERENCING http://www.psyced.org/
--------------- ___ __ _ _ __ ___ __ ------------------
| \ (__ \ / / | | \
|__/ \ V | |- | )
>>> | (__/ | \__ |__ |_/ <<<

View File

@ -1,66 +0,0 @@
// $Id: config.c,v 1.9 2006/11/07 07:58:36 lynx Exp $ vim:syntax=lpc
#include <net.h>
/* a data file or an include can be read by any file in the system but
* we want this information to be readable by the gateway code only
* that's why it has to be lpc code
*/
#ifdef GATEWAY_PATH
/* if you are positive that you want to run your own gateways to
* legacy messaging systems, please insert your gateway credentials
* into the fields below and activate the code by turning #if 0 to #if 1
*
* update: these bot-style gateways are not functional. don't switch
* them to 1 as either the python scripts or the jabber code isn't
* up to date with them.
*/
# define USE_ICQ_GATEWAY 0 // don't change
# define USE_AIM_GATEWAY 0 // don't change
qConfig() {
string p = file_name(previous_object());
# ifdef __COMPAT_MODE__
p = "/"+p;
# endif
P3(("\n%O: config requested by %s\n", ME, p))
# if USE_ICQ_GATEWAY
if (abbrev(GATEWAY_PATH "icq", p)) return
(["host" : "icq.localhost",
"port" : 5234,
"scheme" : "icq",
"name" : "icqlinker",
"secret" : "myicqsecret",
"nickname" : "your uin here",
"password" : "and your password please" ]);
# endif
# if USE_AIM_GATEWAY
if (abbrev(GATEWAY_PATH "aim2", p)) return
(["host" : "aim.localhost",
"port" : 5233,
"scheme" : "aim",
"name" : "aimlinker",
"secret" : "myaimsecret",
"nickname" : "screen name",
"password" : "and your password please" ]);
# endif
}
load() {
# if USE_ICQ_GATEWAY
D(" " GATEWAY_PATH "icq");
load_object(GATEWAY_PATH "icq");
# endif
# if USE_AIM_GATEWAY
D(" " GATEWAY_PATH "aim2");
load_object(GATEWAY_PATH "aim2");
# endif
# ifdef RELAY_OBJECT
D(" " RELAY_OBJECT "\n");
call_out(load_object, 0, RELAY_OBJECT);
# endif
}
#endif

View File

@ -1,23 +0,0 @@
// $Id: config.h,v 1.1 2007/04/26 13:34:02 lynx Exp $ // vim:syntax=lpc
//
// This file is not intended to be modified. Make your local changes
// in psyced.ini, and if that wasn't good enough, use local.h.
// If you are integrating psyced with other LPC applications, feel
// free to modify path.h. If you aren't, better leave it as it is.
#ifndef CONFIG_H
# define CONFIG_H
// load local modifications by the admin
# include "local.h"
// load port configuration as generated by psyconf
# include "ports.h"
// load layout of psyced software modules
# include "path.h"
// load psyced.ini settings converted by psyconf
# include "psyconf.h"
#endif

View File

@ -1,7 +0,0 @@
// Examples of specially enabled or disabled hosts.
//
//
// #define ENABLED_HOSTS "192.168.0.", "10."
//
// #define DISABLED_HOSTS "207.46.197.", "207.46.19."
//

View File

@ -1,3 +0,0 @@
net/user
net/place/basic
local/config

View File

@ -1,5 +0,0 @@
// This is local.h for advanced tunings to the psyced runtime and
// LPC compilation process. The format looks just like a regular
// header file for the C language. Settings you can specify
// here are documented at http://about.psyc.eu/psyced#Tuning

View File

@ -1,50 +0,0 @@
#ifndef _INCLUDE_PATH_H
#define _INCLUDE_PATH_H
#define NET_PATH "/net/"
#define PLACE_PATH "/place/"
#define SERVICE_PATH "/service/"
#define DATA_PATH "/data/"
#define CONFIG_PATH "/local/"
#define DAEMON_PATH NET_PATH "d/"
#define GATEWAY_PATH NET_PATH "gateway/"
// protocol for synchronous conferencing
#define PSYC_PATH "/net/psyc/"
// experimental PSYC 1.0 interface
#define SPYC_PATH "/net/spyc/"
// irc server emulation
#define IRC_PATH "/net/irc/"
// jabber server emulation
#define JABBER_PATH "/net/jabber/"
// telnet access
#define TELNET_PATH "/net/tn/"
// java applet server, uses a very simple protocol
#define APPLET_PATH "/net/applet/"
// accept messages and simple mails via smtp
#define SMTP_PATH "/net/smtp/"
// experimental: access message log via pop3
#define POP3_PATH "/net/pop/"
// experimental: serve as a sip "proxy"
#define SIP_PATH "/net/sip/"
// allow access to subscribed threaded discussion groups via nntp
#define NNTP_PATH "/net/nntp/"
// accept messages and allow lastlog access via wap
#define WAP_PATH "/net/wap/"
// simple http server
#ifndef HTTP_PATH
# define HTTP_PATH "/net/http/"
#endif
#endif

View File

@ -1,33 +0,0 @@
/* this file shall automatically be generated by psyconf.
*
* the values in here may be the same as in services.h
* or they may not. so always be conscious which ones you
* are using to which purpose. -lynX
*/
#echo This is just the demo ports.h. I shouldn't get loaded.
#echo If I do, then you didn't run psyconf successfully!!
#define PSYC_PORT 4404
#define HTTP_PORT 33333
#define HTTPS_PORT 34443
#define IRC_PORT 6667
#define IRCS_PORT 9999
#define JABBER_PORT 5222
#define JABBERS_PORT 5223
#define JABBER_S2S_PORT 5269
#define TELNET_PORT 2323
#define TELNETS_PORT
#define APPLET_PORT 2008
#define SMTP_PORT
#define SMTPS_PORT
#define NTTP_PORT
#define NNTPS_PORT

View File

@ -1,4 +1,4 @@
# $Header: /CVS/muveCVS/psycmuve/config/gentoo/psyced.ebuild,v 1.31 2007/09/24 22:16:19 lynx Exp $
# $Header: /CVS/muveCVS/psycmuve/config/gentoo/psyced.ebuild,v 1.32 2008/09/22 21:51:39 lynx Exp $
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
@ -76,8 +76,8 @@ src_install() {
keepdir /var/${PN}/data/person
keepdir /var/${PN}/data/place
dodir /var/${PN}/config
chmod -x config/default/*.*
cp -rp config/default/README config/default/*.* "${D}var/${PN}/config"
chmod -x config/blueprint/*.*
cp -rp config/blueprint/README config/blueprint/*.* "${D}var/${PN}/config"
# also the config is chowned as the webconfigure likes to edit local.h
chown -R ${PN}:psyc "${D}var/${PN}"
einfo "Person, place and configuration data is kept in /var/${PN}"

View File

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.16 2008/01/27 12:27:15 lynx Exp $
# $Id: Makefile,v 1.20 2008/11/20 13:45:58 lynx Exp $
#
# This Makefile serves the purpose to produce the files ebuild needs to be
# happy. So it is an ebuildbuilder. Targets are: ebuild, Manifest and clean.
@ -9,7 +9,7 @@
# emerge. From nothing. fischerspooner rocks. -lynX
P=psyced
V=20080116
V=20081120
# this part can be executed once the ebuild is in portage

View File

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.5 2008/01/27 12:27:15 lynx Exp $
# $Id: Makefile,v 1.7 2008/07/07 18:35:59 lynx Exp $
#
# This Makefile serves the purpose to produce the files ebuild needs to be
# happy. So it is an ebuildbuilder. Targets are: ebuild, Manifest and clean.
@ -9,7 +9,7 @@
# emerge. From nothing. fischerspooner rocks. -lynX
P=psyclpc
V=20080116
V=20080707
# this part can be executed once the ebuild is in portage

View File

@ -1,4 +1,4 @@
; $Id: psyced.ini,v 1.22 2008/01/22 09:30:06 lynx Exp $
; $Id: psyced.ini,v 1.23 2008/04/28 16:35:29 lynx Exp $
;
; this is the sample psyced configuration file. in fact it is the one
; being used for the gentoo default installation. you can use this if
@ -119,8 +119,15 @@ _console_debug = 0
;_charset_console = ISO-8859-15
; '0' is tranquility unless something serious happens. best choice.
; '1' gives you slightly interesting output and LPC development debug.
; '2' or '3' is too much and too detailed. we hardly ever use that ourselves.
; '2' or '3' is too much and too detailed. we only use this as shown below.
_level_debug = 0
; Advanced extra debug flags for the psyclpc command line. You can debug
; specific parts of psyced like for example the textdb subsystem by adding
; -DDtext=2 here. You can figure out which other parts of psyced are debuggable
; by doing a "grep -r 'define DEBUG D' ." in the world directory, then assign
; a debug level in the same way as the global debug level above.
;_extra_debug =
; We create files that are editable by the psyc group
_umask = 007

View File

@ -3,7 +3,7 @@
# but if that's not true, try a bash or ksh here.
#
# psyced installation script
# $Id: install.sh,v 1.159 2008/03/23 19:27:13 lynx Exp $
# $Id: install.sh,v 1.165 2008/10/16 13:07:13 lynx Exp $
#
# original version by oswald!osw@ld.pages.de on IRCnet, 22aug00
# heavy improvements by heldensaga and psyc://psyced.org/~lynX
@ -29,20 +29,25 @@ rm="rm"
#exit="echo [debug] Not exiting."
#rm="echo [debug] Not removing"
DATA_PERM="700"
BASE_PERM="700"
CONF_PERM="700"
UMASK="7"
hi=""
lo=""
# take a guess wether we are on a gentoo? like -x /etc/portage?
#echo ""
#echo "${hi}!!INFO FOR GENTOO USERS!!${lo}"
cat <<EOT
If you are running gentoo, you should try out our brand new ebuilds
if test -d "/etc/portage"
then
cat <<EOT
${hi}!!INFO FOR GENTOO USERS!!${lo}
If you are running gentoo/portage, you should try out our beautiful ebuilds
at http://www.psyced.org/files/gentoo.tar.bz2 --- They are also in the
data.tar. Unpack it, then go into the config/gentoo directory and run make.
EOT
sleep 1
sleep 2
fi
if test -e .config
then
@ -85,12 +90,26 @@ fi
echo ""
yacc=`which yacc`
if test "$yacc" = ""
bison=`which bison`
if test "$yacc" = "" -a "$bison" = ""
then
# tjgillies says: on fedora bison doen't symlink to yacc
echo "Please install 'yacc' or 'bison' on this system."
$exit
fi
echo "Using $yacc during the compilation process."
#echo "Using '$bison' or '$yacc' during the compilation process."
if test -f "/usr/include/openssl/ssl.h"
then
tls="y"
else
tls="n"
echo ""
echo "${hi}Warning: ${lo}You are apparently missing the OpenSSL header files!"
echo "If you're on debian/ubuntu you may have to 'apt-get install libssl-dev' now"
echo "or your psyclpc will compile without support for encryption."
sleep 2
fi
ask() {
echo ""
@ -213,6 +232,7 @@ else
BASE_DIR="/usr/local/psyced"
fi
CONFIG_DIR="/etc/psyc"
CONF_PERM="750"
fi
get BASE_DIR
@ -227,6 +247,11 @@ then
$exit
fi
# one day we should seperate variable files from static files better
LOG_DIR="$BASE_DIR/log"
DATA_DIR="$BASE_DIR/data"
LIB_DIR="$BASE_DIR/world"
echo ""
echo "psyconf will automatically search /etc/psyc for psyced.ini."
echo "If you plan to put this file anywhere else, you will have to"
@ -235,15 +260,6 @@ echo "pass it as the argument to psyconf."
get CONFIG_DIR
ask "PSYCED configuration directory" CONFIG_DIR
echo "[config directory is set to $CONFIG_DIR]"
# one day we should seperate variable files from static files better
LOG_DIR="$BASE_DIR/log"
DATA_DIR="$BASE_DIR/data"
LIB_DIR="$BASE_DIR/world"
DATA_PERM="700"
PERMISSIONS="700"
UMASK="7"
echo ""
# setting up ARCH_DIR directly because there is no need to bother the
# user with such a detail. if you think we should, then fix all the
@ -580,11 +596,13 @@ echo ""
echo "${hi}PSYCED ENCRYPTED PROTOCOL SERVICES${lo}"
echo ""
echo "With either openssl or gnutls installed, your driver may provide TLS/SSL."
#echo "With either openssl or gnutls installed, your driver may provide TLS/SSL."
echo "With openssl libs installed, your driver should provide TLS/SSL."
echo "If you don't have it installed, you must say 'n' here."
echo "Would you like to configure any ports for TLS-enhanced protocols?"
get TLS_YN "y"
ask "Do you love TLS cryptography" TLS_YN
get TLS_YN $tls
ask "Let's use some TLS cryptography" TLS_YN
# das ganze tls-geviech macht nur sinn, wenn man cert und privkey hat
# ergo die pfade fuer die abfragen und dann entscheiden, ob...
@ -835,6 +853,9 @@ fi
# nen snapshot. dank pkggen kein großes problem.
get WANT_CVSUP "n"
# would be soooo smart if we'd ask for update before we even enter
# the install.sh interview because frequently there is a better
# install.sh in the repo worth running instead. TODO
echo ""
echo ""
echo "The version you are about to install is considered stable,"
@ -1012,15 +1033,22 @@ _config_HTTP = ${HTTPCONFIG_10}
; For development, _console_debug is extremely useful,
; for regular service it is better to have output in files.
_console_debug = $CONSOLE_10
; '1' gives you interesting output. '2' or '3' is debug. '0' is tranquility.
; '0' is tranquility unless something serious happens. best choice.
; '1' gives you slightly interesting output and LPC development debug.
; '2' or '3' is too much and too detailed. we only use this as _extra_debug.
_level_debug = $DEBUG
; Have errors logged to an extra psyced.debug file
_use_file_debug = $FILE_10
; Advanced extra debug flags for the psyclpc command line. You can debug
; specific parts of psyced like for example the textdb subsystem by adding
; -DDtext=2 here. You can figure out which other parts of psyced are debuggable
; by doing a "grep -r 'define DEBUG D' ." in the world directory.
;_extra_debug =
; We create files that are editable by the psyc group
_umask = $UMASK
EOT
#; Have errors logged to an extra psyced.debug file
#_use_file_debug = $FILE_10
# this here is no longer an option.. as PSYC uses UTF-8 on the wire.
#
@ -1044,7 +1072,7 @@ fi
if test ! -d $BASE_DIR
then
echo "Creating $BASE_DIR..."
if mkdir -m $PERMISSIONS -p $BASE_DIR 2> /dev/null
if mkdir -m $BASE_PERM -p $BASE_DIR 2> /dev/null
then
:
else
@ -1062,7 +1090,7 @@ fi
if test ! -d $CONFIG_DIR
then
echo "Creating $CONFIG_DIR..."
if mkdir -m $PERMISSIONS -p $CONFIG_DIR 2> /dev/null
if mkdir -m $CONF_PERM -p $CONFIG_DIR 2> /dev/null
then
:
else
@ -1184,7 +1212,7 @@ EOF
cp $i $ARCH_DIR/$i
chown $USER $ARCH_DIR/$i
chgrp $GROUP $ARCH_DIR/$i
chmod $PERMISSIONS $ARCH_DIR/$i
chmod $BASE_PERM $ARCH_DIR/$i
chmod u+x $ARCH_DIR/$i
done
cd ..
@ -1216,28 +1244,14 @@ cd "$BASE_DIR"
cp -rp "$BASE_DIR/local" "/tmp/local$$" 2> /dev/null
rm -f $BASE_DIR/local 2> /dev/null
# used to be a symlink, but cvs update could replace your local.h with
# the stupid example from the cvs, so let's better copy it.
# we previously tried to use symlinks or even partial symlinks for
# unmodified files only, but it can result in cvs collisions and
# headaches. so far the plain copy approach is best.
#
cp -rp "$BASE_DIR/config/default" "$BASE_DIR/local"
cp -rp "$BASE_DIR/config/blueprint" "$BASE_DIR/local"
#
# let's make sure it won't happen again ;)
rm -rf "$BASE_DIR/local/CVS"
#
# no no no let's better not copy it, so we can cvs update unmodified
# files like path.h although cvs up should NEVER replace the locally
# modified local.h.
#ln -s "config/default" "$BASE_DIR/local"
# that doesn't work either.. he tries to join changes between default
# local.h and current one, resulting in collisions.
#
# let's make symlinks of each file, then replace the ones we really
# need locally..
#
#mkdir "$BASE_DIR/local"
#ln -s config/default/README config/default/*.h "$BASE_DIR/local"
# this one gives us headaches
#rm "$BASE_DIR/local/CVS"
if test "$RUNTIME_OUTPUT" = "files"
then
@ -1272,13 +1286,18 @@ echo "Setting permissions for program files..."
chown -R $USER $BASE_DIR
chgrp -R $GROUP $BASE_DIR
chmod -R $PERMISSIONS $BASE_DIR
# does this mark all files executable, even .c?
chmod -R $BASE_PERM $BASE_DIR
chmod -R u+x $BASE_DIR/bin
echo "Setting permissions for data and log files..."
chmod -R $DATA_PERM $BASE_DIR/data $BASE_DIR/log
echo "Setting $GROUP group on configuration files..."
chgrp -R $GROUP $CONFIG_DIR
# and now we'll see if perl is installed :)
bin/psyconf psyced.ini

View File

@ -4,7 +4,7 @@
#define SILENCE
#ifdef BRAIN
# define NEWSFEED_RSS "http://english.aljazeera.net/NR/exeres/4D6139CD-6BB5-438A-8F33-96A7F25F40AF.htm?ArticleGuid=55ABE840-AC30-41D2-BDC9-06BBE2A36665"
# define NEWSFEED_RSS "http://english.aljazeera.net/Services/Rss/?PostingId=2007731105943979989"
#else
# define CONNECT_DEFAULT
#endif

View File

@ -1,5 +1,5 @@
#include <net.h>
#define NAME "freeNode"
#define NAME "freenode"
//
// «freenode:TomSawyer» TomSawyer sagt Dir: you're able to talk to me, not because I'm an admin, but because I have /msg nickserv set unfiltered on
@ -12,7 +12,8 @@
#ifdef BRAIN
# echo BRAIN: connecting to freenode IRC server
# define CONNECT_IRC "irc." NAME ".net"
//# define CONNECT_IRC "irc." NAME ".net"
# define CONNECT_IRC "calvino.freenode.net"
//# define CHAT_CHANNEL "esp"
//# define CHAT_CHANNEL "23c3"
# define PASS_IRC IRCGATE_FREENODE

View File

@ -9,7 +9,7 @@
//
//#define CONNECT_IRC "irc.freenet.de" // an ircnet server
//#define CONNECT_IRC "us.ircnet.org"
#define CONNECT_IRC "irc1.us.ircnet.net"
#define CONNECT_IRC "irc.fu-berlin.de"
//
// other example configuration
//
@ -25,6 +25,7 @@
//#define ON_CONNECT call_out("emit", 9, "JOIN :#" CHAT_CHANNEL "\n");
#include <place.gen>
#echo IRCnet Gateway loaded. Connecting to IRCnet IRC.
// See also http://about.psyc.eu/gateway
//

View File

@ -18,7 +18,7 @@
//# define LOCAL // if you don't want to allow remote users here
// but this one can't harm ;)
# define PLACE_MASQUERADING
# define PLACE_MASQUERADE
#endif
#include <place.gen> // now generate the place according to the rules

View File

@ -1,3 +1,4 @@
#if 0
#include <net.h>
#define SILENCE
#define NAME "Spiegel-EN"
@ -5,13 +6,11 @@
#define DESCRIPTION "Europe's Largest News Magazine in English Edition"
#ifdef BRAIN
# define NEWSFEED_RSS "http://www.spiegel.de/schlagzeilen/rss/0,5291,676,00.xml"
# define NEWSFEED_RSS "http://www.spiegel.de/international/index.rss"
# define RESET_INTERVAL 10 // they suggest 5 minutes
#else
# define CONNECT_DEFAULT
#endif
#endif
/*
* http://www.spiegel.de/dertag/0,1518,271804,00.html
*/
#include <place.gen>

View File

@ -1,15 +1,14 @@
#if 0
#include <net.h>
#define SILENCE
#define NAME "Spiegel"
#ifdef BRAIN
# define NEWSFEED_RSS "http://www.spiegel.de/schlagzeilen/rss/0,5291,,00.xml"
# define NEWSFEED_RSS "http://www.spiegel.de/schlagzeilen/index.rss"
# define RESET_INTERVAL 5 // they suggest 5 minutes
#else
# define CONNECT_DEFAULT
#endif
#endif
/*
* http://www.spiegel.de/dertag/0,1518,271804,00.html
*/
#include <place.gen>

View File

@ -1,4 +1,4 @@
// $Id: test.c,v 1.34 2008/01/26 12:02:07 lynx Exp $ // vim:syntax=lpc
// $Id: test.c,v 1.35 2008/08/03 14:22:43 lynx Exp $ // vim:syntax=lpc
//
// room to test some library functions etc
// originally started by heldensaga
@ -27,8 +27,8 @@
#ifdef HTMORE
inherit NET_PATH "outputb";
// order is relevant. outputb needs to be inherited BEFORE textc!
#include <text.h>
#endif
#include <text.h>
#include <place.gen>

View File

@ -6,15 +6,15 @@
#define PLACE_HISTORY
#define HISTORY_GLIMPSE 7
#ifdef BETA
#ifdef SYMLYNX
# define PLACE_OWNED ADMINISTRATORS
//# define MASTER
# echo tuXedo is a masterplace.
//# define ALLOW_EXTERNAL_FROM "psyc://andrack.tobij.de"
#else
# define JUNCTION
# define CONNECT "psyc://beta.ve.symlynX.com/@" NAME
# echo tuXedo is a junction for beta.ve.symlynX.com.
# define CONNECT "psyc://ve.symlynX.com/@" NAME
# echo tuXedo is a junction for ve.symlynX.com.
#endif
#include <place.gen>

View File

@ -15,7 +15,7 @@ usage: $0 <filematch> [<operation> [<directories>]]
<operation> by default is to transform anonymous access to the psyced
repository into your personal login access. in detail:
$op
"s#^:pserver:anonymous\\\@cvs\\\.psyced\\\.org:/CVS/anonCVS#:pserver:$ENV{USER}\\\@cvs\\\.psyced\\\.org:/CVS/muveCVS#m"
without <directories> the directory tree starting from the current directory
is recursively checked.

View File

@ -1,4 +1,5 @@
<PSYC:TEXTDB> ## vim:syntax=html
## Check utf-8: Praise Atatürk!
_PAGES_help_survival
|<h5>Erste Schritte für die Ungeduldigen</h5>

View File

@ -1,4 +1,5 @@
<PSYC:TEXTDB> ## vim:syntax=mail
## Check utf-8: Praise Atatürk!
_message
|[_nick] sendet Dir: [_data]
@ -108,6 +109,9 @@ _TEXT_time_age
_TEXT_time_alive
|Zuletzt aktiv
_TEXT_address_zone_time
|Zeitzone
_TEXT_contact_telephone
|Telefon
@ -195,6 +199,12 @@ _TEXT_action_asks
_TEXT_action_does
|tut
_TEXT_button_home
|START
_TEXT_button_call
|ANRUFEN
_TEXT_button_friend_new
|ANFREUNDEN
@ -438,6 +448,9 @@ _info_set_none
_info_talk
|## no output
_info_mail_subject
|Nachrichten an [_target]
_info_mail_signature
|Antwort per E-Mail ist nicht möglich. Bitte Einloggen:
|[_URL_login]
@ -533,6 +546,30 @@ _request_open_page_edit
|Zur Bearbeitung der Einstellungen bitte folgende Seite aufrufen:
|[_page_edit]
_request_call_link
|Anruf von [_nick]: Annehmen durch Klick auf [_page_call].
_echo_call
|[_nick_target] wird angerufen.
_warning_usage_call
|Syntax: /call <Person>
_notice_answer_call
|Der Anruf wurde angenommen.
_notice_answer_call_link
|Der Anruf wurde angenommen. [_page_call] um das Gespräch zu beginnen.
_notice_answer_call_click
|Der Anruf wurde angeclickt.
_notice_reject_call_click
|Der Anruf wurde abgewiesen.
_notice_reject_call
|Der Anruf wurde abgewiesen.
_notice_requested_status_person
|[_source] erkundigt sich nach Deiner Anwesenheit.
@ -540,7 +577,7 @@ _notice_authentication
|Ja klar, das bin dann wohl ich!
_notice_processing_authentication
|Momenterl, ich muss mal nachfragen..
|Bestätigung der Identität von [_source] verzögert.
_echo_place_nick_removed
|Du legst den Namen [_nick_local] wieder ab.
@ -706,10 +743,8 @@ _error_necessary_registration_other
|geschützt sein. Hierzu kann [_other] den "/reg" Befehl verwenden.
_error_invalid_password
|## Das war leider das flasche Passwort für [_nick].
|Das Passwort passt nicht zu [_nick].
|Passage nicht möglich.
|So kann's passieren.
|Das war leider das flasche Passwort für [_nick].
|## Das Passwort passt nicht zu [_nick].
_error_invalid_uniform
|Diese Adresse ergibt mir keinen Sinn.
@ -803,6 +838,9 @@ _failure_unavailable_service_talk
_failure_unavailable_service_talk_text
|Gespräch mit [_nick_target] ist nicht möglich: [_text_XMPP]
_failure_invalid_route
|Ungültige Route nach [_target_relay] im [_context_relay] Context festgestellt.
_failure_unsupported_ping
|[_nick] kann man nicht anpingen.
@ -841,6 +879,9 @@ _message_public
_message_echo_private
|Du sagst [_nick_target]: [_data]
_message_echo_private_annotate
|Anmerkung an [_nick_target]: [_data]
_message_echo_public
|Du sagst: [_data]
@ -920,7 +961,7 @@ _request_attention_wake
|Aufmerksamkeit ersucht durch [_nick]. WACH[_beep]AUF!
_notice_login
|Willkommen im [_name_network] Netzwerk, [_nick]. ([_page_network])
|Willkommen im [_name_network], [_source].
_notice_invitation
|[_nick] lädt Dich nach [_nick_place] ein.
@ -1023,7 +1064,13 @@ _notice_place_topic_official
|[_topic]
_notice_place_topic_removed
|[_nick] entfernt [_nick_topic]'s Ankündigung: [_topic]
|[_nick] entfernt [_nick_topic]s Ankündigung: [_topic]
_notice_examine_web_person
|[_nick] wurde auf [_web_on] betrachtet, von [_web_from] kommend.
_notice_examine_web_place
|[_nick_place] wurde auf [_web_on] betrachtet, von [_web_from] kommend.
_notice_place_examine_web
|[_nick_place] wurde auf [_web_on] betrachtet, von [_web_from] kommend.
@ -1508,9 +1555,6 @@ _status_place_aides
_status_place_members
|In [_nick_place]: [_list_members_nicks].
_status_place_topic
|Ankündigung von [_nick]: [_topic]
_status_place_masquerade
|Verkleidungen erlaubt. Ausprobieren mit "/nick".
@ -1553,6 +1597,13 @@ _status_place_link_slave
_status_place_aides_none
|In diesem Raum gibt es keine Schergen.
_status_place_topic
|Ankündigung von [_nick]: [_topic]
_status_place_topic_author
|## Only appears on IRC access
|Topic [_time_place] von [_nick] gesetzt.
_status_place_topic_none
|Es wurde in [_nick_place] kein Topic gesetzt.

View File

@ -1,9 +1,10 @@
<PSYC:TEXTDB> ## vim:syntax=html
## as yet undocumented/unfinalized: detach attach offline online
## and /set identities
### Check utf-8: Praise Atatürk!
_HTML_tail
|</td></tr></table>
|</span></td></tr></table>
_HTML_head
|<script><!--
@ -44,8 +45,7 @@ _HTML_head
|--></style>
|
|<body bgcolor="#333333" text="#cccccc" link="#669966" vlink="#ccffcc">
|<table width="80%" height="100%"><tr><td>
|
|<table width="80%" height="100%"><tr><td><span id="content">
_HTML_info_split
|<hr noshade>
@ -1004,6 +1004,15 @@ _PAGES_user_settings_changed
|Settings changed.<br />
|<a href="?username=[_username]&password=[_password]">continue</a>
_PAGES_error
|<title>error [_code]</title>
|{_HTML_head}
|
|<h1 id="code">[_code]</h1>
|<div id="comment">[_comment]</div>
|
|{_HTML_tail}
_PAGES_group_scratchpad
|<title>scratchpad for [_nick_place]@{_VAR_host}</title>
|
@ -1322,7 +1331,7 @@ _PAGES_login
| setTimeout("Plf.submit()", 1234)
|</script>
|<form name="Plf" action="examine">
|## piccolo spazio pubblicità
|## piccolo spazio pubblicità
|<input type="hidden" name="visit" value="psyced.org">
|</form>
|{_echo_login_web}
@ -1330,6 +1339,15 @@ _PAGES_login
_echo_login_web
|You are being logged in.
_PAGES_start_description_anonymous
|<title>{_MISC_server_software}: examine profile for [_nick]</title>
|<body class="Pe">
|[_HTML_photo]
|[_FORM_start]
_PAGES_end_description_anonymous
|[_FORM_end]</body>
_PAGES_start_description
|<title>{_MISC_server_software}: examine profile on {_VAR_host}</title>
|<script>
@ -1382,7 +1400,7 @@ _HTML_examine_display
_HTML_examine_buttons_start
|## SELF? whatever.. text needs to be intlized
|<p class="Peb"><a id="Pebh" href="javascript:hom()">HOME</a> &nbsp;
|<p class="Peb"><a id="Pebh" href="javascript:hom()">{_TEXT_button_home}</a> &nbsp;
_HTML_examine_buttons_end
|</p>
@ -1403,21 +1421,24 @@ _HTML_examine_friend_delete
_HTML_examine_friend_new
|&nbsp; <a id="Pebf" href="javascript:cmd('FRIEND [_nick]')">{_TEXT_button_friend_new}</a>
_HTML_examine_button_call
|&nbsp; &nbsp; <a id="Pebf" href="javascript:cmd('CALL [_nick]')">{_TEXT_button_call}</a>
_HTML_call
|<object width="[_amount_width_object]" height="[_amount_height_object]">
|<param name="movie" value="[_path_object_local]"></param>
|<param name="bgcolor" value="#cc9999" />
|<embed src="[_path_object_local]?bgcolor=#ff6666" type="application/x-shockwave-flash" width="[_amount_width_object]" height="[_amount_height_object]"></embed>
|<param name="bgcolor" value="{_MISC_color_bg_call}" />
|<embed src="[_path_object_local]?bgcolor={_MISC_color_bg_call}" type="application/x-shockwave-flash" width="[_amount_width_object]" height="[_amount_height_object]"></embed>
|</object><object width="[_amount_width_object]" height="[_amount_height_object]">
|<param name="movie" value="[_path_object]"></param>
|## <param name="bgcolor" value="#9999cc"></param>
|## <param name="bgcolor" value="{_MISC_color_bg_call}"></param>
|## <param name="user" value="[_nick]"></param>
|## <param name="expiry" value="[_time_expire]"></param>
|## <param name="role" value="[_role]"></param>
|## <param name="jack" value="[_check_call]"></param>
|## <param name="server" value="[_uniform_server_media]"></param>
|<param name="flashVars" value="bgcolor=#9999cc&user=[_nick]&expiry=[_time_expire]&role=[_role]&jack=[_check_call]&server=[_uniform_server_media]"></param>
|<embed src="[_path_object]" flashVars="bgcolor=#66ff66&user=[_nick]&expiry=[_time_expire]&role=[_role]&jack=[_check_call]&server=[_uniform_server_media]" type="application/x-shockwave-flash" width="[_amount_width_object]" height="[_amount_height_object]"></embed>
|<param name="flashVars" value="bgcolor={_MISC_color_bg_call}&user=[_nick]&expiry=[_time_expire]&role=[_role]&jack=[_check_call]&server=[_uniform_server_media]"></param>
|<embed src="[_path_object]" flashVars="bgcolor={_MISC_color_bg_call}&user=[_nick]&expiry=[_time_expire]&role=[_role]&jack=[_check_call]&server=[_uniform_server_media]" type="application/x-shockwave-flash" width="[_amount_width_object]" height="[_amount_height_object]"></embed>
|</object>
_HTML_call_OLD
@ -1429,20 +1450,37 @@ _HTML_call_OLD
|<embed src="[_path_object]?ns0Name=(0)&stream=([_nick])[_time_expire][_role][_check_call]&url=[_uniform_server_media]" type="application/x-shockwave-flash" width="[_amount_width_object]" height="[_amount_height_object]"></embed>
|</object>
_list_description_each_item_NOTES
|## this currently produces a <table>. alice suggests something like
|<div><p class='var' style='display:block;float:left;width:200px'>var</p><p class='value' style='display:block;float:left;width:400px;'>value</p><br class='cleaner' style='clear:both'></div>
|## maybe like this? (with css accordingly)
|<div id="[_key]"><span class="ldpek">[_name_key]</span><span class="ldpev">[_value]</span></div>
|## or stick to the old table..?
|<tr id="[_key]"><td>[_name_key]</td><td>[_value]</td></tr>
|## do we want to do ._meth #ldpek { ... } in the css?
|<tr id="[_key]"><td class="ldpek">[_name_key]</td><td class="ldpev">[_value]</td></tr>
_list_description_each_item
|<span id="[_key]"><span class="ldpek">[_name_key]</span> <span class="ldpev">[_value]</span><br></span>
_list_description_each
|## would be nice to have <tr id='_meth'> so we can do
|## ._meth #ldpek { ... } in the css, but that requires a
|## switch to psyctext at least when rendering to html.. maybe someday..
|<tr><td class="ldpek">%s</td><td class="ldpev">%s</td></tr>
_list_description_image
|<img class="ldpi" src="data:[_type_image];base64,[_image_base64]">
_list_description_on
|<div class="ldp">
|<div class="ldpc">{_TEXT_description_nick}</div>
_list_description_off
|</div>
_list_description_on_table
|<table class="ldp" border=0>
|<tr class="ldpc"><th colspan=2>{_TEXT_description_nick}:</th></tr>
_list_description_off
_list_description_off_table
|</table>
_echo_execute_web

View File

@ -1,4 +1,5 @@
<PSYC:TEXTDB> ## vim:syntax=mail
## Check utf-8: Praise Atatürk!
_status_AREYOUNUTS
|:[_source_hack] NOTICE [_nick_me] :[_data]
@ -122,6 +123,9 @@ _request_version
_error_unknown_name_user
|#401 [_nick_me] [_nick_target] :{_error_unknown_name_user}
_error_necessary_membership
|#403 [_nick_me] #[_nick_place] :{_error_necessary_membership}
_error_status_place_matches
|## das lassen wir weg, weil manche clients unbedingt den join nochmal
|## abschicken wollen
@ -142,6 +146,19 @@ _message_private
_message_public
|:[_source_hack] PRIVMSG #[_nick_place] :[_data]
_message_echo_private
|## let's see how clients deal with messages to a remote target echoed back
|## it will probably not look good, but the clients need to fix that really
|:[_source_hack] PRIVMSG [_nick_target] :[_data]
|## oh, ircII is pretty cool about this. it shows:
|## -source:target- message
_message_echo_private_NOT
|## without this format, "You tell.. " is generated
|## this is how BNC sends it instead:
|:[_source_hack] PRIVMSG [_nick_me] :<- <[_nick_me]> [_data]
|## which is just like _message_private with an extra that isn't tamper-proof
_message_echo_public
|:[_source_hack] PRIVMSG #[_nick_place] :[_data]
@ -290,6 +307,9 @@ _failure_unsupported_ping
|## yes, this is a pong also...
|:[_source_hack] NOTICE [_nick_me] :%PING [_time_ping]%
_info_server_version
|:[_host_server] 351 [_nick_me] [_version].[_degree_debug] [_host_server] :[_version_server] using [_version_driver] available from [_page_server_software]
_status_version
|:[_source_hack] NOTICE [_nick_me] :%VERSION [_version_description] ([_version])%
@ -312,9 +332,16 @@ _status_place_members
|#353 [_nick_me] = #[_nick_place] :[_members]
_status_place_topic
|## #332 [_nick_me] #[_nick_place] :{_status_place_topic}
|## traditional IRC would be to leave out the _nick here
|#332 [_nick_me] #[_nick_place] :[_topic] ([_nick])
|## modern IRC is to send a semi-official 333 code
|## this entry is unused. the following two are used instead:
_status_place_topic_only
|#332 [_nick_me] #[_nick_place] :[_topic]
_status_place_topic_author
|#333 [_nick_me] #[_nick_place] [_nick] [_INTERNAL_time_topic] :{_status_place_topic_author}
_status_place_topic_none
|#331 [_nick_me] :{_status_place_topic_none}

View File

@ -1,4 +1,5 @@
<PSYC:TEXTDB> ## vim:syntax=mail
## Check utf-8: Praise Atatürk!
_message_public
|## people out there just *hate* the actions

View File

@ -1,4 +1,5 @@
<PSYC:TEXTDB> ## vim:syntax=mail
## Check utf-8: Praise Atatürk!
_MISC_character_command
|## since several clients started catching / commands..
@ -59,7 +60,7 @@ _request_execute_topic
_request_leave
|<presence from='[_INTERNAL_source_jabber]' to='[_INTERNAL_target_jabber_bare]/[_nick]' type='unavailable' id='[_tag]'><x xmlns='http://jabber.org/protocol/muc'/></presence>
_request_examine_vCard
_request_description_vCard
|<iq from='[_INTERNAL_source_jabber]' to='[_INTERNAL_target_jabber_bare]' type='get' id='[_tag]'><vCard xmlns='vcard-temp'/></iq>
_request_status_person
@ -188,7 +189,7 @@ _message_public_action
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>/me [_action]</body></message>
_message_public_magnify
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>« [_data] »</body></message>
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>« [_data] »</body></message>
_message_public_whisper
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>/me whispers to [_nick_target]: [_data]</body></message>
@ -206,7 +207,7 @@ _message_public_text_action
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>[_data]</body></message>
_message_public_action_magnify
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>/me [_action] «««</body></message>
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>/me [_action] «««</body></message>
_message_public_action_possessive
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>/me 's [_action_possessive]</body></message>
@ -215,7 +216,7 @@ _message_public_action_reduce
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>/me {_TEXT_action_does} {_TEXT_something}.</body></message>
_message_public_question_magnify
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>/me {_TEXT_action_asks} « [_data] »</body></message>
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>/me {_TEXT_action_asks} « [_data] »</body></message>
_message_public_question_reduce
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>/me {_TEXT_action_asks} {_TEXT_something}.</body></message>
@ -224,7 +225,7 @@ _message_private_action
|<message from='[_INTERNAL_source_jabber]' to='[_INTERNAL_target_jabber]' type='chat'><body>/me [_action]</body></message>
_message_private_magnify
|<message from='[_INTERNAL_source_jabber]' to='[_INTERNAL_target_jabber]' type='chat'><body>« [_data] »</body></message>
|<message from='[_INTERNAL_source_jabber]' to='[_INTERNAL_target_jabber]' type='chat'><body>« [_data] »</body></message>
_message_private_reduce
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>/me {_TEXT_tells} {_TEXT_dir} {_TEXT_something}.</body></message>
@ -247,7 +248,7 @@ _message_private_ask_reduce
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>/me {_TEXT_asks} {_TEXT_dich} {_TEXT_something}.</body></message>
_message_private_action_magnify
|<message from='[_INTERNAL_source_jabber]' to='[_INTERNAL_target_jabber]' type='chat'><body>/me [_action] «««</body></message>
|<message from='[_INTERNAL_source_jabber]' to='[_INTERNAL_target_jabber]' type='chat'><body>/me [_action] «««</body></message>
_message_private_action_reduce
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>/me {_TEXT_action_does} {_TEXT_something}.</body></message>
@ -404,8 +405,14 @@ _notice_presence_absent
_notice_person_absent_netburp
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>xa</show><status>{_notice_person_absent_netburp}</status></presence>
_request_call
|<message from='[_INTERNAL_source_jabber_bare]' to='[_INTERNAL_target_jabber]' type='headline'><body>{_VAR_method}</body><x xmlns='jabber:iq:oob'><url>[_page_call]</url></x></message>
_notice_answer_call_link
|<message from='[_INTERNAL_source_jabber_bare]' to='[_INTERNAL_target_jabber]' type='headline'><body>{_VAR_method}</body><x xmlns='jabber:iq:oob'><url>[_page_call]</url></x></message>
_notice_headline_news
|<message from='[_INTERNAL_source_jabber_bare]' to='[_INTERNAL_target_jabber]' type='headline'><body></body><x xmlns='jabber:iq:oob'><url>[_page_news]</url></x></message>
|<message from='[_INTERNAL_source_jabber_bare]' to='[_INTERNAL_target_jabber]' type='headline'><body>{_VAR_method}</body><x xmlns='jabber:iq:oob'><url>[_page_news]</url></x></message>
_echo_notice_friendship_established
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber_bare]' type='subscribed'/><presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]'/>

View File

@ -1,4 +1,5 @@
<PSYC:TEXTDB> ## vim:syntax=mail
## Check utf-8: Praise Atatürk!
_message
|[_nick] sends you: [_data]
@ -18,6 +19,9 @@ _prefix
_URL_help
|http://help.pages.de
_URL_project
|http://www.psyced.org
_MISC_color
|{_MISC_color_text}
@ -246,6 +250,9 @@ _TEXT_time_age
_TEXT_time_alive
|Last time alive
_TEXT_address_zone_time
|Time zone
_TEXT_contact_telephone
|Telephone
@ -335,6 +342,12 @@ _TEXT_action_away
_TEXT_action_does
|does
_TEXT_button_home
|HOME
_TEXT_button_call
|PHONE CALL
_TEXT_button_friend_new
|MAKE FRIENDSHIP
@ -519,6 +532,30 @@ _request_description_vCard
_request_friendship_implied
|## no output
_request_call_link
|[_nick] would like to speak to you. Use [_page_call] to answer the call.
_echo_call
|Phone conversation request issued to [_nick_target].
_warning_usage_call
|Usage: /call <person>
_notice_answer_call
|Your request has been accepted.
_notice_answer_call_link
|Your request has been accepted. Use [_page_call] to start the phone call.
_notice_answer_call_click
|Your phone call request has been clicked upon.
_notice_reject_call_click
|Your phone call request has been rejected.
_notice_reject_call
|Your phone call request has been rejected.
_notice_requested_status_person
|[_source] is checking your presence.
@ -531,6 +568,9 @@ _status_place_nick_local
_status_place_nick_local_none
|You aren't masquerading yet. What are you waiting for?
_error_necessary_membership
|You need to enter [_nick_place] first.
_error_place_silent_configuration_topic
|This room is not for talking. [_topic]
@ -606,9 +646,12 @@ _failure_unavailable_service_version
_failure_unavailable_service_description
|Requesting description of [_nick_target] is not possible.
_failure_invalid_route
|Invalid route to [_target_relay] detected in [_context_relay]'s context.
_failure_unsupported_function_root
|[_nick] does not provide [_method_relay].
|Are you sure you want to talk to me?
|## Are you sure you want to talk to me?
_failure_unsupported_function_whisper
|Routing private messages through groupchat managers is dangerous to your privacy and therefore disallowed. Please communicate with the person directly.
@ -647,6 +690,9 @@ _message_friends
_message_echo_private
|You tell [_nick_target]: [_data]
_message_echo_private_annotate
|Notice to [_nick_target]: [_data]
_message_echo_public
|You say: [_data]
@ -666,7 +712,7 @@ _message_echo_public_text_action
|[_nick] [_action]: [_data]
_message_echo_public_text_action_magnify
|««« {_message_echo_private_text_action} »»»
|««« {_message_echo_private_text_action} »»»
_message_echo_public_text_action_reduce
|[_nick] [_action] {_TEXT_something}.
@ -690,7 +736,7 @@ _message_public_action
|[_nick] [_action].
_message_public_magnify
|««« {_message_public} »»»
|««« {_message_public} »»»
_message_public_important
|===> {_message_public}
@ -726,7 +772,7 @@ _message_public_other_action_possessive
|In [_nick_place]: [_nick]'s [_action_possessive].
_message_public_action_magnify
|««« {_message_public_action} »»»
|««« {_message_public_action} »»»
_message_public_action_important
|===> {_message_public_action}
@ -738,7 +784,7 @@ _message_public_action_reduce
|[_nick] {_TEXT_action_does} {_TEXT_something}.
_message_public_question_magnify
|««« {_message_public_question} »»»
|««« {_message_public_question} »»»
_message_public_question_pending
|{_TEXT_pending} [_nick] {_TEXT_action_asks}: [_data]
@ -768,7 +814,7 @@ _message_private_action
|[_nick] [_action].
_message_private_magnify
|««« {_message_private} »»»
|««« {_message_private} »»»
_message_private_reduce
|[_nick] {_TEXT_action_tells} you {_TEXT_something}.
@ -780,7 +826,7 @@ _message_private_ask
|[_nick] {_TEXT_action_asks} you: [_data]
_message_private_ask_magnify
|««« {_message_private_ask} »»»
|««« {_message_private_ask} »»»
_message_private_ask_reduce
|[_nick] {_TEXT_action_asks} you {_TEXT_something}.
@ -789,7 +835,7 @@ _message_private_text_action
|[_nick] [_action]: [_data]
_message_private_action_magnify
|««« {_message_private_action} »»»
|««« {_message_private_action} »»»
_message_private_action_reduce
|[_nick] does {_TEXT_something} to you.
@ -798,7 +844,7 @@ _echo_wake
|Trying to wake [_nick_target].
_notice_login
|Welcome on the [_name_network] network, [_nick]. ([_page_network])
|Welcome on [_name_network], [_source].
_request_attention_wake
|[_nick] seeks your attention. WAKE[_beep]UP!
@ -827,6 +873,12 @@ _notice_logon_last
_notice_place_leave
|[_nick] leaves [_nick_place].
_notice_examine_web_person
|[_nick] inspected on [_web_on] coming from [_web_from].
_notice_examine_web_place
|[_nick_place] inspected on [_web_on] coming from [_web_from].
_notice_place_examine_web
|[_nick_place] inspected on [_web_on] coming from [_web_from].
@ -1252,7 +1304,7 @@ _notice_authentication
|Yes, that's me!
_notice_processing_authentication
|Wait a minute, I have to ask somebody.
|Proof of [_source]'s identity is delayed.
_notice_unlink
|[_location] unlinked from [_identification].
@ -1375,6 +1427,9 @@ _notice_friendship_removed_implied
_status_place_identification
|PSYC Identification of [_nick_place]: [_identification]
_status_place_topic
|Topic by [_nick]: [_topic]
_status_place_topic_none
|No topic is set in [_nick_place].
@ -1382,6 +1437,10 @@ _status_place_topic_official
|## Announcement:
|[_topic]
_status_place_topic_author
|## Only appears on IRC access
|Topic set by [_nick] at [_time_place].
_status_description_time
|[_nick] has been alive about [_time_idle] ago.

View File

@ -1,4 +1,5 @@
<PSYC:TEXTDB> ## vim:syntax=mail
## Check utf-8: Praise Atatürk!
_message
|MESSAGE sip:[_nick_target]@[_host_target] SIP/2.0

View File

@ -6,6 +6,7 @@
##|
##|vorsicht: die chat-dienste funktionieren mit WinWAP nicht,
##| da dieser HTTP nicht korrekt implementiert.
### Check utf-8: Praise Atatürk!
_error_invalid_agent_HTML
|<title>wap2psyc gateway</title>

View File

@ -1,4 +1,4 @@
// $Id: interface.h,v 1.51 2008/04/09 16:49:23 lynx Exp $ // vim:syntax=lpc:ts=8
// $Id: interface.h,v 1.54 2008/08/26 13:42:24 lynx Exp $ // vim:syntax=lpc:ts=8
#define _INCLUDE_INTERFACE_H
// let's stay compatible for a while
@ -8,10 +8,12 @@
# define SAVE_FORMAT 0
//#endif
#ifdef __psyclpc__
# define DRIVER_VERSION "psyclpc/" __VERSION__
#else
#ifndef __psyclpc__
# define DRIVER_VERSION "ldmud/" __VERSION__
#else
# define DRIVER_VERSION "psyclpc/" __VERSION__
# define hex2int(HEX) to_int("0x"+ HEX)
#endif
// driver abstraction kit -- abstraction layer from driver details
@ -114,6 +116,14 @@
#define vamixed mixed
#define vaint int
// extracts hh:mm:ss format from ctime output
#define hhmmss(CTIME) CTIME[11..18]
// extracts hh:mm format from ctime output (for idle times)
#define hhmm(CTIME) CTIME[11..15]
// typical timestamp string: hhmm or iso-date if older than 24 hours
#define time_or_date(TS) \
(time() - TS > 24*60*60 ? isotime(TS, 0) : hhmm(ctime( TS )))
#if __EFUN_DEFINED__(convert_charset)
# ifdef TRANSLIT // TRANSLIT has no effect whatsoever. grrr!
# define iconv(s, FROM, TO) (s = convert_charset(s, FROM, TO +"//TRANSLIT"))
@ -140,3 +150,9 @@
# define DEBUG_TRACE "(DEBUG_TRACE disabled: DEBUG level below 1)"
# endif
#endif
// some ldmud versions previous to 610 have a problem with digest-md5
#if __VERSION_MAJOR__ < 4 && __VERSION_MICRO__ < 611
# echo Warning: Your driver is so old, it cannot do DIGEST-MD5
# define _flag_disable_authentication_digest_MD5
#endif

View File

@ -1,4 +1,4 @@
// $Id: master.c,v 1.61 2008/03/11 16:15:15 lynx Exp $ // vim:syntax=lpc:ts=8
// $Id: master.c,v 1.66 2008/07/20 21:26:04 lynx Exp $ // vim:syntax=lpc:ts=8
//
#ifdef INIT_FILE
#undef INIT_FILE
@ -11,6 +11,12 @@ mixed valid_write(string path, string eff_user, string call, object caller);
// bei amylaar und ldmud braucht master.c den absoluten pfad..
#include "/local/config.h"
#ifdef Dmaster
# undef DEBUG
# define DEBUG Dmaster
#endif
#include NET_PATH "include/net.h"
#include DRIVER_PATH "sys/driver_hook.h"
#include DRIVER_PATH "sys/debug_message.h"
@ -19,7 +25,7 @@ mixed valid_write(string path, string eff_user, string call, object caller);
#ifdef PRO_PATH
inherit PRO_PATH "master";
#else
# include DRIVER_PATH "master/psycmuve.i"
inherit DRIVER_PATH "master/accept";
#endif
#include DRIVER_PATH "master/classic.i"
@ -177,23 +183,26 @@ void disconnect(object ob, string remaining) {
string host = query_ip_name(ob);
string name = object_name(ob);
PT(("disconnected: %O from %O%s\n", ob, host,
// happens when first clone fails:
unless (ob && objectp(ob) && ob != ME) return;
// this disconnect was expected behaviour:
if (ob->disconnected(remaining)) return;
// unexpected disconnection.
//
// disconnected() must return true when the
// socket disconnection was expected and is no
// cause for concern. if we got here, it is.
//
// 'remaining' is empty in most cases, still
// we don't output 'remaining' on console
// as it occasionally triggers a utf8 conversion error
// instead we drop this into a logfile
SIMUL_EFUN_FILE -> log_file("DISC", "%O %O %O\n",
name, host, remaining);
P2(("Unexpected disconnect in %s from %O%s\n", name, host,
remaining && strlen(remaining) ?
" with "+ strlen(remaining) +" bytes remaining" : ""))
// happens when first clone fails
unless (ob && objectp(ob) && ob != ME) return;
unless (ob->disconnected(remaining)) {
// disconnected() must return true when the
// socket disconnection was expected and is no
// cause for concern. if we got here, it is.
//
// 'remaining' is empty in most cases, still
// we don't output 'remaining' on console
// as it occasionally triggers a utf8 conversion error
// instead we drop this into a logfile
SIMUL_EFUN_FILE -> log_file("DISC", "%O %O %O\n",
name, host, remaining);
}
}
// even though the name of the function is weird, this is the
@ -217,7 +226,7 @@ void receive_udp(string host, string msg, int port) {
case '|':
unless (spycd) {
spycd = SPYC_PATH "udp" -> load();
PT(("SPYC UDP daemon created.\n"))
P1(("SPYC UDP daemon created.\n"))
unless (spycd) return;
}
spycd -> parseUDP(host, port, msg);
@ -226,7 +235,7 @@ void receive_udp(string host, string msg, int port) {
case '.':
unless (psycd) {
psycd = PSYC_PATH "udp" -> load();
PT(("PSYC UDP daemon created.\n"))
P1(("PSYC UDP daemon created.\n"))
unless (psycd) return;
}
psycd -> parseUDP (host,port,msg);

View File

@ -1,398 +0,0 @@
// $Id: psycmuve.i,v 1.113 2008/01/30 17:22:41 lynx Exp $ // vim:syntax=lpc:ts=8
//
// this file contains the glue between LDMUD and psyced to
// connect the socket ports to appropriately named objects.
//
#include NET_PATH "include/services.h"
#include DRIVER_PATH "include/driver.h"
#include CONFIG_PATH "config.h"
volatile int shutdown_in_progress = 0;
// not part of the master/driver API.. this is called from the library
void notify_shutdown_first(int progress) {
P3(("%O notify_shutdown_first(%O)\n", ME, progress))
shutdown_in_progress = progress;
}
#ifndef UID2NICK
# ifdef _userid_nick_mapping
# define UID2NICK(uid) ([ _userid_nick_mapping ])[uid]
# endif
#endif
/*
* This function is called every time a TCP connection is established.
* It dispatches the ports to the protocol implementations.
* input_to() can't be called from here.
*
* uid is only passed if USE_AUTHLOCAL is built into the driver.
*/
object connect(int uid) {
int peerport;
mixed arg, t;
D2(if (uid) D("connected on port "+query_mud_port()+" by uid "+uid+"\n");)
#ifndef H_DEFAULT_PROMPT
set_prompt("");
#endif
if (shutdown_in_progress) {
PT(("shutdown_in_progress(%O): putting connection from %O on hold\n",
shutdown_in_progress, query_ip_name(ME)))
// put the connection on hold to avoid further reconnects
return clone_object(NET_PATH "utility/onhold");
}
// we dont want the telnet machine most of the time
// but disabling and re-enabling it for telnet doesn't work
switch(query_mud_port()) {
#if HAS_PORT(PSYCS_PORT, PSYC_PATH)
case PSYCS_PORT: // inofficial & temporary
t = tls_init_connection(this_object());
if (t < 0) PP(( "TLS on %O: %O\n",
query_mud_port(), tls_error(t) ));
#endif // fall thru
#if HAS_PORT(PSYC_PORT, PSYC_PATH)
case PSYC_PORT:
#endif
#if HAS_PORT(PSYC_PORT, PSYC_PATH) || HAS_PORT(PSYCS_PORT, PSYC_PATH)
# ifdef DRIVER_HAS_CALL_BY_REFERENCE
arg = ME;
query_ip_number(&arg);
// this assumes network byte order provided by driver
peerport = pointerp(arg) ? (arg[2]*256 + arg[3]) : 0;
if (peerport < 0) peerport = 65536 + peerport;
// no support for non-AF_INET nets yet
if (peerport == PSYC_SERVICE) peerport = 0;
# else
// as long as the object names don't collide, this is okay too
peerport = 65536 + random(9999999);
# endif
# ifdef DRIVER_HAS_RENAMED_CLONES
t = "S:psyc:"+query_ip_number();
// tcp peerports cannot be connected to, so we use minus
if (peerport) t += ":-"+peerport;
# else
t = clone_object(PSYC_PATH "server");
# endif
// the psyc backend distinguishes listen ports from peers using minus
D3(D(S("%O -> load(%O, %O)\n", t, query_ip_number(), -peerport));)
return t -> load(query_ip_number(), -peerport);
#endif
#if HAS_PORT(SPYCS_PORT, SPYC_PATH)
case SPYCS_PORT: // inofficial & temporary
t = tls_init_connection(this_object());
if (t < 0) PP(( "TLS on %O: %O\n",
query_mud_port(), tls_error(t) ));
#endif // fall thru
#if HAS_PORT(SPYC_PORT, SPYC_PATH)
case SPYC_PORT:
#endif
#if HAS_PORT(SPYC_PORT, SPYC_PATH) || HAS_PORT(SPYCS_PORT, SPYC_PATH)
# ifdef DRIVER_HAS_CALL_BY_REFERENCE
arg = ME;
query_ip_number(&arg);
// this assumes network byte order provided by driver
peerport = pointerp(arg) ? (arg[2]*256 + arg[3]) : 0;
if (peerport < 0) peerport = 65536 + peerport;
// no support for non-AF_INET nets yet
if (peerport == SPYC_SERVICE) peerport = 0;
# else
// as long as the object names don't collide, this is okay too
peerport = 65536 + random(9999999);
# endif
# ifdef DRIVER_HAS_RENAMED_CLONES
t = "S:psyc:"+query_ip_number();
// tcp peerports cannot be connected to, so we use minus
if (peerport) t += ":-"+peerport;
# else
t = clone_object(SPYC_PATH "server");
# endif
// the psyc backend distinguishes listen ports from peers using minus
D3(D(S("%O -> load(%O, %O)\n", t, query_ip_number(), -peerport));)
return t -> load(query_ip_number(), -peerport);
#endif
#if HAS_PORT(POP3S_PORT, POP3_PATH)
case POP3S_PORT:
t = tls_init_connection(this_object());
if (t < 0) PP(( "TLS on %O: %O\n",
query_mud_port(), tls_error(t) ));
return clone_object(POP3_PATH "server");
#endif
#if HAS_PORT(POP3_PORT, POP3_PATH)
case POP3_PORT:
return clone_object(POP3_PATH "server");
#endif
#if HAS_PORT(SMTPS_PORT, NNTP_PATH)
case SMTPS_PORT:
t = tls_init_connection(this_object());
if (t < 0) PP(( "TLS on %O: %O\n",
query_mud_port(), tls_error(t) ));
return clone_object(SMTP_PATH "server");
#endif
#if HAS_PORT(SMTP_PORT, SMTP_PATH)
case SMTP_PORT:
return clone_object(SMTP_PATH "server");
#endif
// heldensagas little http app
#if HAS_PORT(SHT_PORT, SHT_PATH)
case SHT_PORT:
return clone_object(SHT_PATH "server");
#endif
#if HAS_PORT(NNTPS_PORT, NNTP_PATH)
case NNTPS_PORT:
t = tls_init_connection(this_object());
if (t < 0) PP(( "TLS on %O: %O\n",
query_mud_port(), tls_error(t) ));
return clone_object(NNTP_PATH "server");
#endif
#if HAS_PORT(NNTP_PORT, NNTP_PATH)
case NNTP_PORT:
return clone_object(NNTP_PATH "server");
#endif
#if HAS_PORT(JABBERS_PORT, JABBER_PATH)
case JABBERS_PORT:
t = tls_init_connection(this_object());
if (t < 0) PP(( "TLS on %O: %O\n",
query_mud_port(), tls_error(t) ));
return clone_object(JABBER_PATH "server");
#endif
#if HAS_PORT(JABBER_PORT, JABBER_PATH)
case JABBER_PORT:
# if __EFUN_DEFINED__(enable_telnet)
enable_telnet(0); // are you sure!???
# endif
return clone_object(JABBER_PATH "server");
#endif
#if HAS_PORT(JABBER_S2S_PORT, JABBER_PATH)
case JABBER_S2S_PORT:
# ifdef DRIVER_HAS_CALL_BY_REFERENCE
arg = ME;
query_ip_number(&arg);
// this assumes network byte order provided by driver
peerport = pointerp(arg) ? (arg[2]*256 + arg[3]) : 0;
if (peerport < 0) peerport = 65536 + peerport;
if (peerport == JABBER_S2S_SERVICE) peerport = 0;
# else
// as long as the object names don't collide, this is okay too
peerport = 65536 + random(9999999);
# endif
# if __EFUN_DEFINED__(enable_telnet)
enable_telnet(0);
# endif
t = "S:xmpp:"+query_ip_number();
// it's just an object name, but let's be consequent minus peerport
if (peerport) t += ":-"+peerport;
# ifdef _flag_log_sockets_XMPP
SIMUL_EFUN_FILE -> log_file("RAW_XMPP", "\n\n%O: %O -> load(%O, %O)",
ME, t,
# ifdef _flag_log_hosts
query_ip_number(),
# else
"?",
# endif
-peerport);
# endif
P3(("%O -> load(%O, %O)\n", t, query_ip_number(), -peerport))
return t -> load(query_ip_number(), -peerport);
#endif
#if 0 //__EFUN_DEFINED__(enable_binary)
// work in progress
case 8888:
enable_binary();
enable_telnet(0);
return clone_object(NET_PATH "socks/protocol");
case 1935:
enable_binary();
enable_telnet(0);
return clone_object(NET_PATH "rtmp/protocol");
#endif
#if HAS_PORT(IRCS_PORT, IRC_PATH)
case IRCS_PORT:
t = tls_init_connection(this_object());
if (t < 0) PP(( "TLS on %O: %O\n",
query_mud_port(), tls_error(t) ));
return clone_object(IRC_PATH "server");
#endif
#if HAS_PORT(IRC_PORT, IRC_PATH)
case IRC_PORT:
# if 0 // __EFUN_DEFINED__(enable_telnet)
enable_telnet(0); // shouldn't harm.. but it does!!!
# endif
return clone_object(IRC_PATH "server");
#endif
#if HAS_PORT(APPLET_PORT, APPLET_PATH)
case APPLET_PORT:
# if __EFUN_DEFINED__(enable_telnet)
// enable_telnet(0);
# endif
return clone_object(APPLET_PATH "server");
#endif
#if HAS_PORT(TELNETS_PORT, TELNET_PATH)
case TELNETS_PORT:
return clone_object(TELNET_PATH "sslserver");
#endif
#if HAS_PORT(TELNET_PORT, TELNET_PATH)
case TELNET_PORT:
// set_prompt("> ");
t = clone_object(TELNET_PATH "server");
# ifdef UID2NICK
if (uid && (arg = UID2NICK(uid))) {
t -> sName(arg);
}
# endif
return t;
#endif
#if HAS_PORT(HTTPS_PORT, HTTP_PATH)
case HTTPS_PORT:
t = tls_init_connection(this_object());
// should it return 0 in a tls_error case?
D1( if (t < 0) PP(( "TLS(%O) on %O: %O\n", t, query_mud_port(), tls_error(t) )); )
D2( else if (t > 0) PP(( "Setting up TLS connection in the background.\n" )); )
D2( else PP(( "Oh yeah, I'm initializing an https session!\n" )); )
return clone_object(HTTP_PATH "server");
#endif
#if HAS_PORT(HTTP_PORT, HTTP_PATH)
case HTTP_PORT:
return clone_object(HTTP_PATH "server");
#endif
#if HAS_PORT(MUDS_PORT, MUD_PATH)
case MUDS_PORT:
t = tls_init_connection(this_object());
if (t < 0) PP(( "TLS on %O: %O\n",
query_mud_port(), tls_error(t) ));
return clone_object(MUD_PATH "login");
#endif
#if HAS_PORT(MUD_PORT, MUD_PATH)
default:
// if you want to multiplex psyced with an LPMUD game
// set_prompt("> ");
return clone_object(MUD_PATH "login");
#endif
}
PP(("Received connection on port %O which isn't configured.\n",
query_mud_port()));
return (object)0;
}
#ifdef DRIVER_HAS_RENAMED_CLONES
// named clones -lynx
object compile_object(string file) {
string path, name;
object rob;
# ifdef PSYC_PATH
if (abbrev("S:psyc:", file)) {
rob = clone_object(PSYC_PATH "server");
D2(if (rob) PP(("NAMED CLONE: %O => %s\n", rob, file));)
return rob;
}
if (abbrev("psyc:", file)) {
rob = clone_object(PSYC_PATH "active");
D2(if (rob) PP(("NAMED CLONE: %O => %s\n", rob, file));)
return rob;
}
# endif
# ifdef SPYC_PATH
if (abbrev("S:psyc:", file)) {
rob = clone_object(SPYC_PATH "server");
D2(if (rob) PP(("NAMED CLONE: %O => %s\n", rob, file));)
return rob;
}
if (abbrev("psyc:", file)) {
rob = clone_object(SPYC_PATH "active");
D2(if (rob) PP(("NAMED CLONE: %O => %s\n", rob, file));)
return rob;
}
# endif
# ifdef HTTP_PATH
// match both http:/ and https:/ objects ;D
if (abbrev("http", file)) {
rob = clone_object(HTTP_PATH "fetch");
if (rob) rob->fetch(file[..<3]);
return rob;
}
if (abbrev("xmlrpc:", file)) {
rob = clone_object(HTTP_PATH "xmlrpc");
if (rob) rob->fetch("http://" + file[7..<3]);
return rob;
}
# endif
if (sscanf(file, "%s#%s.c", path, name) && name != "") {
// my function in simul_efun
unless (name = SIMUL_EFUN_FILE->legal_name(name)) return (object)0;
rob = clone_object(path);
rob -> sName(name);
D2(if (rob) PP(("NAMED CLONE: %O becomes %s of %s\n",
rob, name, path));)
return rob;
}
if (sscanf(file, "place/%s.c", name) && name != "") {
#ifdef SANDBOX
string t;
#endif
// my function in simul_efun
unless (name = SIMUL_EFUN_FILE->legal_name(name)) return (object)0;
#ifdef SANDBOX
if (file_size(t = USER_PATH + name + ".c") != -1) {
rob = t -> sName(name);
D2(if (rob) PP(("USER PLACE loaded: %O becomes %O\n", rob, file));)
} else {
#endif
#ifdef _flag_disable_places_arbitrary
P2(("WARN: cloned places disabled by #define %O\n", file))
return (object)0;
#else
#ifdef _path_archetype_place_default
rob = clone_object(_path_archetype_place_default);
#else
rob = clone_object(NET_PATH "place/default");
#endif
rob -> sName(name);
D2(if (rob) PP(("PLACE CLONED: %O becomes %O\n", rob, file));)
#endif
#ifdef SANDBOX
}
#endif
return rob;
}
if (sscanf(file, "%s/text.c", path) && path != "") {
rob = clone_object(NET_PATH "text");
rob -> sPath(path);
D2(if (rob) PP(("DB CLONED: %O becomes %s/text\n", rob, path));)
return rob;
}
# ifdef JABBER_PATH
if (abbrev("S:xmpp:", file)) {
rob = clone_object(JABBER_PATH "gateway");
D2(if (rob) PP(("NAMED CLONE: %O => %s\n", rob, file));)
return rob;
}
if (abbrev("C:xmpp:", file)) {
rob = clone_object(JABBER_PATH "active");
D2(if (rob) PP(("NAMED CLONE: %O => %s\n", rob, file));)
return rob;
}
# endif
P0(("WARN: could not create %O\n", file))
return (object)0;
}
#endif

View File

@ -84,4 +84,7 @@
#define TLS_HASH_MD5 (6)
#define TLS_HASH_RIPEMD160 (7)
/* autodetect feature: when no TLS is found on socket, this code is returned */
#define ERR_TLS_NOT_DETECTED -31337
#endif /* LPC_TLS_H */

View File

@ -1,4 +1,4 @@
// $Id: interface.h,v 1.31 2008/04/09 16:49:23 lynx Exp $ // vim:syntax=lpc:ts=8
// $Id: interface.h,v 1.32 2008/04/18 13:34:38 lynx Exp $ // vim:syntax=lpc:ts=8
// several things in here do not look like they were optimized for pike.. TODO
#define _INCLUDE_INTERFACE_H
@ -128,6 +128,15 @@
#define to_string(XXX) ((string) XXX)
#define to_int(XXX) ((int) XXX)
// ... this stuff may want to be done in a more pikey way
// extracts hh:mm:ss format from ctime output
#define hhmmss(CTIME) CTIME[11..18]
// extracts hh:mm format from ctime output (for idle times)
#define hhmm(CTIME) CTIME[11..15]
// typical timestamp string: hhmm or iso-date if older than 24 hours
#define time_or_date(TS) \
(time() - TS > 24*60*60 ? isotime(TS, 0) : hhmm(ctime( TS )))
// TODO *** stuff that needs to be solved better *** //
#define interactive(ME) ME
//#define find_service(NAME) 0

View File

@ -1,5 +1,5 @@
// vim:foldmethod=marker:syntax=lpc:noexpandtab
// $Id: circuit.c,v 1.104 2008/03/29 20:05:32 lynx Exp $
// $Id: circuit.c,v 1.107 2008/07/04 18:37:21 lynx Exp $
//
// net/circuit - generic circuit manager
//
@ -16,6 +16,12 @@
// also.. maybe one day this object will take care of _context
// optimizations.. just maybe.. maybe the places will do..
// local debug messages - turn them on by using psyclpc -DDcircuit=<level>
#ifdef Dcircuit
# undef DEBUG
# define DEBUG Dcircuit
#endif
#if defined(DEBUG) && DEBUG > 1
# define CONNECT_RETRY 2 // seconds for testing
#else
@ -77,7 +83,7 @@ void reconnect() {
if (ISSYNC || retry++ < MAX_RETRY) {
waitforme = waitforme * 2 + random(waitforme);
call_out(#'connect, waitforme);
P1(("%O trying to reconnect in %d secs\n", ME, waitforme))
P2(("%O trying to reconnect in %d secs\n", ME, waitforme))
return;
}
connect_failure("_repeated",
@ -89,7 +95,7 @@ void pushback(string failmc) {
mixed *t, o;
mapping vars;
P1(("%O pushback of queue(%O) (size %O).\n", failmc, me, qSize(me)))
P2(("%O pushback of queue(%O) (size %O).\n", failmc, me, qSize(me)))
while(qSize(me) && (t = shift(me))) {
// is it okay to append pushback mc?
// or should we even append the mc of the respective message!?
@ -115,7 +121,7 @@ void pushback(string failmc) {
if (t[1] == mc) {
// this happens when the place is stupid enough to
// castmsg the failure.
P0(("%O caught attempt to resend %O to %O || %O\n",
P1(("%O caught attempt to resend %O to %O || %O\n",
ME, mc, o, t[0]))
} else sendmsg(o || t[0], mc, // ok, should this message really
// have its original target as
@ -151,6 +157,8 @@ void pushback(string failmc) {
// P2(("%O qDel(%O) and autodestruct\n", ME, me))
qDel(me); // not sure if this is necessary but looks safer
destruct(ME);
// alright. so this is where we want to do something
// differently, like remember that this host didn't work. TODO
}
// wouldn't it be nicer to also pass real vars here?
@ -162,7 +170,7 @@ void connect_failure(string mc, string reason) {
int msg(string source, string method, string data,
mapping vars, int showingLog, mixed target) {
P0(("%O:msg() shouldn't get called. overload me!\n", ME))
P1(("%O:msg() shouldn't get called. overload me!\n", ME))
return 0;
}
@ -172,7 +180,7 @@ circuit(ho, po, transport, srv, whoami, sysQ, uniform) {
// happens apparently when a racing condition occurs
// during upgrade from xmpp to psyc.. hm! queue fails
// to deliver in that case and waits for next chance TODO
P0(("%O loaded twice for %O and %O\n", ME, me, whoami))
P1(("%O loaded twice for %O and %O\n", ME, me, whoami))
return ME;
}
q = mappingp(sysQ) ? sysQ : system_queue();
@ -196,7 +204,7 @@ circuit(ho, po, transport, srv, whoami, sysQ, uniform) {
// who needs this? who calls this? /rm and derivatives. shutdown() too.
// net/psyc/active because net/psyc/server has its own
quit() {
P1(("%O quit.\n", ME))
P2(("%O quit.\n", ME))
remove_interactive(ME);
//destruct(ME);
}
@ -205,7 +213,7 @@ runQ() {
mixed *t, source;
D2(unless (me) raise_error("unitialized circuit\n");)
P2(( "%O runQ of size %O\n", ME, qSize(me)))
P3(( "%O runQ of size %O\n", ME, qSize(me)))
// causes an exception when q is too big
P4(( "%O\n", q))
while (qSize(me) && (t = shift(me))) {
@ -231,7 +239,7 @@ runQ() {
connect(ho, po, transport, srv) {
if (interactive()) return -8;
P2(("connect: %O, %O, %O, %O for %O\n", ho, po, transport, srv, ME))
P3(("connect: %O, %O, %O, %O for %O\n", ho, po, transport, srv, ME))
if (time() < time_of_connect_attempt + waitforme) return -2;
if (ho) { // paranoid: stringp(ho) && strlen(ho)) {
if (po) port = po;
@ -242,7 +250,7 @@ connect(ho, po, transport, srv) {
} else
#endif
host = lower_case(ho);
P1(("connect.%s:\t%O, %O, %O\t%O\n", srv || "to",
P2(("connect.%s:\t%O, %O, %O\t%O\n", srv || "to",
ho, po, transport, ME))
}
#ifndef ERQ_WITHOUT_SRV
@ -287,13 +295,13 @@ varargs int enqueue(mixed source, string method, string data,
// with a context *instead* of a source, so it's pointless to complain...
//
// unless (vars["_source"]) {
// P0(("tell lynX: enqueue without _source for %O from %O in %O\n",
// P1(("tell lynX: enqueue without _source for %O from %O in %O\n",
// method, source, ME))
// //vars["_source"] = psyc_name(source);
// raise_error("tell lynX where it happened!!\n");
// }
#endif
P3(("enqueue for %O\n", source))
P4(("enqueue for %O\n", source))
connect(); // will only connect if we once had been connected before
return ::enqueue(me, ({ source, method, data, vars, target, mvars }) );
}

View File

@ -1,8 +1,15 @@
// $Id: connect.c,v 1.49 2008/03/29 20:05:32 lynx Exp $ // vim:syntax=lpc
// $Id: connect.c,v 1.54 2008/12/10 22:53:33 lynx Exp $ // vim:syntax=lpc
//
// net/connect: generic handler for active connections
// most methods are intended for overloading except for the connect2()
//
// local debug messages - turn them on by using psyclpc -DDconnect=<level>
#ifdef Dconnect
# undef DEBUG
# define DEBUG Dconnect
#endif
#include <net.h>
#include <errno.h>
@ -24,9 +31,14 @@ protected connect_failure(mc, text) {
protected int logon(int failure) {
if (is_connecting == "s") {
is_connecting = 0;
P1(("%O connected to %O from %O. TLS requested.\n", ME,
#if __EFUN_DEFINED__(tls_init_connection)
P2(("%O connected to %O from %O. TLS requested.\n", ME,
query_ip_number(ME), query_mud_port(ME)))
tls_init_connection(ME, #'logon);
#else
connect_failure("_unsafe", "security not available");
return 0;
#endif
}
is_connecting = 0;
if (failure == -1 || !interactive(ME)) {
@ -54,6 +66,9 @@ protected int logon(int failure) {
#endif
unless (hostCheck(query_ip_number(ME), query_mud_port(ME)))
return block();
#if __EFUN_DEFINED__(enable_telnet)
enable_telnet(0, ME);
#endif
return 1;
}
@ -77,7 +92,7 @@ protected canonical_host(cane, ip, host) {
private connect2(ip, port, host) {
int rc;
P2(("%O connect2(%O, %O, %O) == %O\n", ME, ip, port, host, chost(ip)))
P3(("%O connect2(%O, %O, %O) == %O\n", ME, ip, port, host, chost(ip)))
unless (stringp(ip)) {
connect_failure("_resolve", host+" does not resolve");
return;
@ -97,11 +112,11 @@ private connect2(ip, port, host) {
return;
}
#if __EFUN_DEFINED__(net_connect)
P2(("REALLY calling net_connect(%O, %O)\n", ip, port))
P3(("REALLY calling net_connect(%O, %O)\n", ip, port))
rc = net_connect(ip, port);
switch(rc) {
case 0:
P2(("%O connecting(%O, %O, %O) == %O\n",
P3(("%O connecting(%O, %O, %O) == %O\n",
ME, ip, port, host, chost(ip)))
break;
case EMFILE:
@ -151,6 +166,8 @@ connect(host, port, transport) {
}
disconnected(remaining) {
P2(("%O got disconnected(%O). it was %s connected.\n", ME, remaining,
query_once_interactive(ME) ? "once" : "never"))
connect_failure("_disconnect", "lost connection");
return 0; // unexpected
}

View File

@ -1,5 +1,5 @@
// vim:foldmethod=marker:syntax=lpc
// $Id: entity.c,v 1.123 2008/03/29 20:05:32 lynx Exp $
// $Id: entity.c,v 1.127 2008/08/05 12:24:16 lynx Exp $
//
// entity.c: anything that has a UNI (see http://about.psyc.eu/uniform)
// this file handles some low-level issues with being an entity:
@ -12,6 +12,12 @@
// * trust network: figure out who we trust and who we can ask to find
// out if someone is trustworthy etc etc
// local debug messages - turn them on by using psyclpc -DDentity=<level>
#ifdef Dentity
# undef DEBUG
# define DEBUG Dentity
#endif
#include <net.h>
#include <storage.h>
#include <url.h>
@ -99,7 +105,7 @@ inherit NET_PATH "state";
: _memory[target] = m_allocate(0, 2))
#endif //}}}
#ifdef TRUSTINESS
#ifndef _flag_disable_module_trust
// first try to implement trust for remote ( means.. not a direct peer
// inside the friendsnet ) objects
volatile mapping _trust;
@ -275,6 +281,7 @@ msg(source, mc, data, vars) {
unless (member(vars, x)) vars[x] = y;
}
#else //FORK }}}
# ifndef _flag_disable_module_authentication
// person.c only calls this for stringp(source), so why check here again?
// because place/basic.c calls this for all sorts of sources. why this
// inconsistency? and what about local string sources? TODO
@ -351,7 +358,7 @@ msg(source, mc, data, vars) {
}
}
if (t) {
#if 1
# if 1
// we can either decide to see our own locations as source
// since that's what the code in person.c already does, we'll
// try this option first
@ -368,7 +375,7 @@ msg(source, mc, data, vars) {
// line a client can propose its own _nick and
// will be successful. hm!
}
#else
# else //{{{
// or copy them into a var, then compare everywhere
// this requires a rewrite of all of the v("locations") code
vars["_location"] = source;
@ -376,14 +383,15 @@ msg(source, mc, data, vars) {
source = t;
// don't trust what the client says
if (objectp(t)) vars["_nick"] = t->qName();
#endif
# endif //}}}
// do we really want to delete it also in the else case?
} else m_delete(vars, "_source_identification");
}
}
# endif // _flag_disable_module_authentication
#endif // !FORK
#ifdef TRUSTINESS
#ifndef _flag_disable_module_trust
// this mechanism does not work for objectp(source) because uni::msg is not
// called for objects. TODO
// this stuff works alot like _request_auth.. i still think there might be
@ -491,7 +499,7 @@ msg(source, mc, data, vars) {
"_trustiness" : trustiness ]));
}
}
#endif
#endif // _flag_disable_module_trust
return 1;
}
@ -506,7 +514,7 @@ create() {
ASSERT("entity::create() !uni2unl", !uni2unl, uni2unl)
uni2unl = ([ ]);
#endif //}}}
#ifdef TRUSTINESS
#ifndef _flag_disable_module_trust
_trust = ([ ]);
#endif
#ifdef ENTITY_STATE //{{{

View File

@ -1,4 +1,4 @@
// $Id: generic.c,v 1.36 2008/02/08 12:53:25 lynx Exp $ // vim:syntax=lpc
// $Id: generic.c,v 1.39 2008/07/12 19:48:39 lynx Exp $ // vim:syntax=lpc
//
// this is a generic robot that provides a few commands to interface
// a centralistic messaging system to the PSYC. since the commercial
@ -24,7 +24,6 @@ volatile object psycer;
volatile string joe, joe_nick;
volatile mixed joe_unl;
volatile mapping talk = ([]);
volatile closure sort_by_name;
queryLastServed() { return joe; }
@ -84,6 +83,7 @@ static help() {
reply("This gateway is operated by " WEBMASTER_EMAIL);
// " on "+ SERVER_UNL);
#endif
reply("My PSYC Identification is "+ psyc_name(ME));
// reply("Can you imagine this is the new version of the first ever IRC bot written in LPC?");
reply("Available commands: WHO, STATUS, TELL/MSG, TALK/QUERY, HELP");
}
@ -140,21 +140,17 @@ static who() {
mixed idle;
string desc;
unless (closurep(sort_by_name))
sort_by_name = lambda(({ 'a, 'b}),
({ (#',),
({ CL_NIF, ({ #'mappingp, 'a }), ({ #'return, 0 }) }),
({ CL_NIF, ({ #'mappingp, 'b }), ({ #'return, 1 }) }),
({ #'return, ({ (#'>),
({ CL_LOWER_CASE, ({ (#'||), ({ CL_INDEX, 'a, "name" }), "" }) }),
({ CL_LOWER_CASE, ({ (#'||), ({ CL_INDEX, 'b, "name" }), "" }) }),
}) })
}));
reply("--- /who of local users of "+ SERVER_UNL);
u = objects_people();
all = sizeof(u) < 23;
u = sort_array(u->qPublicInfo(all), sort_by_name);
// same code in usercmd.i
u = sort_array(u->qPublicInfo(all), (:
unless (mappingp($1)) return 0;
unless (mappingp($2)) return 1;
PT(("%O got %O vs %O\n", ME, $1, $2))
return lower_case($1["name"] || "") >
lower_case($2["name"] || "");
:) );
foreach (uv : u) if (mappingp(uv)) {
desc = uv["me"];
if (desc || all) {

View File

@ -1,5 +1,5 @@
// vim:foldmethod=marker:syntax=lpc:noexpandtab
// $Id: master.c,v 1.142 2008/02/24 16:36:59 lynx Exp $
// $Id: master.c,v 1.143 2008/04/22 22:43:56 lynx Exp $
//
// this is a simpler version of group/master, and it is actually in use
// [actual as in effectively, not current, which is the german meaning]
@ -19,6 +19,12 @@
// context delivering presence subscriptions is a "group", but it certainly
// is a "context."
// local debug messages - turn them on by using psyclpc -DDcontext=<level>
#ifdef Dcontext
# undef DEBUG
# define DEBUG Dcontext
#endif
#include <net.h>
#include <person.h>
#include <status.h>

View File

@ -1,11 +1,18 @@
// vim:foldmethod=marker:syntax=lpc:noexpandtab
// $Id: slave.c,v 1.58 2008/03/21 12:35:40 lynx Exp $
// $Id: slave.c,v 1.59 2008/04/22 22:43:56 lynx Exp $
//
// generic context slave as described in a posting to psyc-dev years ago.
// it receives the single copy of a message sent out by the group master
// and fans it out to local recipients. that's why local recipients need
// to create and join this manager when they enter a room.
//
// local debug messages - turn them on by using psyclpc -DDcontext=<level>
#ifdef Dcontext
# undef DEBUG
# define DEBUG Dcontext
#endif
#include <net.h>
#include <presence.h>

View File

@ -1,47 +1,54 @@
#include <ht/http.h>
#include <net.h>
#include <text.h>
#include <ht/http.h>
protected mapping sessions = ([ ]);
string make_session(string nick, int expiry, string jack) {
string sid;
string sid;
#ifndef TELEPHONY_EXPIRY
# define TELEPHONY_EXPIRY expiry - time()
#endif
while (sessions[sid = RANDHEXSTRING]);
sessions[sid] = ({ nick, expiry, jack });
call_out( (: return m_delete(sessions, sid); :), TELEPHONY_EXPIRY);
return sid;
while (sessions[sid = RANDHEXSTRING]);
sessions[sid] = ({ nick, expiry, jack });
call_out( (: return m_delete(sessions, sid); :), TELEPHONY_EXPIRY);
return sid;
}
mixed answer(string sid, int yesno, int thatsme, string variant) {
if (!(sid && sessions[sid])) {
return -1; // no session found
}
if (sessions[sid][1] < time()) {
return -2; // session expired
}
string ni = sessions[sid][0];
unless (thatsme) {
string mc;
object uo = find_person(ni);
if (!uo) return -3;
mc = yesno? "_notice_answer_call": "_notice_reject_call";
if (variant) mc += variant;
if (!sendmsg(uo, mc, 0, ([
"_time_expire" : to_string(sessions[sid][1]),
"_check_call" : sessions[sid][2],
"_token_call" : sid,
]))) return -4; // sendmsg failed;
}
return ni;
}
htget(prot, query, headers, qs) {
#ifdef TELEPHONY_SERVER
string sid = query["sid"];
if (!(sid && sessions[sid])) {
// no session found
return;
}
if (sessions[sid][1] < time()) {
// session expired
return;
}
string ni = sessions[sid][0];
string t = query["thats"];
mixed ni = answer(sid, !query["reject"], t, "_click");
unless (t) {
object uo = find_person(ni);
if (!uo || !sendmsg(uo, "_notice_answer_talk_click",
"Your phone call request has been clicked upon.", ([
"_time_expire" : to_string(sessions[sid][1]),
"_check_call" : sessions[sid][2],
"_session" : sid,
]))) {
hterror(prot, R_GATEWTIMEOUT,
"User cannot be reached.");
return 1;
}
if (intp(ni)) {
hterror(prot, R_GATEWTIMEOUT, "User cannot be reached.");
return 1;
}
htok3(prot, 0, "Expires: 0\n");
localize(query["lang"], "html");

View File

@ -1,9 +1,10 @@
// $Id: configure.c,v 1.58 2007/06/17 21:07:54 lynx Exp $ // vim:syntax=lpc
// $Id: configure.c,v 1.59 2008/04/22 22:43:56 lynx Exp $ // vim:syntax=lpc
//
// web configurator interface. does a lot of cool things for you,
// and it should always learn to do some more. if you don't need or
// like it, simply don't load it (from init.ls, or by fetching the url).
//
#include <ht/http.h>
#include <net.h>
#include <driver.h>

View File

@ -1,9 +1,9 @@
// this code contributed from symlynX webchat. currently not in use.
#include <ht/http.h>
#include <net.h>
#include <text.h>
#include <person.h>
#include <ht/http.h>
#include <url.h>
#define NO_INHERIT

View File

@ -1,3 +1,4 @@
#include <ht/http.h>
#include <net.h>
#include <text.h>
#include <person.h>
@ -16,11 +17,13 @@ htget(prot, query, headers, qs) {
} else if ((t = query["cmd"]) && strlen(t)) {
user->parsecmd(t); // htcmd?
t = "_echo_execute_web";
} else if (t = user->htDescription(prot, query, headers, qs, "")) {
} else if (t = user->htDescription(0, query, headers, qs, "")) {
P4(("result: %O\n", t))
// this is the thing!!
write(t);
return 1;
}
// show error message
localize(query["lang"], "html");
w("_HTML_head");
w(t || "_failure_unavailable_description");

View File

@ -1,11 +1,11 @@
// $Id: fetch.c,v 1.39 2008/04/09 08:29:37 lynx Exp $ // vim:syntax=lpc
// $Id: fetch.c,v 1.42 2008/12/10 22:53:33 lynx Exp $ // vim:syntax=lpc
//
// generic HTTP GET client, mostly used for RSS -
// but we could fetch any page or data with it, really
// tobij even made the object have the URL as its object name. fancy! ;)
//
#include <net.h>
#include <ht/http.h>
#include <net.h>
#include <url.h>
#include <services.h>
@ -104,6 +104,13 @@ varargs int real_logon(int arg) {
}
varargs int logon(int arg, int sub) {
// net/connect disables telnet for all robots and circuits
#if 0 //__EFUN_DEFINED__(enable_telnet)
// when fetching the spiegel rss feed, telnet_neg() occasionally
// crashes. fixing that would be cool, but why have the telnet
// machine enabled at all?
enable_telnet(0);
#endif
// when called from xmlrpc.c we can't do TLS anyway
if (sub) return ::logon(arg);
if (ssl) tls_init_connection(ME, #'real_logon);
@ -118,7 +125,11 @@ int parse_status(string all) {
sscanf(all, "%s%t%s", prot, state);
sscanf(state, "%d%t%s", http_status, http_message);
P3(("%O got %O %O from %O\n", ME, http_status, http_message, host));
// P2(("http_status %O == %O?\n", http_status, R_OK))
if (http_status != R_OK) {
monitor_report("_failure_unsupported_code_HTTP",
S("http/fetch'ing %O returned %O %O", url || ME,
http_status, http_message));
}
next_input_to(#'parse_header);
return 1;
}
@ -168,9 +179,7 @@ disconnected(remainder) {
}
break;
default:
monitor_report("_error_unknown_method_HTTP",
S("http/fetch'ing %O returned %O %O", url || ME,
http_status, http_message));
// doesn't seem to get here when HTTP returns 301 or 302. strange.
// fall thru
case R_NOTMODIFIED:
qDel(ME);

View File

@ -1,24 +1,35 @@
// vim:noexpandtab:syntax=lpc
// $Id: header.i,v 1.5 2007/10/08 11:00:31 lynx Exp $
// $Id: header.i,v 1.10 2008/08/05 12:21:33 lynx Exp $
#include <ht/http.h>
volatile int headerDone = 0;
http_ok(string prot, string type, string extra) {
string h;
string out;
// yes, this is compatible to pre-HTTP/1.0 browsers. sick, i know.
if (!prot || headerDone++) return;
h = type || extra ? htheaders(type, extra) +"\n"
out = type || extra ? htheaders(type, extra) +"\n"
: "Content-type: " DEFAULT_CONTENT_TYPE "\n\n";
emit(HTTP_SVERS " 200 Sure\n"+ h);
emit(out = HTTP_SVERS " 200 Sure\n"+ out);
P3((out))
}
varargs http_error(string prot, int code, string comment, string html) {
string out;
// apparently there isn't a single app that calls this with "html"
P2(("hterror(%O,%O,%O,%O) in %O\n", prot,code,comment,html, ME))
#if defined(GAMMA) && defined(T)
// use the textdb if available
out = psyctext( T("_PAGES_error",
"<html><title id='code'>[_code]</title>\n"
"<body><h1 id='comment'>[_comment]</h1></body></html>\n"),
([ "_comment": comment, "_code": code ]) );
#else
// use some hardcoded defaults
out = "<body text=white bgcolor=black link=green vlink=green>\n";
if (html) out = sprintf("<title>%s</title>\n%s%s", comment, out, html);
else out = sprintf("\
@ -32,11 +43,12 @@ varargs http_error(string prot, int code, string comment, string html) {
);
// <a href=\"mailto:%s?subject=%s\">%s</a>\n
//, WEBMASTER_EMAIL, comment, WEBMASTER_EMAIL
#endif
// yes, this is compatible to pre-HTTP/1.0 browsers. sick, i know.
if (!headerDone++ && prot) {
// I used to output the comment, but Id have to cut out the
// newline from the db
emit(sprintf(HTTP_SVERS " 200 Actually %03d but MSIE steals my error page\n%s\n%s", code, htheaders(), out));
emit(out = sprintf(HTTP_SVERS " 200 Actually %03d but MSIE steals my error page\n%s\n%s", code, htheaders(), out));
P3((out))
} else emit(out);
}

View File

@ -1,5 +1,5 @@
// vim:noexpandtab:syntax=lpc
// $Id: library.i,v 1.38 2008/04/08 23:12:16 lynx Exp $
// $Id: library.i,v 1.40 2008/04/27 08:20:47 lynx Exp $
//
// HTTP function library -lynx
//
@ -85,20 +85,21 @@ void htrequireauth(string prot, string type, string realm) {
}
}
varargs string htredirect(string prot, string target, string comment, int permanent) {
varargs string htredirect(string prot, string target, string comment, int permanent, string extra) {
if (!comment) comment = "Check this out";
if (!target) target = "/";
if (!extra) extra = "";
if (prot) {
printf("%s %d %s\n%s", HTTP_SVERS,
permanent ? R_MOVED : R_FOUND, comment, htheaders());
}
printf("\
Location: %s\n\
Location: %s\n%s\
\n\
<a href=\"%s\">%s</a>.\n\
",
target, target, comment);
target, extra, target, comment);
return 0;
}

View File

@ -1,3 +1,4 @@
#include <ht/http.h>
#include <net.h>
#include <text.h>
#include <person.h>
@ -15,7 +16,13 @@ htget(prot, query, headers, qs) {
} else {
PT(("replacing cookie %O\n", headers["cookie"]))
htok3(prot, 0, "Set-Cookie: psyced=\""+ qs +"\";\n");
#ifdef GAMMA
// login was supposed to something more than just /surf
// but until this is the case, why lose time?
return NET_PATH "http/examine"->htget(0, query, headers, qs);
#else
t = "_PAGES_login";
#endif
}
htok3(prot, 0, "Expires: 0\n");
localize(query["lang"], "html");

View File

@ -1,9 +1,8 @@
// this code contributed from symlynX webchat. currently not in use.
#include <ht/http.h>
#include <net.h>
#include <text.h>
#include <ht/html.h>
#include <ht/http.h>
#include <person.h>
volatile string nick;
@ -18,22 +17,20 @@ htget(prot, query, headers, qs) {
localize(query["lang"], "ht");
htok(prot);
write (hthead("modifying "+nick+"'s settings") + htfs_on "<th>");
write (hthead("modifying "+nick+"'s settings"));
unless (nick) {
write( T("_PAGES_register_nickless", "Who are you?")
+ htfs_off);
write( T("_PAGES_register_nickless", "Who are you?") );
return 1;
}
unless (user = find_person(nick)) {
write( T("_PAGES_register_offline",
"You're not in the chat?<br>Please enter it.")
+ T("_HTML_back", "") + htfs_off );
+ T("_HTML_back", "") );
return 1;
}
unless (user -> validToken(query["token"])) {
write( T("_error_invalid_authentication_token",
"Invalid token. Please log in anew.")
+ htfs_off);
"Invalid token. Please log in anew."));
return 1;
}
okay = 1;
@ -103,9 +100,9 @@ htget(prot, query, headers, qs) {
#endif
write( T("_PAGES_edit_stored",
"Settings successfully stored.")
+ T("_HTML_back", "") + htfs_off );
+ T("_HTML_back", "") );
} else
write( T("_HTML_back", "") + htfs_off );
write( T("_HTML_back", "") );
return 1;
}

View File

@ -1,212 +1,213 @@
// $Id: profile.c,v 1.2 2007/04/11 13:48:57 lynx Exp $ vim:syntax=lpc
//
// <kuchn> profile.c, a web based user settings/profile changer,
// called from net/http/server.
//
// TODO: please make use of the new convert_profile(vars, 0, "set") and
// convert_profile(settings, "set", 0) to convert a mapping of settings
// into a mapping of PSYC variables and back. this should make a lot of
// code in here unnecessary. avoiding replication is g00000d.
//
// i'm unhappy with the way of authing.. first i thought this could be
// inherited somehow to be a part of the user object, but thats schmarn.
// but i think psyc auth would be a nice way here..
// using checkPassword() the way you do is fine! we are not planning
// to use a web-based editor for remote PSYC items.. and the
// asynchronicity of it isn't something HTTP can easily handle.
// HTTP isn't as cool as PSYC you know? hahahahahahahahahahah
// as long as this is in development it could cause security breaches
// in production servers. so please only use this on experimental servers.
#ifdef EXPERIMENTAL
#include <net.h>
#include <text.h>
#include <person.h>
object user;
create() {
sTextPath(0, 0, "html");
}
htget(prot, query, headers, qs) {
htok3(prot, "text/html", "Cache-Control: no-cache\n");
w("_PAGES_user_header");
auth(prot, query, headers, qs);
}
checkAuth(val, prot, query, headers, qs, user) {
if(! val)
{
w("_PAGES_user_login_failed");
return;
}
w("_PAGES_user_header");
switch(query["action"]) {
case "settings":
if(query["set"] == "1")
settings(prot, query, headers, qs, user);
else
w("_PAGES_user_settings_body", ([
"_username" : query["username"],
"_password" : query["password"],
"_speakaction" : user->v("speakaction") ? user->v("speakaction") : "",
"_commandcharacter" : user->v("commandcharacter") ? user->v("commandcharacter") : ""
]) );
break;
case "profile":
if(query["set"] == "1")
profile(prot, query, headers, qs, user);
else
w("_PAGES_user_profile_body", ([
"_username" : query["username"],
"_password" : query["password"],
"_me" : user->v("me") ? user->v("me") : "",
"_publicpage" : user->v("publicpage") ? user->v("publicpage") : "",
"_publictext" : user->v("publictext") ? user->v("publictext") : "",
"_publicname" : user->v("publicname") ? user->v("publicname") : "",
"_animalfave" : user->v("animalfave") ? user->v("animalfave") : "",
"_popstarfave" : user->v("popstarfave") ? user->v("popstarfave") : "",
"_musicfave" : user->v("musicfave") ? user->v("musicfave") : "",
"_privatetext" : user->v("privatetext") ? user->v("privatetext") : "",
"_likestext" : user->v("likestext") ? user->v("likestext") : "",
"_dislikestext" : user->v("dislikestext") ? user->v("dislikestext") : "",
"_privatepage" : user->v("privatepage") ? user->v("privatepage") : "",
"_email" : user->v("email") ? user->v("email") : "",
"_color" : user->v("color") ? user->v("color") : "",
"_language" : user->v("language") ? user->v("language") : "",
"_telephone" : user->v("telephone") ? user->v("telephone") : ""
]) );
break;
default:
w("_PAGES_user_index", ([ "_username" : query["username"], "_password" : query["password"] ]));
break;
}
w("_PAGES_user_footer");
}
auth(prot, query, headers, qs) {
if(! stringp(query["username"]) || ! stringp(query["password"]))
{
w("_PAGES_user_login_body");
return 0;
}
if(query["username"] == "" || query["password"] == "")
{
w("_PAGES_user_login_empty");
return 0;
}
user = summon_person(query["username"]);
if(!user || user->isNewbie())
{
w("_PAGES_user_login_notregistered");
return 0;
}
int ok = 1;
user->checkPassword(query["password"], "plain", "", "", #'checkAuth, prot, query, headers, qs, user);
}
settings(prot, query, headers, qs, user) {
foreach(string k, string v : query) {
int ok = 0;
switch(k) {
case "password":
ok = 1;
break;
case "speakaction":
ok = 1;
break;
case "commandcharacter":
ok = 1;
break;
}
if(! ok)
continue;
if(v == "")
{
//if(v != "password")
// user->vDel(k);
// do nothing? maybe every setting is needed.. then this would be bad.
}
else
user->vSet(k, v); // password won't be set? humm.
}
w("_PAGES_user_settings_changed", ([ "_username" : query["username"], "_password" : query["password"] ]) );
}
profile(prot, query, headers, qs, user) {
foreach(string k, string v : query) {
int ok = 0;
switch(k)
{
case "me":
ok = 1;
break;
case "publicpage":
ok = 1;
break;
case "publictext":
ok = 1;
break;
case "publicname":
ok = 1;
break;
case "animalfave":
ok = 1;
break;
case "popstarfave":
ok = 1;
break;
case "musicfave":
ok = 1;
break;
case "privatetext":
ok = 1;
break;
case "likestext":
ok = 1;
break;
case "dislikestext":
ok = 1;
break;
case "privatepage":
ok = 1;
break;
case "email":
ok = 1;
break;
case "telephone":
ok = 1;
break;
}
if(! ok)
continue;
if(v == "")
user->vDel(k);
else
user->vSet(k, v);
}
w("_PAGES_user_profile_changed", ([ "_username" : query["username"], "_password" : query["password"] ]) );
}
w(mc, vars) { write(psyctext(T(mc, ""), vars)); }
#endif
// $Id: profile.c,v 1.3 2008/04/22 22:43:14 lynx Exp $ vim:syntax=lpc
//
// <kuchn> profile.c, a web based user settings/profile changer,
// called from net/http/server.
//
// TODO: please make use of the new convert_profile(vars, 0, "set") and
// convert_profile(settings, "set", 0) to convert a mapping of settings
// into a mapping of PSYC variables and back. this should make a lot of
// code in here unnecessary. avoiding replication is g00000d.
//
// i'm unhappy with the way of authing.. first i thought this could be
// inherited somehow to be a part of the user object, but thats schmarn.
// but i think psyc auth would be a nice way here..
// using checkPassword() the way you do is fine! we are not planning
// to use a web-based editor for remote PSYC items.. and the
// asynchronicity of it isn't something HTTP can easily handle.
// HTTP isn't as cool as PSYC you know? hahahahahahahahahahah
// as long as this is in development it could cause security breaches
// in production servers. so please only use this on experimental servers.
#ifdef EXPERIMENTAL
#include <ht/http.h>
#include <net.h>
#include <text.h>
#include <person.h>
object user;
create() {
sTextPath(0, 0, "html");
}
htget(prot, query, headers, qs) {
htok3(prot, "text/html", "Cache-Control: no-cache\n");
w("_PAGES_user_header");
auth(prot, query, headers, qs);
}
checkAuth(val, prot, query, headers, qs, user) {
if(! val)
{
w("_PAGES_user_login_failed");
return;
}
w("_PAGES_user_header");
switch(query["action"]) {
case "settings":
if(query["set"] == "1")
settings(prot, query, headers, qs, user);
else
w("_PAGES_user_settings_body", ([
"_username" : query["username"],
"_password" : query["password"],
"_speakaction" : user->v("speakaction") ? user->v("speakaction") : "",
"_commandcharacter" : user->v("commandcharacter") ? user->v("commandcharacter") : ""
]) );
break;
case "profile":
if(query["set"] == "1")
profile(prot, query, headers, qs, user);
else
w("_PAGES_user_profile_body", ([
"_username" : query["username"],
"_password" : query["password"],
"_me" : user->v("me") ? user->v("me") : "",
"_publicpage" : user->v("publicpage") ? user->v("publicpage") : "",
"_publictext" : user->v("publictext") ? user->v("publictext") : "",
"_publicname" : user->v("publicname") ? user->v("publicname") : "",
"_animalfave" : user->v("animalfave") ? user->v("animalfave") : "",
"_popstarfave" : user->v("popstarfave") ? user->v("popstarfave") : "",
"_musicfave" : user->v("musicfave") ? user->v("musicfave") : "",
"_privatetext" : user->v("privatetext") ? user->v("privatetext") : "",
"_likestext" : user->v("likestext") ? user->v("likestext") : "",
"_dislikestext" : user->v("dislikestext") ? user->v("dislikestext") : "",
"_privatepage" : user->v("privatepage") ? user->v("privatepage") : "",
"_email" : user->v("email") ? user->v("email") : "",
"_color" : user->v("color") ? user->v("color") : "",
"_language" : user->v("language") ? user->v("language") : "",
"_telephone" : user->v("telephone") ? user->v("telephone") : ""
]) );
break;
default:
w("_PAGES_user_index", ([ "_username" : query["username"], "_password" : query["password"] ]));
break;
}
w("_PAGES_user_footer");
}
auth(prot, query, headers, qs) {
if(! stringp(query["username"]) || ! stringp(query["password"]))
{
w("_PAGES_user_login_body");
return 0;
}
if(query["username"] == "" || query["password"] == "")
{
w("_PAGES_user_login_empty");
return 0;
}
user = summon_person(query["username"]);
if(!user || user->isNewbie())
{
w("_PAGES_user_login_notregistered");
return 0;
}
int ok = 1;
user->checkPassword(query["password"], "plain", "", "", #'checkAuth, prot, query, headers, qs, user);
}
settings(prot, query, headers, qs, user) {
foreach(string k, string v : query) {
int ok = 0;
switch(k) {
case "password":
ok = 1;
break;
case "speakaction":
ok = 1;
break;
case "commandcharacter":
ok = 1;
break;
}
if(! ok)
continue;
if(v == "")
{
//if(v != "password")
// user->vDel(k);
// do nothing? maybe every setting is needed.. then this would be bad.
}
else
user->vSet(k, v); // password won't be set? humm.
}
w("_PAGES_user_settings_changed", ([ "_username" : query["username"], "_password" : query["password"] ]) );
}
profile(prot, query, headers, qs, user) {
foreach(string k, string v : query) {
int ok = 0;
switch(k)
{
case "me":
ok = 1;
break;
case "publicpage":
ok = 1;
break;
case "publictext":
ok = 1;
break;
case "publicname":
ok = 1;
break;
case "animalfave":
ok = 1;
break;
case "popstarfave":
ok = 1;
break;
case "musicfave":
ok = 1;
break;
case "privatetext":
ok = 1;
break;
case "likestext":
ok = 1;
break;
case "dislikestext":
ok = 1;
break;
case "privatepage":
ok = 1;
break;
case "email":
ok = 1;
break;
case "telephone":
ok = 1;
break;
}
if(! ok)
continue;
if(v == "")
user->vDel(k);
else
user->vSet(k, v);
}
w("_PAGES_user_profile_changed", ([ "_username" : query["username"], "_password" : query["password"] ]) );
}
w(mc, vars) { write(psyctext(T(mc, ""), vars)); }
#endif

View File

@ -1,5 +1,6 @@
// this code contributed from symlynX webchat. currently not in use.
#include <ht/http.h>
#include <net.h>
#include <text.h>
#include <person.h>

View File

@ -1,7 +1,8 @@
// $Id: server.c,v 1.58 2008/03/11 13:42:25 lynx Exp $ // vim:syntax=lpc
// $Id: server.c,v 1.64 2008/05/13 09:51:07 lynx Exp $ // vim:syntax=lpc
//
// yes, psyced is also a web server, like every decent piece of code. ;)
//
#include <ht/http.h>
#include <net.h>
#include <server.h>
#include <text.h>
@ -20,7 +21,7 @@ parse_url(input);
parse_header(input);
devNull();
qScheme() { return "none"; }
qScheme() { return "html"; }
logon() {
D2(D("»»» New SmallHTTP user\n");)
@ -122,6 +123,7 @@ process() {
int done = 1;
// take defaults from cookie, then override by query string
// lynXism cookie behaviour, normal one is below
t = headers["cookie"];
P4(("found cookie: %O\n", t))
if (t && sscanf(t, "psyced=\"%s\"", t)) {
@ -129,6 +131,24 @@ process() {
query = parse_query(query, t);
P4(("parsed cookie: %O\n", query))
}
#ifdef GENERIC_COOKIES // we might need them someday..?
// if within the same domain other cookies are being used, like
// by including google-analytics, then we might be receiving them
// here and have no friggin' idea what they are good for.
// thus: we *need* a way to ensure a cookie is our own.
// FIXME: this is not really compliant
else if (t) {
mapping cook = ([ ]);
string k, v;
while(t && sscanf(t, "%s=%s;%t%s", k, v, t) >= 2) {
cook[k] = v;
}
if (sscanf(t, "%s=%s", k, v))
cook[lower_case(k)] = v; // case insensitive
cook[0] = headers["cookie"]; // save cookie-string
headers["cookie"] = cook;
}
#endif
if (sscanf(url, "%s?%s", file, qs)) {
P3(("got query: %O\n", qs))
query = parse_query(query, qs);

View File

@ -5,7 +5,7 @@
// i'm unhappy with the way of authing.. first i thought this could be inheriated somehow to be a part of the user object, but thats schmarn.
// but i think psyc auth would be a nice way here..
//
#include <ht/http.h>
#include <net.h>
#include <text.h>
#include <person.h>

View File

@ -1,4 +1,4 @@
// $Id: xmlrpc.c,v 1.23 2008/03/11 13:42:26 lynx Exp $ // vim:syntax=lpc
// $Id: xmlrpc.c,v 1.24 2008/04/22 22:43:14 lynx Exp $ // vim:syntax=lpc
//
// TODO: shares to much code with url fetcher
// in the ideal world this would only contain marshal/unmarshal code
@ -6,8 +6,8 @@
// possibly we can come up with an marshal/unmarshal api and use
// the same framework for xml-rpc, soap and other things
//
#include <net.h>
#include <ht/http.h>
#include <net.h>
#include <url.h>
#include <xml.h>
@ -95,7 +95,7 @@ void request(string method, mixed params, closure cb) { // TODO: errback API
int logon(int arg) {
buffer = "";
httpheaders = ([ ]);
headers = ([ ]);
http_status = 500;
// this is all not https: compatible..
@ -189,18 +189,18 @@ mixed unMarshal(XMLNode parsed) {
}
}
void disconnected(remainder) {
int disconnected(string remainder) {
mixed *args;
httpheaders["_fetchtime"] = isotime(ctime(time()), 1);
if (httpheaders["last-modified"])
modificationtime = httpheaders["last-modified"];
if (httpheaders["etag"])
etag = httpheaders["etag"]; // heise does not work with etag
headers["_fetchtime"] = isotime(ctime(time()), 1);
if (headers["last-modified"])
modificationtime = headers["last-modified"];
if (headers["etag"])
etag = headers["etag"]; // heise does not work with etag
fetched = buffer;
fheaders = httpheaders;
buffer = httpheaders = 0;
fheaders = headers;
buffer = headers = 0;
fetching = 0;
if (pointerp(args)) // no fault
funcall(callback, args...);

View File

@ -1,4 +1,4 @@
// $Id: auto.h,v 1.14 2007/09/07 09:07:32 lynx Exp $ // vim:syntax=lpc:ts=8
// $Id: auto.h,v 1.15 2008/04/18 13:34:39 lynx Exp $ // vim:syntax=lpc:ts=8
#define _INCLUDE_AUTO_H
// first identify the driver
@ -47,8 +47,3 @@
// more useful perlisms
#define chop(STRING) slice_from_end(STRING, 0, 2)
#define chomp(STRING) (char_from_end(STRING, 1) == '\n' ? chop(STRING) : STRING)
// extracts hh:mm:ss format from ctime output
#define hhmmss(CTIME) CTIME[11..18]
// extracts hh:mm format from ctime output (for idle times)
#define hhmm(CTIME) CTIME[11..15]

View File

@ -1,4 +1,4 @@
// $Id: http.h,v 1.6 2008/04/09 08:29:37 lynx Exp $ // vim:syntax=lpc:ts=8
// $Id: http.h,v 1.7 2008/04/22 22:43:56 lynx Exp $ // vim:syntax=lpc:ts=8
/*
* NAME: http.h
* DESCRIPTION: macros for HTTP
@ -38,4 +38,10 @@
# define hthead(TITLE) "<title>" CHATNAME " - "+( TITLE )+"</title>"
#endif
// local debug messages - turn them on by using psyclpc -DDhttp=<level>
#ifdef Dhttp
# undef DEBUG
# define DEBUG Dhttp
#endif
#endif

View File

@ -1,4 +1,4 @@
// $Id: net.h,v 1.142 2008/04/11 18:48:26 lynx Exp $ // vim:syntax=lpc:ts=8
// $Id: net.h,v 1.148 2008/07/26 10:54:30 lynx Exp $ // vim:syntax=lpc:ts=8
#ifndef _INCLUDE_NET_H
#define _INCLUDE_NET_H
@ -36,6 +36,41 @@
# endif
#endif
// switching to UTF-8 should work now (if you keep .fmt files disabled!)
#ifndef SYSTEM_CHARSET
# define SYSTEM_CHARSET "UTF-8"
//define SYSTEM_CHARSET "ISO-8859-15"
#endif
#if defined(SYSTEM_CHARSET) && SYSTEM_CHARSET != "UTF-8"
# define TO_UTF8(s) convert_charset((s), SYSTEM_CHARSET, "UTF-8")
# define FROM_UTF8(s) convert_charset((s), "UTF-8", SYSTEM_CHARSET)
#else
# define TO_UTF8(s) (s)
# define FROM_UTF8(s) (s)
#endif
// this stuff is so popular.. can i really put it anywhere else?
#ifndef DEFAULT_CONTENT_TYPE
# define DEFAULT_CONTENT_TYPE "text/html; charset=" SYSTEM_CHARSET
#endif
#if __EFUN_DEFINED__(stringprep)
// stringprep needs utf8 arguments
// this results in lots of conversions some of which look like
// system->utf­>system->utf. luckily UTF8 is our system charset.
// so FROM_UTF8 and TO_UTF8 are normally nullmacros (see above)
# include <idn.h>
// beware, these macros dont have error handling...
# define NODEPREP(s) FROM_UTF8(stringprep(TO_UTF8(s), STRINGPREP_XMPP_NODEPREP))
# define NAMEPREP(s) FROM_UTF8(stringprep(TO_UTF8(s), STRINGPREP_NAMEPREP))
# define RESOURCEPREP(s) FROM_UTF8(stringprep(TO_UTF8(s), STRINGPREP_XMPP_RESOURCEPREP))
#else
# define NODEPREP(s) lower_case(s)
# define NAMEPREP(s) lower_case(s)
# define RESOURCEPREP(s) (s)
#endif
#include "debug.h"
#ifdef PRO_PATH
@ -88,44 +123,10 @@
# else
# define HTTPS_URL 0 // so that you can do
// ((tls_available() && HTTPS_URL) || HTTP_URL)
// ... what about ifdef __TLS__ ?
# endif
#endif
// switching to UTF-8 should work now (if you keep .fmt files disabled!)
#ifndef SYSTEM_CHARSET
# define SYSTEM_CHARSET "UTF-8"
//define SYSTEM_CHARSET "ISO-8859-15"
#endif
#if defined(SYSTEM_CHARSET) && SYSTEM_CHARSET != "UTF-8"
# define TO_UTF8(s) convert_charset((s), SYSTEM_CHARSET, "UTF-8")
# define FROM_UTF8(s) convert_charset((s), "UTF-8", SYSTEM_CHARSET)
#else
# define TO_UTF8(s) (s)
# define FROM_UTF8(s) (s)
#endif
// this stuff is so popular.. can i really put it anywhere else?
#ifndef DEFAULT_CONTENT_TYPE
# define DEFAULT_CONTENT_TYPE "text/html; charset=" SYSTEM_CHARSET
#endif
#if __EFUN_DEFINED__(stringprep)
// stringprep needs utf8 arguments
// this results in lots of conversions some of which look like
// system->utf­>system->utf. luckily UTF8 is our system charset.
// so FROM_UTF8 and TO_UTF8 are normally nullmacros (see above)
# include <idn.h>
// beware, these macros dont have error handling...
# define NODEPREP(s) FROM_UTF8(stringprep(TO_UTF8(s), STRINGPREP_XMPP_NODEPREP))
# define NAMEPREP(s) FROM_UTF8(stringprep(TO_UTF8(s), STRINGPREP_NAMEPREP))
# define RESOURCEPREP(s) FROM_UTF8(stringprep(TO_UTF8(s), STRINGPREP_XMPP_RESOURCEPREP))
#else
# define NODEPREP(s) lower_case(s)
# define NAMEPREP(s) lower_case(s)
# define RESOURCEPREP(s) (s)
#endif
#ifdef MUD
# define NO_NEWBIES
#endif
@ -142,6 +143,10 @@
# define DEFAULT_USER_OBJECT PSYC_PATH "user"
#endif
#ifndef MAX_VISIBLE_USERS
# define MAX_VISIBLE_USERS 44
#endif
#ifndef PRO_PATH
// very specific to the way we do web applications
# define htok this_interactive()->http_ok
@ -196,18 +201,18 @@
// wir können viel herumphilosophieren was richtig wäre, aber tatsächlich
// effizienter verteilen werden wir auf kurze sicht eh nicht, so lets use this:
# define SMART_UNICAST_FRIENDS
# define NOT_EXPERIMENTAL // code that was experimental just until recently
# define SIGS
# define SWITCH2PSYC
# define WANT_S2S_TLS
# define WANT_S2S_SASL
# define TRUSTINESS
# define ENTER_MEMBERS
# define PERSISTENT_MASTERS
# define NEW_LINK
# define NEW_UNLINK
# define NEW_RENDER
# define MUCSUC
#endif
#define GAMMA // code that has left BETA and is in production use
#ifndef _flag_disable_log_hosts
# define _flag_log_hosts
@ -217,7 +222,6 @@
// fippo's brilliant single-user channel emulation for jabber MUCs
// unfortunately it provides no advantages over the old method, yet.
// would be cool to cache a member list at least! TODO
# define MUCSUC
# define PERSISTENT_SLAVES
// efine IRC_FRIENDCHANNEL // hopelessly needs more work
# ifdef HTTP_PATH
@ -240,6 +244,6 @@
#endif
// still using rawp anywhere?
#define rawp(TEXT) { P1(("rawp? "+TEXT)) emit(TEXT); }
//#define rawp(TEXT) { P1(("rawp? "+TEXT)) emit(TEXT); }
#endif

View File

@ -1,4 +1,4 @@
// $Id: person.h,v 1.27 2007/09/18 09:49:17 lynx Exp $ // vim:syntax=lpc:ts=8
// $Id: person.h,v 1.29 2008/07/26 10:54:30 lynx Exp $ // vim:syntax=lpc:ts=8
//
#ifndef _INCLUDE_PERSON_H
#define _INCLUDE_PERSON_H
@ -15,7 +15,7 @@
#define FRIEND_NICK 0
#define FRIEND_AVAILABILITY 1
#if !defined(VOLATILE) && !defined(RELAY)
#if !defined(VOLATILE) && !defined(RELAY) && !defined(_flag_disable_module_nickspace)
# define ALIASES
#endif
@ -57,6 +57,15 @@
t = time() - v("aliveTime");\
t = t < 30 ? 0 : t < 300 ? 300 : (t + random(200) - 100);
// used by myLogAppend below:
#ifndef _limit_amount_log
# define _limit_amount_log 777
#endif
#ifndef _limit_amount_log_persistent
# define _limit_amount_log_persistent 100
#endif
// should "new" become part of the lastlog.c mechanism? how?
// should we simply use timestamp of last logout? that works
// better with places for history-while-i-was-away too. TODO

View File

@ -1,5 +1,5 @@
// vim:noexpandtab:syntax=lpc
// $Id: place.gen,v 1.135 2008/04/16 16:59:41 lynx Exp $
// $Id: place.gen,v 1.137 2008/09/12 15:37:39 lynx Exp $
//
// documentation on http://about.psyc.eu/Create_Place
//
@ -56,8 +56,8 @@
# ifdef NAME
# define REDIRECT CONNECT
# ifndef CONNECT
# ifdef SERVER_URL
# define CONNECT SERVER_URL "@" NAME
# ifdef _uniform_node
# define CONNECT _uniform_node "@" NAME
# else
# define CONNECT "psyc://" SERVER_HOST "/@" NAME
# endif
@ -72,8 +72,8 @@
#ifdef SLAVE
# ifndef CONNECT
# ifdef NAME
# ifdef SERVER_URL
# define CONNECT SERVER_URL "@" NAME
# ifdef _uniform_node
# define CONNECT _uniform_node "@" NAME
# else
# define CONNECT "psyc://" SERVER_HOST "/@" NAME
# endif
@ -311,11 +311,11 @@ void create() {
P1(("PLACE %O MASTER\n", ME))
# endif
# endif
# ifdef SERVER_URL
# if CONNECT == SERVER_URL
D1(D("link [" CONNECT "] == host ["+ SERVER_URL +"]\n");)
# ifdef _uniform_node
# if CONNECT == _uniform_node
D1(D("link [" CONNECT "] == host ["+ _uniform_node +"]\n");)
# else
D1(D("link [" CONNECT "] != host ["+ SERVER_URL +"]\n");)
D1(D("link [" CONNECT "] != host ["+ _uniform_node +"]\n");)
# endif
# endif
#endif
@ -559,6 +559,11 @@ msg(source, mc, data, vars) {
# ifdef ON_ANY
ON_ANY
# endif
# ifdef ON_CONVERSE
if (abbrev("_message", mc)) {
ON_CONVERSE
}
# endif
# ifdef REDIRECT
sendmsg(source, "_failure_redirect_temporary",
"[_nick_place] is currently unable to fulfil this operation. Please direct your request to [_source_redirect]",
@ -574,11 +579,6 @@ msg(source, mc, data, vars) {
return 0;
# else
::msg(source, mc, data, vars);
# ifdef ON_CONVERSE
if (abbrev("_message", mc)) {
ON_CONVERSE
}
# endif
# endif
}
#endif

View File

@ -1,7 +1,8 @@
// $Id: presence.h,v 1.9 2007/07/25 09:57:32 lynx Exp $ // vim:syntax=lpc:ts=8
// $Id: presence.h,v 1.11 2008/07/26 10:54:30 lynx Exp $ // vim:syntax=lpc:ts=8
//
#ifndef _INCLUDE_PRESENCE_H
#define _INCLUDE_PRESENCE_H
#ifndef _flag_disable_module_presence
// similar to what is defined as "availability"
// in http://www.psyc.eu/presence
@ -22,10 +23,12 @@
#define AVAILABILITY_REALTIME 9 // as yet unused, name?
// more unused stuff from http://www.psyc.eu/presence
// see also english wording currently in net/library/share.c
#define MOOD_JUCHEI 8
#define MOOD_BASSTSCHO 6
#define MOOD_NAJA 4
#define MOOD_LEXTSMIAMOARSCHI 2
// see also english wording currently in net/library/share.c
#define MOOD_UNSPECIFIED 0
#endif // _flag_disable_module_presence
#endif

View File

@ -1,4 +1,4 @@
// $Id: proto.h,v 1.20 2007/09/30 17:06:11 lynx Exp $ // vim:syntax=lpc:ts=8
// $Id: proto.h,v 1.22 2008/05/07 10:50:29 lynx Exp $ // vim:syntax=lpc:ts=8
//
// sometimes prototypes are needed. i keep them here and include
// them also in the files that *define* the function so that the
@ -14,7 +14,9 @@
void dns_resolve(string hostname, closure callback, varargs array(mixed) extra);
void dns_rresolve(string ip, closure callback, varargs array(mixed) extra);
#endif
#ifndef hex2int
int hex2int(string hex);
#endif
varargs string isotime(mixed ctim, int long);
int legal_host(string ip, int port, string scheme, int udpflag);
#ifdef varargs
@ -37,9 +39,11 @@ string timedelta(int secs);
#else
// danny, do you really need this?
void _psyc_dns_resolve(string hostname, closure callback, varargs array(mixed) extra);
void _psyc_dns_rresolve(string ip, closure callback, varargs array(mixed) extra);
#ifndef hex2int
int _psyc_hex2int(string hex);
#endif
int _psyc_legal_host(string ip, int port, string scheme, int udpflag);
#ifdef varargs
void _psyc_log_file(string file,string str,
@ -47,11 +51,16 @@ void _psyc_log_file(string file,string str,
#else
void _psyc_log_file(string file, string str, varargs array(mixed) args);
#endif
string _psyc_make_json(mixed d);
void _psyc_monitor_report(string mc, string text);
object* _psyc_objects_people();
varargs string _psyc_psyc_name(mixed source, vastring localpart);
string _psyc_query_server_unl();
varargs mixed _psyc_sendmsg(mixed target, string mc, mixed data, mapping vars,
mixed source, int showingLog, closure callback, varargs array(mixed) extra);
varargs void _psyc_shout(mixed who, string what, string text, mapping vars);
varargs int _psyc_server_shutdown(string reason, int restart, int pass);
string _psyc_timedelta(int secs);
#endif

View File

@ -48,7 +48,18 @@
// here are the macros to implement method inheritance in a loop around
// a switch (see http://about.psyc.eu/Inheritance and "try and slice")
#ifdef EXPERIMENTAL
// changes for try/slice are so profound in some parts, that running with it
// disabled is actually more "experimental" and flaky. PSYC_TRY() is also
// used for varnames in spyc/dispatch.i, so it's not just the methods here.
#ifndef _flag_disable_inheritance_method
# if DEBUG > 1
# define PSYC_SLICE_DEBUG \
log_file("SLICE", "%s:%O slicing %O in %O\n", \
__FILE__, __LINE__, family, ME);
# else
# define PSYC_SLICE_DEBUG
# endif
# define PSYC_TRY(mc) \
family = mc; \
while (family) { \
@ -57,8 +68,7 @@
# define PSYC_SLICE_AND_REPEAT \
default: \
log_file("SLICE", "%s:%O slicing %O in %O\n", \
__FILE__, __LINE__, family, ME); \
PSYC_SLICE_DEBUG \
glyph = rmember(family, C_GLYPH_SEPARATOR_KEYWORD); \
if (glyph > 1) family = family[.. glyph-1]; \
else family = 0; \
@ -66,7 +76,6 @@
if (glyph == -4) family = 0; // got here by break;
#else
// this disables method inheritance
# define PSYC_TRY(mc) switch(mc)
# define PSYC_SLICE_AND_REPEAT
#endif

View File

@ -21,6 +21,7 @@
#define HTTPS_SERVICE 443 // http over TLS/SSL
#define SMTPS_SERVICE 465
#define NNTPS_SERVICE 563 // nntp over TLS/SSL
#define FLASHPOL_SERVICE 843 // flash crossdomain policy server
#define TELNETS_SERVICE 992
#define IRCS_SERVICE 994 // irc protocol over TLS/SSL
#define POP3S_SERVICE 995

View File

@ -6,7 +6,6 @@
virtual inherit NET_PATH "textc";
#endif
// #ifndef DEBUG
#if 1
# define T(mc, fmt) \

View File

@ -23,4 +23,5 @@
// (not provided by parse_uniform)
#define USize 15
#define UName(uniform) (uniform[UUser] || uniform[UResource][1 ..])
#endif

View File

@ -1,4 +1,5 @@
// $Id: common.c,v 1.107 2008/04/16 14:21:17 lynx Exp $ // vim:syntax=lpc
// vim:foldmethod=marker:syntax=lpc:noexpandtab
// $Id: common.c,v 1.120 2008/12/16 11:58:52 lynx Exp $
//
// common functions for IRC servers and clients (gateways)
//
@ -33,12 +34,13 @@ parse(a) {
//if (a[<1] == ' ' || a[0] == ' ')
a = trim(a, TRIM_BOTH);
// efun probably faster than doing all those checks anyway
#else
#else //{{{
// not as efficient as it could be, but we have trim() anyway
// move this into a pike macro for trim() emulation?
if (a == "") return; // first make sure there's something at all
while (a[0] == ' ') a = a[1..];
while (a[<1] == ' ') a = a[0..<2];
#endif
#endif //}}}
if (a == "") return; // don't let " \n" execute "/s"
unless (sscanf(a, ":%s %s", from, t)) t = a;
sscanf(t, "%s :%s", t, text);
@ -53,9 +55,11 @@ ircMsg(from, cmd, args, text, all) {
case "motd":
motd();
return 1;
#ifndef BETA
case "lusers":
lusers();
return 1;
#endif
case "time":
t = time();
t1 = ctime(t);
@ -111,6 +115,7 @@ motd() {
// dummerweise fiel hier im Zuge des neuen emit das '- ' flach - fippo
P3(("MOTD_FILE (%O) found\n", MOTD_FILE))
motd_file = read_file(MOTD_FILE);
P4(("MOTD = %O\n", motd_file))
emit(sreply(RPL_MOTD, ":" + motd_file));
} else
#endif
@ -132,10 +137,14 @@ motd() {
return 1;
}
#ifndef BETA
lusers() {
# ifndef _flag_disable_query_server
reply(RPL_LUSERCLIENT, ":There are " + amount_people()
+ " users on this server\n");
+ " users on this server");
# endif
}
#endif
qCharset() {}
@ -143,56 +152,47 @@ render(string mc, string data, mapping vars, mixed source) {
string template, output;
mixed t;
P0(("common:render %O %O\n", ME, data));
P3(("common:render %O %O\n", ME, data));
#if 1 // def IRCEXPERIMENTAL
template = T(mc, 0); // enable textdb inheritance
#else
template = T(mc, "");
#endif
<<<<<<< common.c
=======
#ifndef _flag_disable_stamp_time_IRC
t = vars["_time_place"] || vars["_time_log"];
// this goes thru ->v()
if (t && v("timestamp") != "off" // && abbrev("_message", mc)
&& stringp(data)) {
# ifndef GAMMA
if (stringp(t)) t = to_int(t); // we need types ;)
# endif
if (v("timestamp") == "on") {
string msa = " ";
msa[0] = 0x01; // msa's CTCP character
// should use psyctime instead of unixtime
data = msa +"TS "+ (t - PSYC_EPOCH) +msa+ data;
} else
data = "["+ hhmm(ctime(t)) +"] "+ data; // use T() ?
data = "["+ time_or_date(t) +"] "+ data; // use T() ?
P3(("%O data is %O\n", ME, data))
}
#endif
>>>>>>> 1.107
P3(("c:r pre ptext: %O %O %O %O\n", template, vars, data, source ));
output = psyctext( template, vars, data, source);
P3(("c:r 1st ptext: %O\n", output));
if (!output || output=="") return D2(D("irc/user: empty output\n"));
#ifndef _flag_disable_stamp_time_IRC
if (t = vars["_time_place"] || vars["_time_log"]) {
PT(("%O got timestamp %O\n", ME, t))
}
if (t && v("timestamp") != "off" && abbrev("_message", mc)
&& stringp(output)) {
output = v("timestamp")
? output +" ["+ hhmm(ctime(t)) +"]" // use T() ?
: output + "%TS "+ hhmm(ctime(t)) +"%";
}
#endif
#ifdef NEW_LINE
output += "\n";
#else
if (template == "") {
#ifdef PREFIXES
// der ganze prefix kram is im irc protokoll in der
// tat blödsinn.. muss ma anders machen..
# ifdef PREFIXES //{{{
if (abbrev("_prefix", mc)) return prefix = output+" ";
else
#endif
# endif //}}}
output += "\n";
}
if (output[0] == '#') output = SERVER_SOURCE + output[1..];
#endif
if (output[0] == '#') output = SERVER_SOURCE + output[1 ..];
else if (output[0] != ':') {
string t2;
@ -228,12 +228,11 @@ render(string mc, string data, mapping vars, mixed source) {
log_file("IRC_TEXTDB", "%O\n", mc);
return;
}
// _silent: when casts from a conversation-filtered place
// arrive, which isnt known to the client as a channel, we
// revert to personal notices to not irritate it.
if (
#ifdef NOT_EXPERIMENTAL
#if 1
// would be nicer to check if source is a place but
// isn't trivial right here.. looks like joining remote
// xmpp: mucs is affected by this change - you may not
@ -275,13 +274,16 @@ render(string mc, string data, mapping vars, mixed source) {
"_members" : vars["_nick_me"] ]));
w(mc[..<8] + "_end", 0, vars);
}
P4(("calling emit(%O)\n", output));
emit(output);
}
// server:w() doesnt call this anyway, so we dont need last_prefix
//volatile private string last_prefix;
emit(string output) {
//PT(("common:emit %O %O\n", ME, output));
string* outlines;
P3(("common:emit %O %O\n", ME, output));
// misteries of virtual inheritance.. why doesnt this get called
// from gatebot? we need to get this working for 512-split!!
#ifdef _flag_log_sockets_IRC
@ -296,25 +298,37 @@ emit(string output) {
P4(("output in %O = %O\n", cs, output))
}
#endif
if (output[<1] != '\n')
return EMIT(output);
if (strlen(output) < MAX_IRC_BYTES)
return EMIT(chomp(output) + "\r\n");
else {
if (output[<1] != '\n') {
// this is used when prompting for password
P4(("irc:emit optimized for prefix on %O\n", output))
return EMIT(output);
}
outlines = explode(slice_from_end(output, 0, 2), "\n");
if (sizeof(outlines) == 1 && strlen(output) < MAX_IRC_BYTES) {
// optimized for single line
P4(("irc:emit single %O\n", outlines[0]))
return EMIT(outlines[0] + "\r\n");
} else {
string split_prefix, line;
int cut, t;
cut = strstr(output, " :");
P3(("IRC:emit splitting large line at %O\n%O\n", cut, output))
P4(("IRC:emit splitting large line at %O\n%O\n", cut, outlines))
if (cut >= 0) {
split_prefix = output[..++cut];
output = output[++cut..<2];
if (output[0] == output[<1] && output[0] == 0x01) {
output = chop(output);
split_prefix = outlines[0][.. ++cut];
#if 0 // annoying rendering bug we had here.. but is <2 always wrong?
outlines[0] = outlines[0][++cut .. <2];
#else
outlines[0] = outlines[0][++cut .. <1];
#endif
if (strlen(outlines[0])
&& outlines[0][0] == outlines[0][<1]
&& outlines[0][0] == 0x01) {
outlines[0] = chop(outlines[0]);
}
} else {
split_prefix = ""; //last_prefix;
output = chop(output);
outlines[0] = chop(outlines[0]);
}
// because of additional \\\r\n we have to subtract 3
cut = MAX_IRC_BYTES-3 - strlen(split_prefix);
@ -324,10 +338,9 @@ emit(string output) {
"to be able to do 512 splitting\n%O\n", ME, line))
return;
}
foreach(line : explode(output, "\n")) if (strlen(line)) {
// maybe we should just throw away everything beyond
foreach(line : outlines) if (strlen(line)) {
while (strlen(line) > cut) {
#ifdef NOT_EXPERIMENTAL
#if 1
// we shall look for last whitespace instead
t = rindex(line, ' ', cut);
if (t > 9) {
@ -337,12 +350,14 @@ emit(string output) {
// any realistic ideas
// how to do do this
// just once?
P4(("splitting an msa line %O\n", line[.. t]))
EMIT(split_prefix + line[..t]
+ line[0..0] + "\r\n");
line = line[t+1..];
line = line[t+1 ..];
} else {
EMIT(split_prefix + line[..t]+ "\r\n");
line = line[t+1..];
P4(("time for %O\n", line[.. t]))
EMIT(split_prefix + line[.. t]+ "\r\n");
line = line[t+1 ..];
}
} else {
P1(("%O encountered data w/out ' ' to "
@ -353,7 +368,7 @@ emit(string output) {
// we might aswell use the old
// backslash splitting code below here
}
#else
#else //{{{
t = line[cut] == '\r' ? cut-1 : cut;
// msa's CTCP character
@ -371,8 +386,9 @@ emit(string output) {
+ "\\\r\n");
line = line[cut+1..];
}
#endif
#endif //}}}
}
P4(("irc:emit each %O\n", line))
EMIT(split_prefix + line +"\r\n");
}
}

View File

@ -1,10 +1,11 @@
// $Id: decode.c,v 1.28 2008/01/21 10:25:12 lynx Exp $ // vim:syntax=lpc
// $Id: decode.c,v 1.30 2008/07/28 20:30:48 lynx Exp $ // vim:syntax=lpc
//
// generic CTCP implementation, also includes color code filter.
// msa (Markku Savela, if i remember the spelling right) came up
// with the crazy idea of using binary code 1 as the escape code
// for CTCP, so we put that code into the variable msa.
//
#include "irc.h"
#include <net.h>
volatile string msa, msare, cc, bc, uc;
@ -45,7 +46,7 @@ version(text, target, req, srcnick, source) {
sendmsg(target, "_request_version",
"[_nick] requests your version.",
([ "_nick" : srcnick ]), source );
#ifndef NO_IRC_AUTO_REQUEST_VERSION
#ifndef _flag_disable_request_version_IRC
} else if (target == query_server_unl()) {
if (text) vSet("agent", text);
#endif

View File

@ -1,4 +1,4 @@
// $Id: gatebot.c,v 1.146 2008/03/11 13:42:26 lynx Exp $ // vim:syntax=lpc
// $Id: gatebot.c,v 1.151 2008/09/12 15:37:39 lynx Exp $ // vim:syntax=lpc
//
// the PSYC-IRC gateway robot.
// based on the ircbot.c in Nemesis that i wrote in 1992. -lynX
@ -33,12 +33,11 @@
// deal with when something needs to be fixed. Having two implementations
// of the same thing wouldn't be what we want, anyway.
#include <net.h>
#include "gatebot.h"
#include <status.h>
#include <services.h>
#include <text.h>
#include <url.h>
#include "gatebot.h"
#include "error.h" // gets numeric codes
#include "reply.h" // gets numeric codes
@ -49,12 +48,12 @@ inherit IRC_PATH "decode";
// message queueing and automatic reconnect mgmt
inherit NET_PATH "circuit";
#ifndef SERVER_URL
# define SERVER_URL query_server_unl()
#ifndef _uniform_node
# define _uniform_node query_server_unl()
#endif
#ifdef RELAY
# define IRCER_UNIFORM(NICK) (SERVER_URL +"~"+ NICK)
# define IRCER_UNIFORM(NICK) (_uniform_node +"~"+ NICK)
#else
// will upgrade to irc: syntax..
# define IRCER_UNIFORM(NICK) (MYLOWERNICK +":"+ NICK)
@ -231,7 +230,7 @@ render(mc, data, vars, source) {
// return;
// }
// string ircsrc = (u[UScheme] || "xmpp") +";"+
// (u[UUser] || u[UResource][1..]) +"|"+
// (UName(u) +"|"+
// replace(u[UHost], ".", "_");
if (source) {
advertise(source);
@ -398,7 +397,7 @@ case RPL_LUSERCLIENT:
from+": "+text);
break;
case RPL_NAMREPLY:
names = text; namesfrom = from; namesto = a[3];
names = text; namesfrom = from; namesto = a[3][1 ..];
#ifdef CHAT_CHANNEL
castmsg(ME, "_notice_place_members_IRC",
"On [_nick_place_IRC]: [_members_IRC]",
@ -662,10 +661,10 @@ logon(failure) {
# endif
// leave login procedure to place.gen
#else
emit("NICK "+ IRCGATE_NICK +"\nUSER "+ IRCGATE_USERID
+" . . :"+ IRCGATE_NAME +"\n"
emit("NICK "+ IRCGATE_NICK +"\r\nUSER "+ IRCGATE_USERID
+" . . :"+ IRCGATE_NAME +"\r\n"
#ifdef IRCGATE_HIDE
+"MODE "+ IRCGATE_NICK +" +i\n"
+"MODE "+ IRCGATE_NICK +" +i\r\n"
#endif
);
#endif

View File

@ -1,4 +1,4 @@
// $Id: ghost.c,v 1.8 2007/08/27 16:54:13 lynx Exp $
// $Id: ghost.c,v 1.9 2008/04/24 15:19:36 lynx Exp $
//
// <lynX> ghost users serve the purpose of implementing all the features of
// a PSYC/Jabber identity for users of an IRC network whose identities are
@ -15,7 +15,7 @@ volatile object relay;
#include "user.c"
emit(string output) {
protected int emit(string output) {
unless (relay) {
//relay = RELAY_OBJECT -> load();
relay = find_object(RELAY_OBJECT);

View File

@ -1,5 +1,11 @@
// $Id: irc.h,v 1.17 2008/01/16 10:59:30 lynx Exp $ // vim:syntax=lpc
//
// $Id: irc.h,v 1.19 2008/08/11 09:13:12 lynx Exp $ // vim:syntax=lpc
// local debug messages - turn them on by using psyclpc -DDirc=<level>
#ifdef Dirc
# undef DEBUG
# define DEBUG Dirc
#endif
#include <net.h>
#ifndef NO_INHERIT
@ -31,3 +37,4 @@ inherit IRC_PATH "common";
#ifndef IRCD
# define IRCD D3
#endif

View File

@ -1,5 +1,5 @@
// vim:noexpandtab:syntax=lpc
// $Id: library.i,v 1.22 2007/10/08 11:00:31 lynx Exp $
// $Id: library.i,v 1.25 2008/08/23 19:07:27 lynx Exp $
//
// this gets included into the system function library
// also known as "simul_efun" in mud-speak.
@ -14,25 +14,13 @@ volatile mapping p2i;
string psyc2irc(string mc, mixed source) {
mixed c;
#if 0
// the code below will no longer generate server notices for remote
// sources - fippo likes it better that way
if (!source || objectp(source)) source = SERVER_SOURCE;
// i bet irssi wont like the !*@* (the weird problem we had with it
// about artifical nickname changes for same ident...)
//else source = ":" + source + "!*@* ";
else source = ":" + source + " ";
#else
// unfortunately, "pidgin" displays the non-server notices in an
// very annoying manner - one new window for each friend...
// will have to postpone this change until pidgin is fixed
source = SERVER_SOURCE;
#endif
// looks like this should entirely evaporate into textdb...
unless (p2i) p2i = ([ // sorted by psyc method
"_list_places_members" : RPL_NAMREPLY,
// asking for a prompt is an error in irc protocol
"_query_password" : ERR_PASSWDMISMATCH,
"_status_place_topic" : RPL_TOPIC,
//"_error_necessary_membership" : ERR_NOSUCHCHANNEL,
"_error_unavailable_nick_place" : ERR_BANNEDFROMCHAN, // pretty close
//"_status_place_members" : RPL_NAMREPLY,
@ -50,6 +38,23 @@ string psyc2irc(string mc, mixed source) {
if (c = p2i[mc]) return SERVER_SOURCE + c;
// if (abbrev("_notice_place_enter", mc)) c = "JOIN";
// else if (abbrev("_notice_place_leave", mc)) c = "PART";
#ifdef _flag_enable_notice_from_source_IRC
// the code below will no longer generate server notices for remote
// sources - fippo likes it better that way
// if (!source) source = SERVER_SOURCE;
if (!source || objectp(source)) source = SERVER_SOURCE;
// why aren't we trying to display something useful for an object here?
//
// i bet irssi wont like the !*@* (the weird problem we had with it
// about artifical nickname changes for same ident...)
//else source = ":" + source + "!*@* ";
else source = ":" + source + " ";
return source +"NOTICE";
#else
// unfortunately, "pidgin" displays the non-server notices in an
// very annoying manner - one new window for each friend...
// will have to postpone this change until pidgin is fixed
return SERVER_SOURCE +"NOTICE";
#endif
}

View File

@ -1,4 +1,4 @@
// $Id: reply.h,v 1.9 2006/01/13 20:28:57 lynx Exp $ // vim:syntax=lpc
// $Id: reply.h,v 1.10 2008/07/27 21:27:07 lynx Exp $ // vim:syntax=lpc
//
// many useful and broken numerics have been added since the IRC RFCs
@ -86,6 +86,7 @@
#define RPL_NOTOPIC "331" // determine the channel topic, one of two
#define RPL_TOPIC "332" // replies is sent. If the topic is set,
// RPL_TOPIC is sent back else RPL_NOTOPIC.
// ... we also employ "333" for delivering author and timestamp
#define RPL_INVITING "341" // Returned by the server to indicate that
// the attempted INVITE message was

View File

@ -1,4 +1,4 @@
// $Id: server.c,v 1.85 2007/11/27 16:13:41 lynx Exp $ // vim:syntax=lpc
// $Id: server.c,v 1.86 2008/10/16 13:07:13 lynx Exp $ // vim:syntax=lpc
//
// IRC protocol receptionist
//
@ -41,6 +41,7 @@ parse(a) {
if (ME) next_input_to(#'parse);
}
// allow for nickserv syntax somehow?
promptForPassword() {
// string me;
//

View File

@ -1,4 +1,5 @@
// $Id: user.c,v 1.552 2008/04/11 10:37:25 lynx Exp $ // vim:syntax=lpc
// vim:foldmethod=marker:syntax=lpc:noexpandtab
// $Id: user.c,v 1.565 2008/10/01 10:59:47 lynx Exp $
//
// server-side handler for a logged in IRC client
//
@ -36,14 +37,14 @@ msg(source, mc, data, mapping vars, showingLog) {
int special;
mixed a, res;
#ifdef PREFIXES
#ifdef PREFIXES //{{{
//ob das folgende so klug ist müssen wir (ich?) noch ergründen.
//aber da es temporär eh nicht genutzt wird...
//bis dahin erstmal jedesmal löschen.
if (prefix) {
prefix = 0;
}
#endif
#endif //}}}
P4(("irc:msg (%O,%s,%O,%O)\n", source, mc, data, vars))
P2(("irc:msg (%O,%s,%O..)\n", source, mc, data))
@ -88,11 +89,11 @@ msg(source, mc, data, mapping vars, showingLog) {
// this is partly a hack for a more generic 512-byte-length problem
// but we need a #366 end of names...
// maybe call ::msg and then return writing the 366
#ifdef ENTER_MEMBERS
#ifdef ENTER_MEMBERS //{{{
if (mc == "_status_place_members")
return _status_place_members(source, mc, data, vars);
else
#endif
#endif //}}}
if (mc == "_message_announcement") {
// what about not checking for _context and using ::msg() or even
// w()?
@ -113,7 +114,6 @@ msg(source, mc, data, mapping vars, showingLog) {
static int namreply(mapping vars) {
mixed u;
#ifdef NOT_EXPERIMENTAL
// TODO: control == silent ist eigentlich nicht richtig,
// control == keine join/part waere richtiger
// && vars["_control"] != "silent"
@ -137,7 +137,7 @@ static int namreply(mapping vars) {
// normal behaviour, when _amount is sent instead of _list
// w/o is american for without ;)
P3(("Empty or anonymous channel: %O w/o _list_members\n",
mc))
vars["_nick_place"]))
}
// this code is all weirdly redundant with net/user.c
// doing renderMembers itself in some cases, in some not -
@ -148,18 +148,6 @@ static int namreply(mapping vars) {
"_members" : u,
"_nick_me" : MYNICK ]) );
render("_status_place_members_end", 0, vars);
#else
if (pointerp(vars["_list_members_nicks"])) {
u = implode(vars["_list_members_nicks"], " "); // _tab
# ifdef _flag_encode_uniforms_IRC
u = uniform2irc(u);
# endif
w("_status_place_members", 0, ([
"_nick_place" : vars["_nick_place"],
"_members" : u ]) );
}
w("_status_place_members_end", 0, vars);
#endif
return 1;
}
@ -250,17 +238,17 @@ w(string mc, string data, mapping vars, mixed source) {
P3(("%O: irc:w(%O, %O, %O, %O) %O\n", ME, mc, data, 0, source, vars))
#ifdef PREFIXES
#ifdef PREFIXES //{{{
// completely skip these methods.. sagt fippo.. na ob das richtig ist!?
if (abbrev("_prefix", mc)) return 1;
#endif
#endif //}}}
#ifndef GHOST
// should it be..?
//unless (ONLINE) return;
unless (interactive(ME)) return;
#endif
#ifdef VARS_IS_SACRED
#ifdef VARS_IS_SACRED //{{{
// "VARS_IS_SACRED" bedeutet dass *kein* copy gemacht wurde und
// man deshalb hier paranoid sein muss. der normalfall ist, dass
// der raum uns ne kopie gibt.. ist auch gut so, denn der irc code
@ -273,7 +261,7 @@ w(string mc, string data, mapping vars, mixed source) {
// konnten ist mir ein rätsel.. aber ich habs mit eigenen augen
// gesehen.. ich kopiers sogar nach /ve/data/damaged-rendezvous.o
// ah.. der neue foreach code im place ist schuld
#else
#else //}}}
unless (mappingp(vars)) vars = ([]);
#endif
if (trail("_important", mc)) {
@ -327,7 +315,7 @@ w(string mc, string data, mapping vars, mixed source) {
return ::wAction(mc, data, vars
+ ([ "_action" : T("_TEXT_action_says", 0) ]),
source, "", vars["_nick"]);
#ifdef OLD_LOCAL_NICK_PLAIN_TEXTDB_HACK
#ifdef OLD_LOCAL_NICK_PLAIN_TEXTDB_HACK //{{{
else if (vars["_nick_local"]) { // less work
if (mc == "_message_echo_public_action"
&& (t = vars["_INTERNAL_nick_plain"])) {
@ -343,7 +331,7 @@ w(string mc, string data, mapping vars, mixed source) {
sTextPath(0, v("language"), v("scheme"));
}
}
#else
#else //}}}
else if (vars["_nick_local"] &&
vars["_nick_local"] == vars["_nick"])
vars["_nick"] = vars["_INTERNAL_nick_plain"] || vars["_nick_verbatim"];
@ -394,11 +382,12 @@ w(string mc, string data, mapping vars, mixed source) {
|| abbrev(query_server_unl() +"~", source)
#endif
) {
#ifdef GHOST
#ifdef GHOST //{{{
// in S2S mode we are not supposed to deliver nick!user@host
// thus we use plain nicks or plain uniforms
vars["_source_hack"] = vars["_INTERNAL_nick_plain"] || vars["_nick"];
#else
#else //}}}
# if 0 // OLD // according to elmex "should never happen" happened...
if (vars["_nick"]) {
vars["_source_hack"] =
(vars["_INTERNAL_nick_plain"] || vars["_nick"])
@ -407,15 +396,22 @@ w(string mc, string data, mapping vars, mixed source) {
+"@" SERVER_HOST;
} else // should never happen
vars["_source_hack"] = to_string(source);
# else // EXPERIMENTAL
nick2 = vars["_INTERNAL_nick_plain"] || vars["_nick"];
vars["_source_hack"] = nick2 ? nick2
+"!"+ (vars["_nick_long"] || vars["_INTERNAL_nick_plain"]
|| vars["_nick"]) +"@" SERVER_HOST
: to_string(source); // should never happen
# endif
} else if (abbrev("_echo_place_enter", mc)) {
vars["_source_hack"] = MYNICK + "!" + MYNICK + "@" SERVER_HOST;
#endif
} else {
#ifdef GHOST
#ifdef GHOST //{{{
// in S2S mode we are not supposed to deliver nick!user@host
// thus we use plain nicks or plain uniforms
vars["_source_hack"] = source;
#else
#else //}}}
u = parse_uniform(source);
unless (u) {
// this happens when a user@host notation gets here..
@ -431,8 +427,7 @@ w(string mc, string data, mapping vars, mixed source) {
nick2 = raliases[source];
vars["_source_hack"] = nick2 + ((u[UUser] ||
(u[UResource] && u[UResource][0]))
? "!" + (u[UUser] || u[UResource][1..])
+ "@" + u[UHost]
? "!"+ UName(u) +"@"+ u[UHost]
: "!"+ (vars["_nick_long"] || vars["_INTERNAL_nick_plain"]
|| vars["_nick"])
+"@alias.undefined");
@ -444,10 +439,10 @@ w(string mc, string data, mapping vars, mixed source) {
case "psyc":
if (u[UUser] || (u[UResource] && strlen(u[UResource])
&& u[UResource][0] == '~')) {
string tmp = UName(u);
vars["_source_hack"] = u[UScheme] + "://"
+ u[UHostPort] + "/~" + (u[UUser] || u[UResource][1..])
+ "!" + (u[UUser] || u [UResource][1..]) + "@"
+ u[UHostPort];
+ u[UHostPort] +"/~"+ tmp +"!"+ tmp +"@"
+ u[UHostPort];
P4(("w:psyc _source_hack %O\n", vars["_source_hack"]))
} else {
vars["_source_hack"] = uniform2irc(source)
@ -508,7 +503,7 @@ w(string mc, string data, mapping vars, mixed source) {
output[<2] = 0x01;
emit(output);
return 1;
# ifdef IRC_FRIENDCHANNEL
# ifdef IRC_FRIENDCHANNEL //{{{
} else {
# ifdef IRC_FRIENDCHANNEL_HEREAWAY
string old = vars["_degree_availability_old"];
@ -539,14 +534,14 @@ w(string mc, string data, mapping vars, mixed source) {
else
emit(":"+ SERVER_HOST +" MODE & -v-o "+ vars["_nick"] +"\n");
# endif
# endif
# endif //}}}
}
} else
# endif
P2(("irc/user:w(%O,%O,..,%O)\n", mc, data, source))
t = 0;
PSYC_TRY(mc) {
#ifdef IRC_FRIENDCHANNEL
#ifdef IRC_FRIENDCHANNEL //{{{
case "_list_friends_offline": // _tab
t = " "; // fall thru
case "_list_friends_away": // _tab
@ -587,7 +582,13 @@ w(string mc, string data, mapping vars, mixed source) {
reply(RPL_ENDOFNAMES, "& :End of Buddylist.");
# endif
return 1;
#endif
#endif //}}}
case "_status_place_topic":
// traditional IRC topic message without author
render(mc +"_only", 0, vars);
// extra semi-official '333' code containing author and time
render(mc +"_author", 0, vars);
return 1;
case "_status_place_members_automatic":
mc = "_status_place_members"; // fall thru
case "_status_place_members":
@ -684,13 +685,13 @@ w(string mc, string data, mapping vars, mixed source) {
"_nick_new" : vars["_alias"] ])) + "\n");
break;
#endif
#ifdef ENTER_MEMBERS //{{{
// now obsolete since net/user does the rendering of _list_members
// and converts it to _status_members* w()
#ifdef ENTER_MEMBERS
case "_echo_place_enter":
namreply(vars);
break;
#endif
#endif //}}}
case "_message_public":
case "_message":
case "_notice_place_leave":
@ -741,29 +742,25 @@ wAction(mc, data, vars, source, variant, nick) {
return ::wAction(mc, data, vars, source, variant, nick);
}
#ifndef HISTORY_AMOUNT
# define HISTORY_AMOUNT 5
#ifndef _limit_amount_history_place_default
# define _limit_amount_history_place_default 5
#endif
// irc has it's own autojoin, which is a little different from others
autojoin() {
#ifndef GHOST // too tricky for now
#if !defined(_flag_disable_place_enter_automatic) && !defined(GHOST) // too tricky for now
mixed t, t2;
#if 0 //def DRIVER_HAS_SMALL_BUFFER
int delay;
#endif
string s;
if (isService) return -1;
# ifndef GAMMA
unless (v("place"))
vSet("place", T("_MISC_defplace", DEFPLACE));
# endif
// subscriptions are stored in lowercase, warum auch immer
if (sizeof(v("subscriptions")))
foreach (s in v("subscriptions")) {
#if 0 //def DRIVER_HAS_SMALL_BUFFER
call_out(#'placeRequest, delay++, s, "_request_enter", //_automatic_subscription
0, 0, ([ "_amount_history" : HISTORY_AMOUNT ]));
#else
// call_out(#'placeRequest, delay++, s, "_request_enter", //_automatic_subscription
placeRequest(s,
# ifdef SPEC
"_request_context_enter"
@ -771,32 +768,33 @@ autojoin() {
"_request_enter"
# endif
, // _automatic_subscription
0, 0, ([ "_amount_history" : HISTORY_AMOUNT ]));
#endif
0, 0, ([ "_amount_history" : _limit_amount_history_place_default ]));
} else {
#if 0 //def DRIVER_HAS_SMALL_BUFFER
call_out(#'placeRequest, delay++, v("place"), "_request_enter_login",
0, 0, ([ "_amount_history" : HISTORY_AMOUNT ]));
#else
placeRequest(v("place"),
# ifdef SPEC
"_request_context_enter"
# else
"_request_enter"
# ifdef GAMMA
unless (v("place"))
vSet("place", T("_MISC_defplace", DEFPLACE));
# endif
# ifndef _flag_disable_place_default
// call_out(#'placeRequest, delay++, v("place"), ...
placeRequest(v("place"),
# ifdef SPEC
"_request_context_enter"
# else
"_request_enter"
# endif
"_login", 0, 0,
([ "_amount_history" : HISTORY_AMOUNT ]));
#endif
([ "_amount_history" : _limit_amount_history_place_default ]));
# endif
}
#ifdef IRC_FRIENDCHANNEL
# ifdef IRC_FRIENDCHANNEL_HEREAWAY
# ifdef IRC_FRIENDCHANNEL //{{{
# ifdef IRC_FRIENDCHANNEL_HEREAWAY
emit(":"+ MYNICK +" JOIN :&HERE\n");
emit(":"+ MYNICK +" JOIN :&AWAY\n");
# else
# else
emit(":"+ MYNICK +" JOIN :&\n");
# endif
#endif
#endif
# endif
# endif //}}}
#endif // GHOST || _flag_disable_place_enter_automatic
}
logon() {
@ -812,6 +810,13 @@ logon() {
// vDel("agent"); -- either you start a ctcp to find it out
// or we prefer to have the old info
vDel("query"); // server-side query would drive most ircers crazy
#if 0
// what's wrong with doing this.. here?
// it's redundant, as it happens again in ::logon
sTextPath(0, v("language"), v("scheme"));
// it's necessary for _request_user_amount to work
// let's see if we can simply postpone that to after ::logon
#endif
//
// this helps handle the /set visiblespeakaction setting if this
// define has changed
@ -863,11 +868,22 @@ logon() {
// SILENCE: ach und ich weiss nicht ob /quote silence bzw /silence den psyced befehl silence aufruft, aber imo sollte er das aus verwirrungs-vermeidungs-gruenden nicht tun. silence im irc ist serverseitiges ignore.
# endif
# ifndef BETA
lusers();
# endif
motd();
rc = ::logon();
// we have to do this after logon, or the textdb will fail
# ifndef NO_IRC_AUTO_REQUEST_VERSION
// the following things happen after logon, because the textdb isn't
// available earlier. if this order of things is not acceptable, then
// we have to run sTextPath twice (see above)
# ifdef BETA
# ifndef _flag_disable_query_server
sendmsg("/", "_request_user_amount", 0, ([]));
// reply.h says RPL_LUSERME is mandatory.. huh.. FIXME?
// #255 [_nick_me] :I have 4404 clients and 4404 servers
# endif
# endif
# ifndef _flag_disable_request_version_IRC
// since we cannot relay tagged version requests to the client
// easily, we request the version number once at starting time.
// any other protocol finds it completely normal to exchange
@ -995,6 +1011,7 @@ case "mode":
return 1;
case "topic":
unless (args && strlen(args)) return;
P4(("IRC topic %O %O\n", args, text))
unless (t = channel2place(args)) return;
t = find_place(t) || t;
// The topic for channel <channel> is returned if there is
@ -1022,16 +1039,30 @@ case "user":
vSet("mottotext", text);
return 1;
case "invite":
sscanf(args, "%s #%s", n, t);
// t = channel2place(t) || t;
vSet("place", t);
place = find_place(t);
P2(("irc: invite %s into %s = %O\n", n, t, place))
if (invite(n)) {
// room should send this if successful or
// ERR_USERONCHANNEL or ERR_CHANOPRIVSNEEDED otherwise?
reply(RPL_INVITING, args);
if (sscanf(args, "%s #%s", n, t) && strlen(t)) {
t2 = find_place(t);
if (!t2 || !places[t2]) {
PT(("irc: invite %s into %s = %O.\n", n, t, t2))
w("_error_necessary_membership",
0, ([ "_nick_place": t ]));
return 1;
}
vSet("place", t);
place = t2;
} else {
#if 0
// atypical: allow for invite using current place.
n = args;
// runs the risk of you inviting the person to the
// wrong channel. too risky. let's go traditional:
#else
reply(ERR_NEEDMOREPARAMS,
"INVITE :Not enough parameters");
return 1;
#endif
}
if (invite(n)) reply(RPL_INVITING, args);
// else: ERR_USERONCHANNEL or ERR_CHANOPRIVSNEEDED otherwise?
return 1;
case "join":
case "part":
@ -1153,7 +1184,7 @@ static privmsg(args, text, req) {
unless (stringp(text) && strlen(text)) return;
#ifdef EXPERIMENTAL
#ifdef GAMMA
// fippoism typing indicator.. but shouldn't it *do* something
// after detecting this CTCP-like "typing" flag hack?
if (strlen(text) > 1 && text[<1] == 0x0f && text[<2] == 0x0f) {
@ -1161,9 +1192,9 @@ static privmsg(args, text, req) {
}
#endif
if (index(args, ',') > 0) {
w("_failure_unsupported_targets_multiple",
w("_failure_unsupported_targets_multiple",
"We do not allow sending to several recipients at once. Why did your client ignore our MAXTARGETS=1 directive?");
return 0;
return 0;
}
if (room = channel2place(args)) {
if (!place || !v("place") || stricmp(room, v("place"))) {

View File

@ -1,13 +1,10 @@
// $Id: active.c,v 1.395 2008/04/01 09:38:26 lynx Exp $ // vim:syntax=lpc:ts=8
#include <net.h>
#include <sys/time.h>
#include <url.h>
// $Id: active.c,v 1.404 2008/10/26 17:24:57 lynx Exp $ // vim:syntax=lpc:ts=8
// a jabber thing which actively connects something
#define NO_INHERIT
#include "jabber.h"
#undef NO_INHERIT
#include <url.h>
#ifdef ERQ_WITHOUT_SRV
# define hostname host // hostname contains the name before SRV resolution
@ -39,9 +36,9 @@ volatile int dialback_outgoing;
tls_logon(); // prototype
#ifdef NOT_EXPERIMENTAL // not strictly necessary, but more spec conformant
// not strictly necessary, but more spec conformant
quit() {
emit("</stream:stream>");
emitraw("</stream:stream>");
#ifdef _flag_log_sockets_XMPP
D0( log_file("RAW_XMPP", "\n%O: shutting down, quit called\n", ME); )
#endif
@ -49,7 +46,6 @@ quit() {
// matter on an outgoing-only socket
//destruct(ME);
}
#endif
sGateway(gw, ho, id) {
// TODO: ho is obsolete
@ -68,7 +64,7 @@ removeGateway(gw, id) {
start_dialback() {
string source_host, key;
source_host = NAMEPREP(JABBER_HOST);
source_host = NAMEPREP(_host_XMPP);
key = DIALBACK_KEY(streamid, hostname, source_host);
P3(("%O: starting dialback from %O to %O\n", ME, source_host, hostname))
@ -137,7 +133,7 @@ handle_stream_features(XMLNode node) {
// && !config(XMPP + hostname, "_tls_invalid")
){
// may use tls unless we already do so
emit("<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");
emitraw("<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");
nodeHandler = #'handle_starttls;
return;
}
@ -177,11 +173,11 @@ handle_stream_features(XMLNode node) {
#ifndef _flag_disable_authentication_external_XMPP
if (mechs["EXTERNAL"]) {
// TODO we should check that the name in our
// certificate is equal to JABBER_HOST
// certificate is equal to _host_XMPP
// but so should the other side!
emit("<auth mechanism='EXTERNAL' "
"xmlns='" NS_XMPP "xmpp-sasl'>" +
encode_base64(JABBER_HOST)
encode_base64(_host_XMPP)
+ "</auth>");
return;
} else
@ -191,7 +187,7 @@ handle_stream_features(XMLNode node) {
PT(("jabber/active requesting to do digest md5\n"))
emit("<auth mechanism='DIGEST-MD5' "
"xmlns='" NS_XMPP "xmpp-sasl>" +
encode_base64(JABBER_HOST) +
encode_base64(_host_XMPP) +
"</auth>");
return;
@ -201,7 +197,7 @@ handle_stream_features(XMLNode node) {
#ifdef SWITCH2PSYC
else if (node["/switch"]) { // should check scheme
PT(("upgrading %O from XMPP to PSYC.\n", ME))
emit("<switching xmlns='http://switch.psyced.org'>"
emitraw("<switching xmlns='http://switch.psyced.org'>"
"<scheme>psyc</scheme>"
"</switching>");
return;
@ -235,6 +231,11 @@ disconnected(remainder) {
// nothing else happening here? no reconnect?
// TODO: what about the dialback Q if any?
::disconnected(remainder);
// let's call this a special case of good will:
// hopefully a sending side socket close operation
if (remainder == "</stream:stream>") return 1;
// we could forward remainder to feed(), but we haven't seen any other
// cases of content than the one above.
return flags & TCP_PENDING_DISCONNECT;
}
@ -259,18 +260,20 @@ static int logon(int failure) {
emit("<stream:stream xmlns:stream='http://etherx.jabber.org/streams' "
"xmlns='jabber:server' xmlns:db='jabber:server:dialback' "
"to='" + hostname + "' "
"from='" + NAMEPREP(JABBER_HOST) + "' "
"from='" + NAMEPREP(_host_XMPP) + "' "
"xml:lang='en' "
"version='1.0'>");
#ifdef NOT_EXPERIMENTAL // not strictly necessary, but more spec conformant
#if 1 // not strictly necessary, but more spec conformant
} else if (!qSize(me)) { // no retry for dialback-only
P0(("notify gateways %O of failure\n", gateways))
if (sizeof(dialback_queue) > 1) {
P0(("tell fippo that sizeof(dialback queue) was > 1\n"))
}
foreach(string id, mixed gw : gateways) {
if (objectp(gw)) {
gw->remote_connection_failed();
if (sizeof(gateways)) {
P0(("%O notifies gateways %O of failure\n", ME, gateways))
foreach(string id, mixed gw : gateways) {
if (objectp(gw)) {
gw->remote_connection_failed();
}
}
}
dialback_queue = 0;
@ -286,7 +289,8 @@ static int logon(int failure) {
#ifdef WANT_S2S_TLS
tls_logon(result) {
if (result < 0) {
PT(("%O tls_logon %d\n", ME, result))
P1(("%O tls_logon %d: %O\n", ME, result, tls_error(result) ))
// would be nice to insert the tls_error() message here.. TODO
connect_failure("_encrypt", "Problems setting up an encrypted circuit");
} else if (result == 0) {
// we need to check the certificate
@ -304,12 +308,12 @@ tls_logon(result) {
"contains %O/%O",
hostname, cert["2.5.4.3"],
cert["2.5.29.17:1.3.6.1.5.5.7.8.5"]));
#else
P1(("TLS: %s presented a certificate with unexpected identity.\n", hostname))
P2(("%O\n", cert))
#endif
#ifdef _flag_log_bogus_certificates
log_file("CERTS", S("%O %O %O id?\n", ME, hostname, cert));
#else
P1(("TLS: %s presented a certificate with unexpected identity.\n", hostname))
P2(("%O\n", cert))
#endif
#if 0 //def _flag_reject_bogus_certificates
QUIT
@ -321,12 +325,12 @@ tls_logon(result) {
monitor_report("_error_untrusted_certificate",
sprintf("%O certificate could not be verified",
hostname));
#else
P1(("TLS: %s presented untrusted certificate.\n", hostname))
P2(("%O\n", cert))
#endif
#ifdef _flag_log_bogus_certificates
log_file("CERTS", S("%O %O %O\n", ME, hostname, cert));
#else
P1(("TLS: %s presented untrusted certificate.\n", hostname))
P2(("%O\n", cert))
#endif
#if 0 //def _flag_reject_bogus_certificates
// QUIT is wrong...
@ -375,7 +379,7 @@ jabberMsg(XMLNode node) {
* Server MUST terminate both the XML stream and the
* underlying TCP connection.
*/
emit("</stream:stream>");
emitraw("</stream:stream>");
remove_interactive(ME);
connect_failure("_dialback", "dialback gone wrong");
}
@ -390,7 +394,7 @@ jabberMsg(XMLNode node) {
node["@type"]);
// probably we can delete this...
m_delete(gateways, t);
#ifdef NOT_EXPERIMENTAL // not strictly necessary, but more spec conformant
#if 1 // not strictly necessary, but more spec conformant
} else if (member(gateways, t)) {
P0(("%O found gateway for %O, but it is not an object: %O\n",
ME, t, o))
@ -413,7 +417,7 @@ jabberMsg(XMLNode node) {
emit("<stream:stream xmlns:stream='http://etherx.jabber.org/streams' "
"xmlns='jabber:server' xmlns:db='jabber:server:dialback' "
"to='" + hostname + "' "
"from='" + NAMEPREP(JABBER_HOST) + "' "
"from='" + NAMEPREP(_host_XMPP) + "' "
"xml:lang='en' "
"version='1.0'>");
authenticated = 1;
@ -435,7 +439,7 @@ jabberMsg(XMLNode node) {
data = sasl_parse(t);
PT(("extracted %O\n", data))
data["username"] = JABBER_HOST;
data["username"] = _host_XMPP;
secret = config(XMPP + hostname, "_secret_shared");
unless(secret) {
// mh... this is a problem!
@ -444,13 +448,13 @@ jabberMsg(XMLNode node) {
}
data["cnonce"] = RANDHEXSTRING;
data["nc"] = "00000001";
data["digest-uri"] = "xmpp/" JABBER_HOST;
data["digest-uri"] = "xmpp/" _host_XMPP;
response = sasl_calculate_digestMD5(data, secret, 0);
// ok, the username is our hostname
// note: qop must not be quoted, as we are 'client'
t = "username=\"" JABBER_HOST "\","
t = "username=\"" _host_XMPP "\","
"realm=\"" + data["realm"] + "\","
"nonce=\"" + data["nonce"] + "\","
"cnonce=\"" + data["cnonce"] + "\","
@ -584,7 +588,7 @@ int msg(string source, string mc, string data,
if (interactive() && ready && dialback_outgoing == 0) {
start_dialback();
}
#if JABBER_HOST == SERVER_HOST
#if _host_XMPP == SERVER_HOST
// we can only do this if mkjid patches the psyc host into jabber host
// but that is terrifically complicated and requires parsing of things
// we already knew.. so let's simply enqueue with object id and reject
@ -596,7 +600,7 @@ int msg(string source, string mc, string data,
#else
// is this a bad idea? not sure.. we'll see..
// if i don't have this here, a "tell lynX where it happened" will
// be triggered from here -- best to never use JABBER_HOST really ;)
// be triggered from here -- best to never use _host_XMPP really ;)
vars["_source"] = source;
// behaviour has changed.. so maybe we don't need this any longer TODO
#endif

View File

@ -1,9 +1,9 @@
// $Id: common.c,v 1.270 2008/04/11 10:27:24 fippo Exp $ // vim:syntax=lpc:ts=8
// $Id: common.c,v 1.276 2008/12/01 11:31:33 lynx Exp $ // vim:syntax=lpc:ts=8
#define NO_INHERIT
#include "jabber.h"
#undef NO_INHERIT
#include <net.h>
#include <net.h>
#include <text.h>
//virtual inherit NET_PATH "output";
#include <url.h>
@ -22,7 +22,7 @@ jabberMsg();
inherit NET_PATH "xml/common";
volatile string buffer = "";
closure jid_has_node_cl = (: int t, t2;
volatile closure jid_has_node_cl = (: int t, t2;
t = index($1, '@');
if (t == -1) return 0;
t2 = index($1, '/');
@ -72,6 +72,15 @@ int emit(string message) {
return ::emit(message);
}
// don't check message, use this only where you are 100% sure
// to be sending safe data
int emitraw(string message) {
#ifdef _flag_log_sockets_XMPP
D0( log_file("RAW_XMPP", "\n« %O\t%s", ME, message); )
#endif
return ::emit(message);
}
// this assumes the old ldmuddish charmode+combine-charset
// if we ever get a input_bytes it needs to be rewrittn
feed(a) {
@ -131,7 +140,7 @@ varargs string mkjid(mixed who, mixed vars, mixed ignore_context, string target
*/
string t, *u;
if (!who || who == "") return "";
unless (jabberhost) jabberhost = JABBER_HOST;
unless (jabberhost) jabberhost = _host_XMPP;
P3(("%O mkjid(%O, %O, %O, %O, %O)\n", ME, who, vars, ignore_context, target, jabberhost))
if (!ignore_context && vars && vars["_nick_place"]
&& vars["_context"]) {
@ -274,7 +283,14 @@ render(string mc, string data, mapping vars, mixed source) {
+"' from='"+ vars["_INTERNAL_source_jabber"] +"' type='"
+ (ISPLACEMSG(vars["_INTERNAL_source_jabber"]) && vars["_nick"] ?
"groupchat" : "chat")
+"'><body>"+ chomp(xmlquote(output)) +"</body></message>";
+"'><body>"+
#ifdef NEW_LINE
xmlquote(output)
#else
// was: chomp after xmlquote.. but why?
xmlquote(chomp(output))
#endif
+"</body></message>";
#if DEBUG > 1
// most of these message we are happy with, so we don't need this log
log_file("XMPP_TODO", "%O %s %s\n", ME, mc, output);
@ -384,7 +400,6 @@ certificate_check_jabbername(name, cert) {
foreach(string cn : t) {
if (NAMEPREP(cn) == name) return 1;
}
return 0;
}
else if (name == NAMEPREP(t))
return 1;

View File

@ -1,4 +1,4 @@
// $Id: component.c,v 1.68 2008/03/11 15:13:58 lynx Exp $ // vim:syntax=lpc
// $Id: component.c,v 1.72 2008/10/01 10:59:24 lynx Exp $ // vim:syntax=lpc
//
// this implements a passive listener component
#define NO_INHERIT
@ -40,7 +40,7 @@ reboot(reason, restart, pass) {
// close the stream according to XEP 0190
if (interactive(ME)) {
flags |= TCP_PENDING_DISCONNECT;
emit("</stream:stream>");
emitraw("</stream:stream>");
}
}
@ -96,7 +96,7 @@ waitfor_handshake(XMLNode node) {
PT(("%O component auth succeded as %O\n", ME, componentname))
nodeHandler = #'jabberMsg;
authenticated = 1;
emit("<handshake/>");
emitraw("<handshake/>");
onHandshake();
} else {
monitor_report("_error_invalid_password",
@ -122,7 +122,7 @@ int msg(string source, string mc, string data,
#ifdef PREFIXES
if (abbrev("_prefix", mc)) return 1;
#endif
#ifndef EXPERIMENTAL // TODO: decide if this is good or bad
#ifndef GAMMA // TODO: decide if this is good or bad
else if (abbrev("_status_person_absent", mc)) {
PT(("Intercepted absent from %O to %O\n", mc, source, ME))
return 1;
@ -172,7 +172,7 @@ open_stream(node) {
if (node["@to"]) {
packet += "from='" + node["@to"] + "' ";
} else {
packet += "from='" JABBER_HOST "' ";
packet += "from='" _host_XMPP "' ";
}
if (!config) {
/* reply with a stream error */

View File

@ -1,4 +1,4 @@
// $Id: disco.c,v 1.41 2008/01/05 13:44:38 lynx Exp $ // vim:syntax=lpc
// $Id: disco.c,v 1.43 2008/09/12 15:54:38 lynx Exp $ // vim:syntax=lpc
//
// this gets included by user.c and gateway.c. you can distinguish this
// by ifdeffing USER_PROGRAM. it may be renamed into disco.i one day.
@ -19,7 +19,9 @@ disco_info_root(vars) {
string featurelist;
featurelist = "<feature var='http://jabber.org/protocol/muc'/>"
#ifndef REGISTERED_USERS_ONLY
# ifndef _flag_disable_registration_XMPP
"<feature var='jabber:iq:register'/>"
# endif
#endif
#ifndef VOLATILE
"<feature var='msgoffline'/>"
@ -95,8 +97,8 @@ disco_items_root(vars) {
#ifdef PUBLIC_PLACES
// see also: library advertised_places()
#endif
// TODO: is it safe to use JABBER_HOST here?
vars["_list_item"] = "<item name='Chatrooms' jid='" JABBER_HOST "'/>";
// is it safe to use _host_XMPP here?
vars["_list_item"] = "<item name='Chatrooms' jid='" _host_XMPP "'/>";
}
disco_items_place(name, vars) {

View File

@ -1,4 +1,4 @@
// $Id: gateway.c,v 1.451 2008/03/29 16:07:30 fippo Exp $ // vim:syntax=lpc
// $Id: gateway.c,v 1.461 2008/10/22 16:35:59 fippo Exp $ // vim:syntax=lpc
/*
* jabber/gateway
* listens on jabber interserver port for incoming connections
@ -56,6 +56,12 @@ quit() {
disconnected(remainder) {
// TODO: handle remainder
P2(( "gateway %O disconnected\n", ME ))
#ifdef GAMMA
// sometimes we get complete presence packets in the socket close
// remainder. probably broken xmpp implementations, let's try and
// do the best we can with it by forwarding stuff to feed().
if (remainder && strlen(remainder)) feed(remainder);
#endif
if (objectp(active)) active -> removeGateway(streamid);
#ifdef _flag_log_sockets_XMPP
D0( log_file("RAW_XMPP", "\n%O disc\t%O", ME, ctime()); )
@ -85,13 +91,18 @@ void create() {
}
#ifdef WANT_S2S_TLS
// similar code in other files
tls_logon(result) {
P2(("%O tls_logon(%d)\n", ME, result))
if (result < 0) {
QUIT
}
else if (result == 0) {
if (result == 0) {
certinfo = tls_certificate(ME, 0);
P3(("%O tls_logon fetching certificate: %O\n", ME, certinfo))
# ifdef ERR_TLS_NOT_DETECTED
} else if (result == ERR_TLS_NOT_DETECTED) {
// just go on without encryption
# endif
} else if (result < 0) {
P1(("%O TLS error %d: %O\n", ME, result, tls_error(result)))
QUIT
} else {
P0(("tls_logon with result > 0?!?!\n"))
// should not happen
@ -121,7 +132,7 @@ verify_connection(string to, string from, string type) {
emit(sprintf("<db:result from='%s' to='%s' type='%s'/>",
to, from, type));
if (type != "valid") {
emit("</stream:stream>");
emitraw("</stream:stream>");
P2(("quitting invalid stream\n"))
QUIT
} else {
@ -217,7 +228,7 @@ jabberMsg(XMLNode node) {
// <?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:server' to='localhost' xmlns:db='jabber:server:dialback' version='1.0'><switching xmlns='http://switch.psyced.org'><scheme>psyc</scheme></switching>
emit("<switched xmlns='http://switch.psyced.org'/>");
emitraw("<switched xmlns='http://switch.psyced.org'/>");
PT(("received 'switching'. authhosts %O\n", authhosts))
o = ("S:psyc:" + host) -> load();
P1(("%O switching to %O for %O\n", ME, o, host))
@ -237,8 +248,8 @@ jabberMsg(XMLNode node) {
* a request for verification of a key
*/
// if we dont know the host, complain
// put NAMEPREP(JABBER_HOST) into the localhost mapping pleeeease
//if (target != NAMEPREP(JABBER_HOST)) {
// put NAMEPREP(_host_XMPP) into the localhost mapping pleeeease
//if (target != NAMEPREP(_host_XMPP)) {
unless (is_localhost(lower_case(target))) {
monitor_report("_error_unknown_host",
sprintf("%O sent us a dialback packet believing we would be %O",
@ -250,7 +261,7 @@ jabberMsg(XMLNode node) {
sendmsg(origin,
"_dialback_request_verify", 0,
([ "_INTERNAL_target_jabber" : source,
"_INTERNAL_source_jabber" : NAMEPREP(JABBER_HOST),
"_INTERNAL_source_jabber" : NAMEPREP(_host_XMPP),
"_dialback_key" : node[Cdata],
"_tag" : streamid
])
@ -296,7 +307,7 @@ jabberMsg(XMLNode node) {
/* we were calling this server, this packet is step 8
* and we are doing step 9
*/
/* if we dont recognize target (currently: == JABBER_HOST)
/* if we dont recognize target (currently: == _host_XMPP)
* then croak with a host-unknown and commit suicide
*/
// same as above...
@ -317,12 +328,15 @@ jabberMsg(XMLNode node) {
case "starttls":
#ifdef WANT_S2S_TLS
if (tls_available()) {
emit("<proceed xmlns='" NS_XMPP "xmpp-tls'/>");
emitraw("<proceed xmlns='" NS_XMPP "xmpp-tls'/>");
# if __EFUN_DEFINED__(tls_want_peer_certificate)
tls_want_peer_certificate(ME);
# endif
tls_init_connection(ME, #'tls_logon);
return;
}
#endif
emit("<failure xmlns='" NS_XMPP "xmpp-tls'/>");
emitraw("<failure xmlns='" NS_XMPP "xmpp-tls'/>");
return;
case "stream:error":
if (node["/connection-timeout"]) {
@ -351,7 +365,7 @@ jabberMsg(XMLNode node) {
success = certificate_check_jabbername(t, certinfo);
if (success) {
emit("<success xmlns='" NS_XMPP "xmpp-sasl'/>");
emitraw("<success xmlns='" NS_XMPP "xmpp-sasl'/>");
P2(("successful sasl external authentication with "
"%O\n", t))
sAuthenticated(t);
@ -377,7 +391,7 @@ jabberMsg(XMLNode node) {
encode_base64(sprintf("realm=\"%s\",nonce=\"%s\","
"qop=\"auth\",charset=utf-8,"
"algorithm=md5-sess",
JABBER_HOST, RANDHEXSTRING)
_host_XMPP, RANDHEXSTRING)
) + "</challenge>");
} else {
// kind of 'unknown username'
@ -469,7 +483,10 @@ open_stream(XMLNode node) {
if (node["@to"]) {
packet += "from='" + node["@to"] + "' ";
} else {
packet += "from='" JABBER_HOST "' ";
packet += "from='" _host_XMPP "' ";
}
if (node["@from"]) {
packet += "to='" + node["@from"] + "' ";
}
if (node["@to"] && !(is_localhost(lower_case(node["@to"])))) {
emit(packet + ">");
@ -505,7 +522,7 @@ open_stream(XMLNode node) {
// let the other side decide if it knows a shared secret
// with us
// if it it has, it will use it with digest-md5
# if __VERSION_MINOR__ > 3 || __VERSION_MICRO__ > 610
# ifndef _flag_disable_authentication_digest_MD5
if (node["@from"]
&& config(XMPP + node["@from"],
"_secret_shared")) {
@ -517,7 +534,7 @@ open_stream(XMLNode node) {
// and we have verified it as X509_V_OK (0)
// we offer SASL external (authentication via name
// presented in x509 certificate
P3(("gateway::certinfo %O\n", certinfo))
P0(("gateway::certinfo %O\n", certinfo))
if (mappingp(certinfo) && certinfo[0] == 0) {
// if from attribute is present we only offer
// sasl external if we know that it will succeed
@ -554,6 +571,6 @@ w(string mc, string data, mapping vars, mixed source) {
P2(("%O using w() for %O, unimplemented... mc %O, source %O\n",
ME, origin, mc, source))
unless (vars) vars = ([ ]);
vars["_INTERNAL_source_jabber"] = objectp(source) ? mkjid(source) : JABBER_HOST;
vars["_INTERNAL_source_jabber"] = objectp(source) ? mkjid(source) : _host_XMPP;
sendmsg(origin, mc, data, vars);
}

View File

@ -1,4 +1,4 @@
// $Id: interserver.c,v 1.12 2008/03/11 15:13:58 lynx Exp $ vim:syntax=lpc
// $Id: interserver.c,v 1.13 2008/10/01 10:59:24 lynx Exp $ vim:syntax=lpc
//
// common things for interserver jabber.. included or maybe later inherited by
// active.c and gateway.c. i am sure fippo will find some more nice things to
@ -35,7 +35,7 @@ int clean_up(int refcount) {
// and is therefore the correct way to timeout a connection.
PT(("%O cleaning up: closing stream\n", ME))
// close the stream according to XEP 0190
emit("</stream:stream>");
emitraw("</stream:stream>");
// flag says the stream is in closing phase and nothing may be
// delivered on it. but we aren't enforcing this. TODO!
flags |= TCP_PENDING_DISCONNECT;

View File

@ -1,4 +1,4 @@
// $Id: jabber.h,v 1.74 2008/03/30 10:27:49 lynx Exp $ // vim:syntax=lpc
// $Id: jabber.h,v 1.75 2008/09/12 15:54:39 lynx Exp $ // vim:syntax=lpc
//
// REMINDER:
// there are plenty of calls to lower_case in the code, that is because
@ -74,12 +74,12 @@ virtual inherit JABBER_PATH "common";
# endif
#endif
#ifndef JABBER_HOST
# define JABBER_HOST SERVER_HOST
#ifndef _host_XMPP
# define _host_XMPP SERVER_HOST
#endif
// this is not ready for is_localhost
#define is_localhost(a) (a) == JABBER_HOST
#define is_localhost(a) (a) == _host_XMPP
#define JABSOURCE "_INTERNAL_source_jabber"

View File

@ -1,5 +1,5 @@
#include <net.h> // vim:set syntax=lpc
#include "jabber.h"
#include <net.h> // vim:set syntax=lpc
#include <url.h>
#include "presence.h"
#include <time.h>
@ -48,7 +48,6 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) {
// #define MYORIGIN XMPP + su[UUserAtHost]
unless(su) su = parse_uniform(origin);
#if 1 //def NOT_EXPERIMENTAL
origin = XMPP;
if (su[UUser]) {
origin += NODEPREP(su[UUser]) + "@";
@ -59,7 +58,6 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) {
origin += "/" + RESOURCEPREP(su[UResource]);
}
su = parse_uniform(origin);
#endif
if (node["/nick"] &&
node["/nick"]["@xmlns"] == "http://jabber.org/protocol/nick" &&
node["/nick"][Cdata]) {
@ -133,7 +131,14 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) {
data = "Talking to [_nick_target] is not possible: [_text_XMPP]";
} else {
mc = "_failure_unavailable_service_talk";
data = "Talking to [_nick_target] is not possible. You may have to establish friendship first.";
// data = "Talking to [_nick_target] is not possible. You may have to establish friendship first.";
// google talk sends this quite frequently:
// * when a friendship exchange hasn't been done
// * when a friend has gone offline
// and you never know if a message has been delivered to the
// recipient just the same! so here's a more accurate error message,
// effectively giving you less information, since that's what we have here.
data = "Message to [_nick_target] may not have reached its recipient.";
}
} else if (1) { // TODO: what was that error?
PT(("gateway TODO <error> in <message>: %O\n",
@ -293,7 +298,7 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) {
} else {
// no relaying allowed, so we ignore hostname
o = summon_person(tu[UUser]);
#ifdef EXPERIMENTAL
#ifdef GAMMA
// xep 0085 typing notices - we even split active into a separate message
// for now. could be sent as a flag
if ((node[t="/composing"] || node[t="/active"] ||
@ -379,7 +384,7 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) {
// so there wont be circular error messages
if (tu[UUser]) {
o = summon_person(tu[UUser]);
#ifndef EXPERIMENTAL
#ifndef GAMMA
if (o && o->execute_callback(node["@id"], ({ vars["_INTERNAL_identification"], vars, node }))) return 1;
#else
// the following should catch errors - in theory, requires testing
@ -540,26 +545,20 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) {
sendmsg(o, "_notice_place_leave_unicast", 0, vars, origin);
#endif
} else {
#ifdef AVAILABILITY_OFFLINE
o = summon_person(tu[UUser]);
// http://www.psyc.eu/presence
vars["_degree_availability"] = AVAILABILITY_OFFLINE;
#ifdef CACHE_PRESENCE
# ifdef CACHE_PRESENCE
persistent_presence(XMPP + su[UUserAtHost],
AVAILABILITY_OFFLINE);
#endif
# endif
vars["_description_presence"] =
(node["/status"] && node["/status"][Cdata]) ?
node["/status"][Cdata] : ""; // "Get psyced!";
vars["_INTERNAL_mood_jabber"] = "neutral";
sendmsg(o, "_notice_presence_absent", 0,
vars, origin);
#if 0 // packen wir das doch wieder zusammen...
} else {
// one more famous fippoesque else case.. let's fill it ;)
P0(("%O Surprise! Encountered absence with resource: %O\n",
ME, node))
// interessant... wir werden das wohl noch oefter sehen
// ich bin nicht sicher, ob das ein bug der gegenseite ist
#endif
}
break;
@ -637,11 +636,11 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) {
// }
P4(("_request_enter from %O to %O: %O\n", ME, o, vars))
// dont send me a memberlist if i am a member already
#ifndef HISTORY_AMOUNT
# define HISTORY_AMOUNT 5
#ifndef _limit_amount_history_place_default
# define _limit_amount_history_place_default 5
#endif
unless(vars["_amount_history"])
vars["_amount_history"] = HISTORY_AMOUNT;
vars["_amount_history"] = _limit_amount_history_place_default;
sendmsg(o,
#ifdef SPEC
"_request_context_enter"

View File

@ -1,6 +1,6 @@
#include "jabber.h"
#include <net.h>
#include <url.h>
#include "jabber.h"
// just renderMembers
#include NET_PATH "members.i"
@ -37,9 +37,9 @@ int msg(string source, string mc, string data,
// ignore these
return 1;
break;
case "_request_description": // wir sollten uns da auf eins einigen :)
case "_request_examine": // needs a tag also... probably all _request's do
mc = "_request_examine_vCard";
case "_request_examine": // don't use this, please remove in 2009
case "_request_description": // this is the one.
mc = "_request_description_vCard"; // pending rename.. TODO
unless (vars["_tag"]) vars["_tag"] = RANDHEXSTRING;
source->chain_callback(vars["_tag"], (:
if ($3["@type"] == "result") {
@ -245,6 +245,7 @@ int msg(string source, string mc, string data,
$2 });
:));
break;
#ifndef _flag_disable_module_authentication
case "_request_authentication":
// TODO: XEP 0070 says we should use <message/> when the recipient is a bare jid
// but I prefer the iq method
@ -255,6 +256,8 @@ int msg(string source, string mc, string data,
return ({ $1, "_error_invalid_authentication", 0, $2 });
:));
break;
#endif
#ifndef _flag_disable_query_server
case "_notice_list_feature":
case "_notice_list_feature_person":
case "_notice_list_feature_place":
@ -266,6 +269,7 @@ int msg(string source, string mc, string data,
vars["_list_feature"] = implode(map(vars["_list_feature"],
(: return "<feature var='" + feat2jabber[$1] + "'/>"; :)), "");
break;
#endif
case "_notice_list_item":
t = "";
// same stuff in user.c (what happened to code sharing?)
@ -513,6 +517,10 @@ int msg(string source, string mc, string data,
#endif
if ($3["@type"] == "error") {
// FIXME: could remove context
//
// also, we should implement the full choice of errors and
// map them to appropriate psyc errors.. instead we just
// have this silly lazy coder's message:
return ({ t, "_failure_place_enter_XMPP",
"[_nick_place] could not be entered for jabberish reasons.",
$2 });
@ -557,6 +565,9 @@ int msg(string source, string mc, string data,
else if (abbrev("_failure_redirect", mc)) {
if (vars["_tag_reply"]) { // wild guess that it is an iq then
mc = "_jabber_iq_error";
// <lynX> was spricht dagegen _failure_redirect als <redirect/> auszugeben?
// <fippo> ich denke nicht, dass es irgendwer vernünftig implementiert...
// außerdem musst du die jid des raumes in dem konkreten fall rausfinden
vars["_jabber_XML"] = "<error type='modify'><gone xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang='en'>" + psyctext(data, vars) + "</text></error>";
}
}

View File

@ -1,6 +1,6 @@
#include <net.h>
/* a cache for the remote muc
/* a slave for the remote muc
* yes, this is for a SINGLE person
* yes, that's horrible
*
@ -8,13 +8,6 @@
* even /history if we'd like to have that.. ;)
*/
// FIXME: should set "owner nick" and tag so
// we can detect when the remote room does not
// support tagging or when we are kicked
// and this could even do echo detection
// NOTE: this should work when using the
// isecho check
object owner;
mapping membercache = ([ ]);
@ -49,6 +42,8 @@ castmsg(source, method, data, mapping vars) {
case "_notice_place_leave":
if (isecho) {
// got kicked or room does not support tagging
// this works already for kick, but it might be nice to do that
// as a KICK for irc
P0(("%O left via _notice_place_leave, this is strange\n", vars["_context"]))
}
m_delete(membercache, source);
@ -63,6 +58,5 @@ castmsg(source, method, data, mapping vars) {
}
mapping qMembers() {
P4(("membercache is %O\n", membercache))
return m_indices(membercache);
}

View File

@ -1,11 +1,12 @@
// $Id: server.c,v 1.148 2008/03/11 15:13:58 lynx Exp $ // vim:syntax=lpc:ts=8
// $Id: server.c,v 1.159 2008/10/01 10:59:24 lynx Exp $ // vim:syntax=lpc:ts=8
#include "jabber.h"
#include "server.h" // inherits net/server
#include "person.h" // find_person
#include "url.h"
#include <sys/tls.h>
volatile string tag;
volatile string authtag;
volatile string resource;
volatile string streamid;
volatile string pass;
@ -16,12 +17,11 @@ volatile string sasluser;
volatile string saslchallenge;
#ifdef __TLS__
volatile mixed cert;
volatile mixed certinfo;
#endif
qScheme() { return "jabber"; }
// qName() { } // we need that in common.c - probably no more
qTag() { return tag; }
void create() {
unless (clonep()) return;
@ -30,13 +30,24 @@ void create() {
}
#ifdef __TLS__
tls_logon(result) {
PT(("%O tls_logon(%d)\n", ME, result))
PT(("%O tls? %O\n", ME, tls_query_connection_state(ME)))
// we may write again
# ifdef WANT_S2S_SASL
cert = tls_certificate(ME, 0);
// similar code in other files
tls_logon(result) {
if (result == 0) {
# ifdef WANT_S2S_SASL /* hey wait.. this is not S2S here!? */
certinfo = tls_certificate(ME, 0);
# endif
P3(("%O tls_logon fetching certificate: %O\n", ME, certinfo))
# ifdef ERR_TLS_NOT_DETECTED
} else if (result == ERR_TLS_NOT_DETECTED) {
// no encryption. no problem.
# endif
} else if (result < 0) {
P1(("%O TLS error %d: %O\n", ME, result, tls_error(result)))
QUIT // don't fall back to plaintext instead
} else {
P0(("tls_logon with result > 0?!?!\n"))
// should not happen
}
}
#endif
@ -57,14 +68,13 @@ string *splitsasl(string data) {
return result;
}
promptForPassword(user) {
P2(("promptForPassword with %O\n", user))
if (reprompt == 1 || pass) {
w("_error_invalid_password", "Invalid password.\n",
([ "_tag_reply" : qTag(), "_nick" : nick,
([ "_tag_reply" : authtag || "", "_nick" : nick,
"_resource" : resource ]) );
write("</stream:stream>");
emitraw("</stream:stream>");
QUIT
return; // ?
}
@ -72,9 +82,9 @@ promptForPassword(user) {
unless (pass) {
reprompt = 1;
w("_query_password", 0, //"Please provide your password.",
([ "_nick": nick, "_tag_reply" : qTag() ]) );
}
return 1;
([ "_nick": nick, "_tag_reply" : authtag || "" ]) );
}
return 1;
}
logon(a) {
@ -100,17 +110,17 @@ createUser(nick) {
userLogon() {
user->sTag(tag);
user->sTag(authtag);
user->sResource(resource);
return ::userLogon();
}
#ifdef EXPERIMENTAL
#ifdef GAMMA
authChecked(result, varargs array(mixed) args) {
// a point where we could be sending our jabber:iq:auth reply
// instead of letting _notice_login do that
PT(("%O got authChecked %O, %O\n", ME, result, args))
return ::authChecked(result, args);
return ::authChecked(result, args...);
}
#endif
@ -119,12 +129,12 @@ jabberMsg(XMLNode node) {
string id;
mixed t;
id = node["@id"]; // tag?
id = node["@id"] || ""; // tag?
switch (node[Tag]) {
case "iq":
if (node["/bind"]) {
// suppresses the jabber:iq:auth reply in the SASL case
tag = -1;
authtag = -1;
unless (sasluser) {
// not-allowed stanza error?
return 0;
@ -137,31 +147,28 @@ jabberMsg(XMLNode node) {
if (!stringp(resource) || resource == "")
resource = "PSYC";
nick = sasluser;
sasluser = "";
sasluser = ""; // why an empty string? explanation needed
emit(sprintf("<iq type='result' id='%s'>"
"<bind xmlns='" NS_XMPP "xmpp-bind'>"
"<jid>%s</jid>"
"</bind></iq>",
id, nick + "@" SERVER_HOST "/" + resource));
emit("<iq type='result' id='"+ id +"'>"
"<bind xmlns='" NS_XMPP "xmpp-bind'><jid>"+
nick +"@" SERVER_HOST "/"+ resource +"</jid>"
"</bind></iq>");
return 0;
} else if (node["/session"]) {
unless(user) return 0; // what then?
if (!stringp(id))
id = "";
emit(sprintf("<iq type='result' id='%s' from='%s'/>",
id, SERVER_HOST));
emit("<iq type='result' id='"+ id +"' from='"
SERVER_HOST "'/>");
user -> vSet("language", language);
return morph();
}
switch (node["/query"]["@xmlns"]) {
// old-school style.. for clients that don't like SASL, like kopete
// old-school style.. for clients that don't like SASL, like kopete, jabbin
case "jabber:iq:auth":
tag = id;
authtag = id;
if (node["@type"] == "get"){
// hello(nick) ?
w("_query_password", 0,
([ "_nick": nick, "_tag_reply": tag ]), "");
([ "_nick": nick, "_tag_reply": authtag || "" ]), "");
} else if (node["@type"] == "set") {
helper = node["/query"];
resource = helper["/resource"][Cdata];
@ -182,10 +189,11 @@ jabberMsg(XMLNode node) {
case "jabber:iq:register":
if (node["@type"] == "get"){
string packet;
#ifdef REGISTERED_USERS_ONLY
#if defined(REGISTERED_USERS_ONLY) || defined(_flag_disable_registration_XMPP)
// super dirty.. this should all be in textdb
packet = sprintf("<iq type='result' id='%s'>"
"<query xmlns='jabber:iq:register'/>"
"<error code='501>No way!</error>" IQ_OFF,
"<error code='501>Registration by XMPP not permitted.</error>" IQ_OFF,
id);
#else
packet = sprintf("<iq type='result' id='%s'>"
@ -228,6 +236,9 @@ jabberMsg(XMLNode node) {
emit(packet);
QUIT
} else {
#if defined(REGISTERED_USERS_ONLY) || defined(_flag_disable_registration_XMPP)
// TODO: generate some error as above
#else
user -> vSet("password", t[Cdata]);
if (t = helper["/email"]) {
user -> vSet("email", helper["/email"]);
@ -235,6 +246,7 @@ jabberMsg(XMLNode node) {
// maybe immediate save is not really a good idea
// user -> save();
emit(sprintf("<iq type='result' id='%s'/>", id));
#endif
}
user = 0;
}
@ -243,15 +255,14 @@ jabberMsg(XMLNode node) {
case "starttls":
#if __EFUN_DEFINED__(tls_available)
if (tls_available()) {
emit("<proceed xmlns='" NS_XMPP "xmpp-tls'/>");
emitraw("<proceed xmlns='" NS_XMPP "xmpp-tls'/>");
// we may not write until tls_logon is called!
tls_init_connection(ME, #'tls_logon);
} else {
P1(("%O received a 'starttls' but TLS isn't available.\n", ME))
}
#else
emit("<failure xmlns='" NS_XMPP "xmpp-tls'/>");
emit("</stream:stream>");
emitraw("<failure xmlns='" NS_XMPP "xmpp-tls'/></stream:stream>");
destruct(ME);
#endif
break;
@ -282,7 +293,7 @@ jabberMsg(XMLNode node) {
{
if (result) {
sasluser = creds[1];
emit("<success xmlns='" NS_XMPP "xmpp-sasl'/>");
emitraw("<success xmlns='" NS_XMPP "xmpp-sasl'/>");
} else {
sasluser = 0;
SASL_ERROR("temporary-auth-failure")
@ -294,7 +305,7 @@ jabberMsg(XMLNode node) {
#else
&& user -> checkPassword(creds[2], "plain")) {
sasluser = creds[1];
emit("<success xmlns='" NS_XMPP "xmpp-sasl'/>");
emitraw("<success xmlns='" NS_XMPP "xmpp-sasl'/>");
#endif
} else {
SASL_ERROR("invalid-mechanism")
@ -312,8 +323,8 @@ jabberMsg(XMLNode node) {
unless (node[Cdata]) {
SASL_ERROR("incorrect-encoding")
QUIT
} else unless (mappingp(cert) && cert[0] == 0
&& cert["1.2.840.113549.1.9.1"]) {
} else unless (mappingp(certinfo) && certinfo[0] == 0
&& certinfo["1.2.840.113549.1.9.1"]) {
SASL_ERROR("invalid-mechanism")
QUIT
} else {
@ -322,7 +333,7 @@ jabberMsg(XMLNode node) {
// incorrect-encoding sasl error
deco = to_string(decode_base64(node[Cdata]));
// TODO: the right thingie could be a list!
unless (deco == cert["1.2.840.113549.1.9.1"]) {
unless (deco == certinfo["1.2.840.113549.1.9.1"]) {
// TODO: not sure about this one
SASL_ERROR("invalid-mechanism")
QUIT
@ -340,7 +351,7 @@ jabberMsg(XMLNode node) {
} else {
user = find_person(u) || createUser(u);
sasluser = u;
emit("<success xmlns='" NS_XMPP "xmpp-sasl'/>");
emitraw("<success xmlns='" NS_XMPP "xmpp-sasl'/>");
}
}
# else
@ -377,7 +388,7 @@ jabberMsg(XMLNode node) {
QUIT
}
sasluser = u;
emit("<success xmlns='" NS_XMPP "xmpp-sasl'/>");
emitraw("<success xmlns='" NS_XMPP "xmpp-sasl'/>");
}
break;
#endif
@ -402,11 +413,12 @@ jabberMsg(XMLNode node) {
+ encode_base64("rspauth=" + result) +
"</success>");
} else {
PT(("digest md5 failure\n"))
P0(("digest md5 failure: %O\n", creds))
sasluser = 0;
SASL_ERROR("invalid-authzid")
SASL_ERROR("invalid-authzid") // why do we get here?
QUIT
}
return 0; // ignored, but avoids a warning
});
user = find_person(creds["username"]) || createUser(creds["username"]);
@ -422,7 +434,7 @@ jabberMsg(XMLNode node) {
* wie auch immer haetten wir sonst mittlerweile net/queue fuer
* diesen job
*/
P2(("jabber/server:jabberMsg default case\n"))
P0(("jabber/server:jabberMsg default case\n"))
}
// return ::jabberMsg(from, cmd, args, data, all);
return 0;
@ -467,7 +479,7 @@ open_stream(XMLNode node) {
} else {
features += "<mechanisms xmlns='" NS_XMPP "xmpp-sasl'>"
#if __VERSION_MINOR__ > 3 || __VERSION_MICRO__ > 610
#ifndef _flag_disable_authentication_digest_MD5
"<mechanism>DIGEST-MD5</mechanism>"
#endif
"<mechanism>PLAIN</mechanism>";
@ -477,8 +489,8 @@ open_stream(XMLNode node) {
#endif
#if __EFUN_DEFINED__(tls_available)
if (tls_available() && tls_query_connection_state(ME) > 0
&& mappingp(cert) && cert[0] == 0
&& certificate_check_jabbername(0, cert)) {
&& mappingp(certinfo) && certinfo[0] == 0
&& certificate_check_jabbername(0, certinfo)) {
features += "<mechanism>EXTERNAL</mechanism>";
}
#endif
@ -496,7 +508,7 @@ open_stream(XMLNode node) {
// overrides certificate_check_jabbername from common.c with a function
// that is approproate for authenticating users
certificate_check_jabbername(name, cert) {
certificate_check_jabbername(name, certinfo) {
// plan: prefer subjectAltName:id-on-xmppAddr,
// but allow email (1.2.840.113549.1.9.1)
// and subjectAltName:rfc822Name

View File

@ -1,4 +1,4 @@
// $Id: user.c,v 1.293 2008/04/15 19:18:12 lynx Exp $ // vim:syntax=lpc:ts=8
// $Id: user.c,v 1.303 2008/09/12 15:54:39 lynx Exp $ // vim:syntax=lpc:ts=8
#include "jabber.h"
#include "user.h"
#include "person.h"
@ -6,9 +6,9 @@
#include <peers.h>
// important to #include user.h first
// then we also repatch JABBER_HOST so disco.c does the right thing for us
#undef JABBER_HOST
#define JABBER_HOST SERVER_HOST
// then we also repatch _host_XMPP so disco.c does the right thing for us
#undef _host_XMPP
#define _host_XMPP SERVER_HOST
volatile string prefix; // used anywhere?
volatile string tag;
@ -42,6 +42,7 @@ msg(source, mc, data, mapping vars, showingLog) {
int ret;
string jid, buddy;
string packet;
mixed t;
P2(("%s beim jabber:user:msg\n", mc))
// net/group/master says we should copy vars if we need to
@ -124,11 +125,25 @@ msg(source, mc, data, mapping vars, showingLog) {
mc = "_notice_place_leave";
}
switch (mc) {
#ifndef EXPERIMENTAL
case "_status_person_present":
case "_status_person_present_implied":
case "_status_person_absent":
case "_status_person_absent_recorded":
return;
#endif
PT(("%O got %O\n", ME, mc))
// actually.. we never send _time_idle with this
if (member(vars, "_time_idle")) {
t = vars["_time_idle"];
if (stringp(t)) {
t = to_int(t);
PT(("_time_idle %O == %O, right?\n", vars["_time_idle"], t))
}
t = gmtime(time() - t);
vars["_INTERNAL_time_jabber"] = JABBERTIME(t);
} else {
vars["_INTERNAL_time_jabber"] = JABBERTIME(gmtime(time()));
}
break;
case "_notice_friendship_established":
// TODO:
// it should be checked that this request is valid
@ -270,7 +285,7 @@ presence(XMLNode node) {
if (!isplacemsg && getchild(node, "x", "http://jabber.org/protocol/muc#user")) {
isplacemsg = 2;
}
/* directed presence */
#ifndef _flag_disable_presence_directed_XMPP
if (node["@to"]) {
target = jid2unl(node["@to"]);
if (isplacemsg) {
@ -279,54 +294,56 @@ presence(XMLNode node) {
if (node["@type"] == "unavailable") {
P2(("requesting to leave %O\n", target))
placeRequest(target,
#ifdef SPEC
# ifdef SPEC
"_request_context_leave"
#else
# else
"_request_leave"
#endif
# endif
, 1);
place = 0; // should we do it when we receive the notice?
// anyway, w/out this we show up as still being
// in that room in /p
} else {
#ifdef ENTER_MEMBERS
# ifdef ENTER_MEMBERS
// TODO: this might be needed and should work for remote rooms
// doing it in local rooms is a bad idea
if (is_formal(target))
placeRequest(target,
# ifdef SPEC
# ifdef SPEC
"_request_context_enter"
# else
# else
"_request_enter"
# endif
# endif
"_again", 0, 1, ([
"_nick" : MYNICK,
"_nick_local" : u[UResource]
]));
else
placeRequest(target,
# ifdef SPEC
# ifdef SPEC
"_request_context_enter"
# else
# else
"_request_enter"
# endif
# endif
"_again", 0, 1);
#else
# else
P2(("teleporting to %O\n", target))
teleport(target, "_join", 0, 1);
#endif
# endif
}
# ifndef _flag_disable_module_friendship
} else if (node["@type"] == "subscribe") {
// was: friend(({ jid2unl(node["@to"]) }), 0);
friend(0, jid2unl(node["@to"]));
} else if (node["@type"] == "unsubscribe") {
friend(1, jid2unl(node["@to"]));
# endif // _flag_disable_module_friendship
} else if (abbrev(XMPP, target)) {
// if the person is not on our buddylist,
// this is usually a muc join
// but i am not sure if there are other uses of
// presence in jabber
#ifdef JABBER_TRANSPARENCY
# ifdef JABBER_TRANSPARENCY
mapping vars = ([ "_nick" : MYNICK ]);
mixed *u = parse_uniform(XMPP + node["@to"]);
P3(("jtranz presence to %O\n", target))
@ -339,7 +356,7 @@ presence(XMLNode node) {
// unless(mappingp(presence_out)) presence_out = ([ ]);
vars["_jabber_XML"] = innerxml;
// TODO: wir fliegen wir mit JABBER_HOST auf die
// TODO: wir fliegen wir mit _host_XMPP auf die
// NASE.
// wir muessen die resource in die vars stecken...
vars["_INTERNAL_source_jabber"] = myjidresource;
@ -356,14 +373,15 @@ presence(XMLNode node) {
"[_nick] is sending you a jabber presence.",
vars);
}
#endif
# endif
} else {
// TODO: what can we do in this case?
// we can look at our buddylist, if target is a member
// then this is a directed presence
}
} /* end of directed presence handling */
#endif // _flag_disable_presence_directed_XMPP
#ifdef AVAILABILITY_AWAY
else if (node["/show"]) {
// else this is one of the so-called "presence broadcasts"
// we will never support stupid broadcasts although we could
@ -393,6 +411,7 @@ presence(XMLNode node) {
// TODO: quiet?
announce(AVAILABILITY_HERE);
}
#endif // AVAILABILITY_AWAY
}
@ -592,6 +611,7 @@ iq(XMLNode node) {
break;
}
break;
#if !defined(REGISTERED_USERS_ONLY) && !defined(_flag_disable_registration_XMPP)
case "jabber:iq:register":
switch(node["@type"]) {
case "get":
@ -632,6 +652,7 @@ iq(XMLNode node) {
case "error":
break;
}
#endif // jabber:iq:register
case "jabber:iq:roster":
switch(node["@type"]) {
case "get":
@ -716,8 +737,10 @@ iq(XMLNode node) {
helper = helper["/item"];
if (helper && helper["@subscription"] == "remove") {
string buddy = jid2unl(helper["@jid"]);
#ifndef _flag_disable_module_friendship
P2(("remove %O from roster\n", helper["@jid"]))
friend(1, buddy);
#endif
m_delete(xbuddylist, buddy);
emit(sprintf("<iq type='result' id='%s'/>", tag));
} else {
@ -806,11 +829,14 @@ iq(XMLNode node) {
}
break;
case "http://jabber.org/protocol/disco#items":
// send a list of rooms to the client
switch(node["@type"]) {
case "get":
if (!node["@to"])
// "my" places - let person.c handle this
sendmsg(ME, "_request_list_item", 0, vars);
else if (is_localhost(lower_case(node["@to"])))
// server's places - let root.c handle this
sendmsg("/", "_request_list_item", 0, vars);
/* else... TODO */
break;
@ -833,6 +859,9 @@ iq(XMLNode node) {
"<query xmlns='jabber:iq:private'>"
"<storage xmlns='storage:bookmarks'>",
tag);
// hey wait.. we are sending the list of places here..
// why is it i have never seen a jabber client actually
// executing autojoins? FIXME
if (v("subscriptions"))
foreach (string s in v("subscriptions")) {
string jid;
@ -1078,7 +1107,7 @@ string jid2unl(string jid) {
return node;
}
# if 1
else if (ISPLACEMSG(node)) {
else if (strlen(node) && ISPLACEMSG(node)) {
return "psyc://" + host + "/@" + PREFIXFREE(node);
}
# endif
@ -1199,12 +1228,17 @@ w(string mc, string data, mapping vars, mixed source) {
case "_notice_list_feature_place":
case "_notice_list_feature_server":
case "_notice_list_feature_newsfeed":
#ifndef _flag_disable_query_server
mixed id2jabber = shared_memory("disco_identity");
mixed feat2jabber = shared_memory("disco_features");
unless (mappingp(id2jabber)) return 1;
vars["_identity"] = id2jabber[vars["_identity"]] || vars["_identity"];
vars["_list_feature"] = implode(map(vars["_list_feature"],
(: return "<feature var='" + feat2jabber[$1] + "'/>"; :)), "");
(: return "<feature var='" + feat2jabber[$1] + "'/>"; :)), "");
break;
#else
return 1;
#endif
case "_notice_list_item":
t = "";
// same stuff in user.c (what happened to code sharing?)

View File

@ -1,11 +1,17 @@
// $Id: lastlog.c,v 1.28 2008/04/12 22:57:17 lynx Exp $ // vim:syntax=lpc
// $Id: lastlog.c,v 1.29 2008/07/17 17:09:15 lynx Exp $ // vim:syntax=lpc
//
// generic implementation of a log of last messages,
// also known as lastlog in irc tradition
// stores log in a non-static variable ready for save_object
// used by user.c for /log and storic.c for /history in rooms
// memory allocation could be improved in a similar way to net/queue.c
//
// local debug messages - turn them on by using psyclpc -DDlastlog=<level>
#ifdef Dlastlog
# undef DEBUG
# define DEBUG Dlastlog
#endif
#include <net.h>
protected array(mixed) _log;

View File

@ -1,13 +1,13 @@
// vim:foldmethod=marker:syntax=lpc:noexpandtab
// $Id: library.i,v 1.335 2008/02/18 20:52:00 lynx Exp $
// $Id: library.i,v 1.344 2008/09/12 15:54:38 lynx Exp $
#include <net.h>
#include <services.h>
#include <person.h>
#include <url.h>
#ifdef SERVER_URL
# define myUNL SERVER_URL
#ifdef _uniform_node
# define myUNL _uniform_node
#else
volatile string myUNL;
#endif
@ -54,7 +54,7 @@ varargs int register_target(string uniform, vaobject handler, vaint shy) {
unless (uniform)
raise_error("register_target without uniform\n");
#endif
#if 0 //def BETA
#if 0
if (query_server_unl() == uniform)
raise_error("register_target for root!?\n");
#endif
@ -142,10 +142,8 @@ static void create() {
ME->base64_self_test();
if (md5("foobar") != "3858f62230ac3c915f300c664312c63f")
raise_error("MD5 is br0ken!!11!!!\n");
# if __VERSION_MINOR__ > 3 || __VERSION_MICRO__ > 610
# ifndef _flag_disable_authentication_digest_MD5
sasl_test();
# else
# echo SASL digest-md5 currently disabled for old LDMUDs.
# endif
//P4(("%O\n", make_json( ([ 7:"33\n44\t21", "!":93 ]) )))
printf("Testing make_json: Is %O equal to %O ?\n",
@ -260,10 +258,10 @@ static void create() {
#endif
#ifdef JABBER_PATH
register_target("xmpp:"+ myLowerCaseHost);
# ifdef JABBER_HOST
register_localhost(lower_case(JABBER_HOST));
register_target(lower_case(JABBER_HOST));
register_target("xmpp:"+ lower_case(JABBER_HOST));
# ifdef _host_XMPP
register_localhost(lower_case(_host_XMPP));
register_target(lower_case(_host_XMPP));
register_target("xmpp:"+ lower_case(_host_XMPP));
# endif
#endif
// base64decode("test2000");
@ -472,7 +470,7 @@ string is_formal(string nicki) {
// for this person (psyc, xmpp, mailto..)
//
# echo We don't get here anyway.
# if 1 //def EXPERIMENTAL
# if 1
if (index(nicki, ':') != -1 || index(nicki, '.') != -1)
return nicki;
# else
@ -590,6 +588,7 @@ string legal_mailto(string a) {
}
#endif
#ifndef hex2int
// thanks to saga this does now convert hex to integer.. :)
//
// modern ldmud now offers hex2int in form of
@ -614,6 +613,7 @@ int hex2int(string hex) {
}
return r;
}
#endif
#if 0
// only used by /lu these days
@ -717,14 +717,12 @@ varargs mixed sendmsg(mixed target, string mc, mixed data, vamapping vars,
#endif
unless (source) source = previous_object();
//#ifndef EXPERIMENTAL
// entity.c doesn't allow vars to be missing so we might
// just aswell enforce it in the whole psyced source that
// vars always need to be given as mapping. TODO
// i changed the behaviour of entity.c because vars are missing
// everywhere..
unless (mappingp(vars)) vars = ([]);
//#endif
#ifdef TAGGING
/* <fippo> I dont remember exactly why I did not want this
* for stringp sources... but for pushback, it should
@ -795,6 +793,18 @@ varargs mixed sendmsg(mixed target, string mc, mixed data, vamapping vars,
return psyc_sendmsg(target, mc, data, vars,
showingLog, source, u);
#endif
case 0:
#ifdef DEVELOPMENT
raise_error("scheme 0 is a bug\n");
//
// TODO: we had this error, and maybe it's
// because user@host addressing does get here
// so i'm not completely sure it is the right
// thing to do to just treat it like xmpp, but
// let's give that a try.
#endif
//
// fall thru
case "xmpp":
#ifdef SWITCH2PSYC
P4(("LOOKing for %O in %O\n",
@ -829,8 +839,6 @@ varargs mixed sendmsg(mixed target, string mc, mixed data, vamapping vars,
o -> msg(source, mc, data, vars);
return 3;
#endif
case 0:
raise_error("scheme 0 is a bug\n");
}
if (schemes[u[UScheme]])
return schemes[u[UScheme]]->msg(source,
@ -918,10 +926,8 @@ varargs mixed sendmsg(mixed target, string mc, mixed data, vamapping vars,
return 0;
}
if (objectp(target)) {
// returnwert sagt aus, ob msg dargestellt werden will
// nicht aber, dass sie erfolgreich angekommen ist, denn das ist ja eh
target -> msg(source, mc, data, vars, showingLog);
// deshalb machen wir das lieber selber klar
// make sure msg is treated as successfully delivered:
return 2;
}
D2(else D(S("sendmsg encountered %O as target for (%O,%s,%O,%O)\n",
@ -1081,7 +1087,7 @@ varargs int sendmsg(mixed target, string mc, mixed data, mapping vars,
#endif
unless (source) source = previous_object();
#ifndef EXPERIMENTAL
#ifndef GAMMA
// entity.c doesn't allow vars to be missing so we might
// just aswell enforce it in the whole psyced source that
// vars always need to be given as mapping. TODO

View File

@ -1,3 +1,7 @@
# This Makefile is for developers who edit profiles.pl only.
# If this file contains funny stuff, it has been corrupted by
# an evil program in your LPC sandbox. ;-D
it: profiles.c
profiles.c: profiles.pl

View File

@ -1,4 +1,4 @@
// $Id: admin.c,v 1.26 2007/08/20 12:25:23 lynx Exp $ // vim:syntax=lpc
// $Id: admin.c,v 1.27 2008/10/07 12:27:25 lynx Exp $ // vim:syntax=lpc
//
// admin functions and shutdown procedure
//
@ -42,7 +42,7 @@ varargs int server_shutdown(string reason, int restart, int pass) {
#ifdef DEFAULT_SHUTDOWN_REASON
reason = DEFAULT_SHUTDOWN_REASON;
#else
reason = CHATNAME " is performing a quick full twist double "
reason = SERVER_HOST " is performing a quick full twist double "
"salto backwards.";
#endif
}

View File

@ -1,7 +1,7 @@
// vim:syntax=lpc
// info: to unfold and view the complete file, hit zR in your vim command mode.
//
// $Id: dns.c,v 1.112 2008/03/29 20:05:32 lynx Exp $
// $Id: dns.c,v 1.113 2008/09/12 15:54:39 lynx Exp $
//
// {{{ meta-bla about foldmethod=marker
// <lynX> hm.. find ich folding jetzt eher nützlich oder lästig? muss ich
@ -53,9 +53,9 @@ volatile mapping localhosts = ([
#endif
// the hostnames need to be in lowercase... lets do it later
// SERVER_HOST : 1,
#if defined(JABBER_HOST)
# if JABBER_HOST != SERVER_HOST
// JABBER_HOST : 1,
#if defined(_host_XMPP)
# if _host_XMPP != SERVER_HOST
// _host_XMPP : 1,
# endif
#endif
]);

View File

@ -72,7 +72,9 @@ string make_json(mixed d) {
P3(("\nintermediate: %O\n", m_values(x)))
return "{"+ implode(m_values(x), ",") +"}";
#endif
}
} else if (objectp(d))
return "\'"+ psyc_name(d) +"\'";
return "00";
}
// see also net/place/storic.c for a JSON generator limited and optimized

View File

@ -1,5 +1,5 @@
// vim:syntax=lpc
// $Id: jsonparser.pike,v 1.2 2006/10/25 17:50:11 lynx Exp $
// $Id: jsonparser.pike,v 1.5 2008/08/05 12:21:34 lynx Exp $
//
// I really hate those comments.
//
@ -107,6 +107,9 @@ PROTECTED void back() {
myIndex -= 1;
}
#ifndef GAMMA
// funny.. we already have two better ways to do hex2int than this:
//
/// <summary>
/// Get the hex value of a character (base16).
/// </summary>
@ -130,6 +133,7 @@ PROTECTED int dehexchar(int c) {
}
return -1;
}
#endif
/// <summary>
/// Determine if the source string still contains characters that next() can consume.
@ -331,12 +335,17 @@ PROTECTED varargs string unescape(string s)
if (c == '+') {
c = ' ';
} else if (c == '%' && (i + 2 < len)) {
#ifndef GAMMA
int d = dehexchar(s[i+1]);
int e = dehexchar(s[i+2]);
if (d >= 0 && e >= 0) {
c = (d*16 + e);
i += 2;
}
#else
i += 2;
c = hex2int(s[i-1 .. i]);
#endif
}
sb+=int2char(c);
}

Some files were not shown because too many files have changed in this diff Show More