# HG changeset patch # User Tobias Markmann # Date 1228061911 -3600 # Node ID 4d3ccc6b581784558fb0ba21c34f3660834ffc1f # Parent 96f9f8dd9a4568634c3fd30403080a0c03b9f2be# Parent efc5184effa18b6bea1463d4cba7f2b0b8774737 Automerge with waqas. diff -r 96f9f8dd9a45 -r 4d3ccc6b5817 Makefile --- a/Makefile Sun Nov 30 15:18:45 2008 +0100 +++ b/Makefile Sun Nov 30 17:18:31 2008 +0100 @@ -5,8 +5,7 @@ CONFIG = $(DESTDIR)$(SYSCONFDIR) MODULES = $(DESTDIR)$(PREFIX)/lib/prosody/modules SOURCE = $(DESTDIR)$(PREFIX)/lib/prosody - -DATADIR?=data +DATA = $(DESTDIR)$(DATADIR) INSTALLEDSOURCE = $(PREFIX)/lib/prosody INSTALLEDCONFIG = $(SYSCONFDIR) @@ -17,7 +16,7 @@ $(MAKE) all -C util-src install: prosody.install prosody.cfg.lua.install util/encodings.so util/encodings.so - install -d $(BIN) $(CONFIG) $(MODULES) $(SOURCE) $(DATADIR) + install -d $(BIN) $(CONFIG) $(MODULES) $(SOURCE) $(DATA) install -d $(CONFIG)/certs install -d $(SOURCE)/core $(SOURCE)/net $(SOURCE)/util install ./prosody.install $(BIN)/prosody diff -r 96f9f8dd9a45 -r 4d3ccc6b5817 util/sasl.lua --- a/util/sasl.lua Sun Nov 30 15:18:45 2008 +0100 +++ b/util/sasl.lua Sun Nov 30 17:18:31 2008 +0100 @@ -4,6 +4,8 @@ local tostring = tostring; local st = require "util.stanza"; local generate_uuid = require "util.uuid".generate; +local t_insert, t_concat = table.insert, table.concat; +local to_byte, to_char = string.byte, string.char; local s_match = string.match; local gmatch = string.gmatch local string = string @@ -66,6 +68,20 @@ return data end + local function latin1toutf8(str) + local p = {}; + for ch in gmatch(str, ".") do + ch = to_byte(ch); + if (ch < 0x80) then + t_insert(p, to_char(ch)); + elseif (ch < 0xC0) then + t_insert(p, to_char(0xC2, ch)); + else + t_insert(p, to_char(0xC3, ch - 64)); + end + end + return t_concat(p); + end local function parse(data) message = {} for k, v in gmatch(data, [[([%w%-]+)="?([^",]*)"?,?]]) do -- FIXME The hacky regex makes me shudder