diff options
author | Bertrand Jacquin <beber@meleeweb.net> | 2006-12-22 03:01:17 +0100 |
---|---|---|
committer | Bertrand Jacquin <beber@meleeweb.net> | 2006-12-22 03:01:17 +0100 |
commit | 15fbc24bbd8dbdac3016da4a531bce7fbe7c047e (patch) | |
tree | e4c49a8f763496d0f44048c326af51a1b85fa14b | |
parent | add a patch to gtkmm to make it compile (http://bugs.gentoo.org/show_bug.cgi?... (diff) | |
download | portage-15fbc24bbd8dbdac3016da4a531bce7fbe7c047e.tar.xz |
ejabberd: patch for utf8 charset default for irc, new http_binding, not working very well
-rw-r--r-- | net-im/ejabberd/Manifest | 20 | ||||
-rw-r--r-- | net-im/ejabberd/ejabberd-1.1.2-r2.ebuild | 7 | ||||
-rw-r--r-- | net-im/ejabberd/files/http_binding.patch | 301 | ||||
-rw-r--r-- | net-im/ejabberd/files/mod_irc_utf-8.patch | 11 |
4 files changed, 254 insertions, 85 deletions
diff --git a/net-im/ejabberd/Manifest b/net-im/ejabberd/Manifest index db303b21..dfcc0b26 100644 --- a/net-im/ejabberd/Manifest +++ b/net-im/ejabberd/Manifest @@ -18,14 +18,18 @@ AUX ejabberd-1.1.2.initd 1298 RMD160 ec7b25205026521ec09f8595bbe6ae36c94bc55f SH MD5 13c4ef3cee491a8529dc8866347f0636 files/ejabberd-1.1.2.initd 1298 RMD160 ec7b25205026521ec09f8595bbe6ae36c94bc55f files/ejabberd-1.1.2.initd 1298 SHA256 69481e6f156e85c69038675283f818fe3fa92d0ab442aaf78831345969aa021a files/ejabberd-1.1.2.initd 1298 -AUX http_binding.patch 27120 RMD160 33a486a0070317755217d2513f38e1fc51436cd8 SHA1 9b5079ed7134c9ec6b101e79921f9978de820475 SHA256 9edbe0257b9e3fb547bcdb4f4325627e279199adfd6753622665b762eb675ed0 -MD5 98f2370cd26723c02ae57ae780221663 files/http_binding.patch 27120 -RMD160 33a486a0070317755217d2513f38e1fc51436cd8 files/http_binding.patch 27120 -SHA256 9edbe0257b9e3fb547bcdb4f4325627e279199adfd6753622665b762eb675ed0 files/http_binding.patch 27120 +AUX http_binding.patch 34601 RMD160 ce1305c772e81769d9165eaa00ef75c18ede05ba SHA1 3902127e05612bfe2a57efba54c057a5db911540 SHA256 1a31e631a8bdc25a221ac81a29d5573a671c64ee0cf56cc3e4839bb91fdf6bdd +MD5 75adcbc43ce318b2c30a5ab09aab21dc files/http_binding.patch 34601 +RMD160 ce1305c772e81769d9165eaa00ef75c18ede05ba files/http_binding.patch 34601 +SHA256 1a31e631a8bdc25a221ac81a29d5573a671c64ee0cf56cc3e4839bb91fdf6bdd files/http_binding.patch 34601 AUX mod_archive.erl 29560 RMD160 6c628ca4f1d82cd826c2a4d11c87d6b3344f3f24 SHA1 b934e9a9ed1ab7dc700b589177dc9425aa535a6f SHA256 b46976ca86a43cb13ed71009a5fadf7a2ca231e51da83150cdff0d646fbed00f MD5 c3c630a783edc22b0d81646f2c2eb829 files/mod_archive.erl 29560 RMD160 6c628ca4f1d82cd826c2a4d11c87d6b3344f3f24 files/mod_archive.erl 29560 SHA256 b46976ca86a43cb13ed71009a5fadf7a2ca231e51da83150cdff0d646fbed00f files/mod_archive.erl 29560 +AUX mod_irc_utf-8.patch 376 RMD160 74a370b992810607e6c61995c2e5c31623ce10d6 SHA1 502d263d8407c5137992a25e25a998574796292a SHA256 48f3d0de218de31fced3b6e9bd160981020921dfcf41a4990a0ea84c15802a06 +MD5 6a1fe58a1e40edea5131a7cabc020f73 files/mod_irc_utf-8.patch 376 +RMD160 74a370b992810607e6c61995c2e5c31623ce10d6 files/mod_irc_utf-8.patch 376 +SHA256 48f3d0de218de31fced3b6e9bd160981020921dfcf41a4990a0ea84c15802a06 files/mod_irc_utf-8.patch 376 AUX mod_pep.patch 74047 RMD160 04ea7221b539038a3610a2d745667abbe4b39969 SHA1 4c072204fc46e928492336dcc587c725e14992b1 SHA256 8335979552f290078015347433b0eb1aaa7f59da8431874b4720cd99f7ef91cf MD5 f6f334f668f70146c06dcdfcb55e0f40 files/mod_pep.patch 74047 RMD160 04ea7221b539038a3610a2d745667abbe4b39969 files/mod_pep.patch 74047 @@ -37,10 +41,10 @@ EBUILD ejabberd-1.1.2-r1.ebuild 6047 RMD160 67cac92974a0abad21d0742691541d4e0476 MD5 97b595d6ef284930fda4e83563e6ef3f ejabberd-1.1.2-r1.ebuild 6047 RMD160 67cac92974a0abad21d0742691541d4e04763ba8 ejabberd-1.1.2-r1.ebuild 6047 SHA256 8b3a13991e2a1b2a3e9d262acfa663f6e7c054596801e96359121a0e25b15f55 ejabberd-1.1.2-r1.ebuild 6047 -EBUILD ejabberd-1.1.2-r2.ebuild 6109 RMD160 667e6cbaec3903d773d70d09833bd849b4b848a2 SHA1 57f23c26bf40b172e0f30ba09ba851d77c13d269 SHA256 f6844047ac3615d97658c27f8e6f30fff6efc71fd984b8533564c5620610d0b5 -MD5 acf6e6019067a4867e029a874c36b806 ejabberd-1.1.2-r2.ebuild 6109 -RMD160 667e6cbaec3903d773d70d09833bd849b4b848a2 ejabberd-1.1.2-r2.ebuild 6109 -SHA256 f6844047ac3615d97658c27f8e6f30fff6efc71fd984b8533564c5620610d0b5 ejabberd-1.1.2-r2.ebuild 6109 +EBUILD ejabberd-1.1.2-r2.ebuild 6276 RMD160 85171446b2379283423d89fe1a55a50d83d817a1 SHA1 114b9c0c7beec41e989115bfc729eae573cf5440 SHA256 38e0e347bf9673aeaba33c174d6b33ca5e2daab142f38408c7358c227d853af9 +MD5 21ca2b043fcded34210ce3da6c57e76f ejabberd-1.1.2-r2.ebuild 6276 +RMD160 85171446b2379283423d89fe1a55a50d83d817a1 ejabberd-1.1.2-r2.ebuild 6276 +SHA256 38e0e347bf9673aeaba33c174d6b33ca5e2daab142f38408c7358c227d853af9 ejabberd-1.1.2-r2.ebuild 6276 MD5 30a6b40979271475494b8103ac79c2b4 files/digest-ejabberd-1.1.2-r1 497 RMD160 93a5b27c67cf098e343f1e877df1bdb5b4fe05ff files/digest-ejabberd-1.1.2-r1 497 SHA256 e90edb5f4836aa10b0e5490f1d9ed4d690c9dbd841ad566e03797f61f41f9024 files/digest-ejabberd-1.1.2-r1 497 diff --git a/net-im/ejabberd/ejabberd-1.1.2-r2.ebuild b/net-im/ejabberd/ejabberd-1.1.2-r2.ebuild index ec83fab4..df0e677d 100644 --- a/net-im/ejabberd/ejabberd-1.1.2-r2.ebuild +++ b/net-im/ejabberd/ejabberd-1.1.2-r2.ebuild @@ -21,7 +21,7 @@ DESCRIPTION="The Erlang Jabber Daemon" HOMEPAGE="http://ejabberd.jabber.ru/" SRC_URI="http://process-one.net/en/projects/${PN}/download/${PV}/${P}.tar.gz mod_presence? ( http://www.goryachev.org/jabber/mod_presence-0.0.4.tar.gz ) - mod_archive? ( http://mabber.com/static/ejabberd-1.1.1_httpbind.tar.gz )" + http_binding? ( http://mabber.com/static/ejabberd-1.1.1_httpbind.tar.gz )" LICENSE="GPL-2" SLOT="0" KEYWORDS="x86 ~amd64" @@ -72,10 +72,13 @@ src_unpack() { epatch ${FILESDIR}/${P}-statsdx-web.patch fi + epatch ${FILESDIR}/mod_irc_utf-8.patch + use pam && epatch ${FILESDIR}/check_pam.diff # http://ejabberd.jabber.ru/pam use mod_proxy && epatch ${FILESDIR}/${P}-mod-proxy.patch # http://bugs.gentoo.org/show_bug.cgi?id=137724 use mod_pep && epatch ${FILESDIR}/mod_pep.patch # http://www.dtek.chalmers.se/~henoch/text/ejabberd-pep.html - use http_binding && epatch ${WORKDIR}/ejabberd-1.1.1_httpbind/ejabberd-1.1.1_httpbind.patch.gz # http://blog.mabber.de/eintrag.php?id=34 + #use http_binding && epatch ${WORKDIR}/ejabberd-1.1.1_httpbind/ejabberd-1.1.1_httpbind.patch.gz # http://blog.mabber.de/eintrag.php?id=34 + use http_binding && ( cd .. ; epatch ${FILESDIR}/http_binding.patch ;) # http://www.jabber.ru/bugzilla/show_bug.cgi?id=91 use mod_archive && cp ${FILESDIR}/mod_archive.erl ${S} # http://ejabberd.jabber.ru/mod_archive if use mod_presence; then diff --git a/net-im/ejabberd/files/http_binding.patch b/net-im/ejabberd/files/http_binding.patch index a3f5c8b9..95b2deae 100644 --- a/net-im/ejabberd/files/http_binding.patch +++ b/net-im/ejabberd/files/http_binding.patch @@ -29,18 +29,18 @@ Index: src/web/ejabberd_http_bind.erl =================================================================== --- src/web/ejabberd_http_bind.erl (Revision 0) +++ src/web/ejabberd_http_bind.erl (Revision 0) -@@ -0,0 +1,654 @@ +@@ -0,0 +1,804 @@ +%%%---------------------------------------------------------------------- +%%% File : ejabberd_http_bind.erl +%%% Author : Stefan Strigler <steve@zeank.in-berlin.de> +%%% Purpose : HTTP Binding support (JEP-0124) +%%% Created : 21 Sep 2005 by Stefan Strigler <steve@zeank.in-berlin.de> -+%%% Id : $Id: ejabberd_http_bind.erl,v 1.2 2006/01/16 10:47:50 zeank Exp $ ++%%% Id : $Id: $ +%%%---------------------------------------------------------------------- + +-module(ejabberd_http_bind). +-author('steve@zeank.in-berlin.de'). -+-vsn('$Revision: 1.2 $ '). ++-vsn('Revision: 1.4'). + +-behaviour(gen_fsm). + @@ -58,13 +58,13 @@ Index: src/web/ejabberd_http_bind.erl + close/1, + process_request/1]). + -+%-define(ejabberd_debug, true). ++%%-define(ejabberd_debug, true). + +-include("ejabberd.hrl"). +-include("jlib.hrl"). +-include("ejabberd_http.hrl"). + -+-record(http_bind, {id, pid, hold, wait}). ++-record(http_bind, {id, pid, to, hold, wait}). + +%% http binding request +-record(hbr, {rid, @@ -139,7 +139,9 @@ Index: src/web/ejabberd_http_bind.erl + XmppDomain = xml:get_attr_s("to",Attrs), + if + (ID1 == "") and (XmppDomain == "") -> -+ {200, [?CT], "<body type='terminate' condition='improper-addressing' xmlns='http://jabber.org/protocol/httpbind'/>"}; ++ {200, [?CT], "<body type='terminate' " ++ "condition='improper-addressing' " ++ "xmlns='http://jabber.org/protocol/httpbind'/>"}; + true -> + ID = if + (ID1 == "") -> @@ -160,7 +162,8 @@ Index: src/web/ejabberd_http_bind.erl + end + end, + Hold = case -+ string:to_integer(xml:get_attr_s("hold",Attrs)) ++ string:to_integer( ++ xml:get_attr_s("hold",Attrs)) + of + {error, _} -> + (?MAX_REQUESTS - 1); @@ -176,21 +179,28 @@ Index: src/web/ejabberd_http_bind.erl + fun() -> + mnesia:write(#http_bind{id = NewID, + pid = Pid, ++ to = XmppDomain, + wait = Wait, + hold = Hold}) + end), -+ InPacket = if -+ (XmppDomain /= "") -> -+ ["<stream:stream to='", -+ XmppDomain, -+ "' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>"]; -+ true -> -+ "" ++ StreamStart = if ++ (XmppDomain /= "") -> ++ true; ++ true -> ++ false + end, ++ InPacket = Packet, + NewID; + true -> + %% old session + Type = xml:get_attr_s("type",Attrs), ++ StreamStart = ++ case xml:get_attr_s("xmpp:restart",Attrs) of ++ "true" -> ++ true; ++ _ -> ++ false ++ end, + Wait = ?MAX_WAIT, + Hold = (?MAX_REQUESTS - 1), + if @@ -202,11 +212,13 @@ Index: src/web/ejabberd_http_bind.erl + end, + ID1 + end, -+ ?DEBUG("~n InPacket: ~s ~n", [InPacket]), -+ case http_put(ID, RID, Key, NewKey, Hold, InPacket) of ++%% ?DEBUG("~n InPacket: ~s ~n", [InPacket]), ++ case http_put(ID, RID, Key, NewKey, Hold, InPacket, StreamStart) of + {error, not_exists} -> ++ ?DEBUG("no session associated with sid: ~p", [ID]), + {404, [?BAD_REQUEST], ""}; + {error, bad_key} -> ++ ?DEBUG("bad key: ~s", [Key]), + case mnesia:dirty_read({http_bind, ID}) of + [] -> + {404, [?BAD_REQUEST], ""}; @@ -215,6 +227,7 @@ Index: src/web/ejabberd_http_bind.erl + {404, [?BAD_REQUEST], ""} + end; + {error, polling_too_frequently} -> ++ ?DEBUG("polling too frequently: ~p", [ID]), + case mnesia:dirty_read({http_bind, ID}) of + [] -> %% unlikely! (?) + {404, [?BAD_REQUEST], ""}; @@ -223,7 +236,8 @@ Index: src/web/ejabberd_http_bind.erl + {403, [?BAD_REQUEST], ""} + end; + {repeat, OutPacket} -> -+ ?DEBUG("http_put said 'repeat!' ...", []), ++ ?DEBUG("http_put said 'repeat!' ...~nOutPacket: ~p", ++ [OutPacket]), + send_outpacket(ID, OutPacket); + ok -> + receive_loop(ID,ID1,RID,Wait,Hold,Attrs) @@ -245,29 +259,50 @@ Index: src/web/ejabberd_http_bind.erl +prepare_response(ID,ID1,RID,Wait,Hold,Attrs) -> + case http_get(ID,RID) of + {error, not_exists} -> ++ ?DEBUG("no session associated with sid: ~s", ID), + {404, [?BAD_REQUEST], ""}; + {ok, keep_on_hold} -> + receive_loop(ID,ID1,RID,Wait,Hold,Attrs); ++ {ok, cancel} -> ++ %% actually it would be better if we could completely ++ %% cancel this request, but then we would have to hack ++ %% ejabberd_http and I'm too lazy now ++ {404, [?BAD_REQUEST], ""}; + {ok, OutPacket} -> ++ ?DEBUG("OutPacket: ~s", [OutPacket]), + if + ID == ID1 -> + send_outpacket(ID, OutPacket); + true -> + To = xml:get_attr_s("to",Attrs), -+ case xml_stream:parse_element(OutPacket++"</stream:stream>") of -+ El when element(1, El) == xmlelement -> -+ {xmlelement, _, OutAttrs, _} = El, -+ AuthID = xml:get_attr_s("id", OutAttrs), -+ StreamError = false; -+ {error, _} -> -+ AuthID = "", -+ StreamError = true -+ end, ++ OutEls = case xml_stream:parse_element( ++ OutPacket++"</stream:stream>") of ++ El when element(1, El) == xmlelement -> ++ {xmlelement, _, OutAttrs, Els} = El, ++ AuthID = xml:get_attr_s("id", OutAttrs), ++ StreamError = false, ++ case Els of ++ [] -> ++ []; ++ [{xmlelement, "stream:features", StreamAttribs, StreamEls} | StreamTail] -> ++ [{xmlelement, "stream:features", [{"xmlns:stream","http://etherx.jabber.org/streams"}] ++ StreamAttribs, StreamEls}] ++ StreamTail; ++ Xml -> ++ Xml ++ end; ++ {error, _} -> ++ AuthID = "", ++ StreamError = true, ++ [] ++ end, + if + To == "" -> -+ {200, [?CT], "<body type='terminate' condition='improper-addressing' xmlns='http://jabber.org/protocol/httpbind'/>"}; ++ {200, [?CT], "<body type='terminate' " ++ "condition='improper-addressing' " ++ "xmlns='http://jabber.org/protocol/httpbind'/>"}; + StreamError == true -> -+ {200, [?CT], "<body type='terminate' condition='host-unknown' xmlns='http://jabber.org/protocol/httpbind'/>"}; ++ {200, [?CT], "<body type='terminate' " ++ "condition='host-unknown' " ++ "xmlns='http://jabber.org/protocol/httpbind'/>"}; + true -> + {200, [?CT], + xml:element_to_string( @@ -277,10 +312,11 @@ Index: src/web/ejabberd_http_bind.erl + {"sid",ID}, + {"wait", integer_to_list(Wait)}, + {"requests", integer_to_list(Hold+1)}, -+ {"inactivity", integer_to_list(trunc(?MAX_INACTIVITY/1000))}, ++ {"inactivity", ++ integer_to_list(trunc(?MAX_INACTIVITY/1000))}, + {"polling", ?MIN_POLLING}, + {"authid", AuthID} -+ ],[]})} ++ ],OutEls})} + end + end + end. @@ -302,9 +338,10 @@ Index: src/web/ejabberd_http_bind.erl + of + El when element(1, El) == xmlelement -> + {xmlelement, _, _, OEls} = El, -+ TypedEls = [xml:replace_tag_attr("xmlns","jabber:client",OEl) || ++ TypedEls = [xml:replace_tag_attr("xmlns", ++ "jabber:client",OEl) || + OEl <- OEls], -+ ?DEBUG(" --- outgoing data --- ~n~s~n --- outgoing data END --- ~n", ++ ?DEBUG(" --- outgoing data --- ~n~s~n --- END --- ~n", + [xml:element_to_string( + {xmlelement,"body", + [{"xmlns", @@ -317,13 +354,71 @@ Index: src/web/ejabberd_http_bind.erl + [{"xmlns", + "http://jabber.org/protocol/httpbind"}], + TypedEls})}; -+ {error, _} -> -+ case mnesia:dirty_read({http_bind, ID}) of -+ [#http_bind{pid = FsmRef}] -> -+ gen_fsm:sync_send_all_state_event(FsmRef,stop) -+ end, -+ {200, [?CT], -+ "<body type='terminate' condition='internal-server-error' xmlns='http://jabber.org/protocol/httpbind'/>"} ++ {error, _E} -> ++ OutEls = case xml_stream:parse_element( ++ OutPacket++"</stream:stream>") of ++ SEl when element(1, SEl) == xmlelement -> ++ {xmlelement, _, _OutAttrs, SEls} = SEl, ++ StreamError = false, ++ case SEls of ++ [] -> ++ []; ++ [{xmlelement, "stream:features", StreamAttribs, StreamEls} | StreamTail] -> ++ TypedTail = [xml:replace_tag_attr("xmlns", ++ "jabber:client",OEl) || ++ OEl <- StreamTail], ++ [{xmlelement, "stream:features", [{"xmlns:stream","http://etherx.jabber.org/streams"}] ++ StreamAttribs, StreamEls}] ++ TypedTail; ++ Xml -> ++ Xml ++ end; ++ {error, _} -> ++ StreamError = true, ++ [] ++ end, ++ if ++ StreamError -> ++ StreamErrCond = case xml_stream:parse_element( ++ "<stream:stream>"++OutPacket) of ++ El when element(1, El) == xmlelement -> ++ {xmlelement, _Tag, _Attr, Els} = El, ++ [{xmlelement, SE, _, Cond} | _] = Els, ++ if ++ SE == "stream:error" -> ++ Cond; ++ true -> ++ null ++ end; ++ {error, _E} -> ++ null ++ end, ++ case mnesia:dirty_read({http_bind, ID}) of ++ [#http_bind{pid = FsmRef}] -> ++ gen_fsm:sync_send_all_state_event(FsmRef,stop); ++ _ -> ++ err %% hu? ++ end, ++ case StreamErrCond of ++ null -> ++ {200, [?CT], ++ "<body type='terminate' " ++ "condition='internal-server-error' " ++ "xmlns='http://jabber.org/protocol/httpbind'/>"}; ++ _ -> ++ {200, [?CT], ++ "<body type='terminate' " ++ "condition='remote-stream-error' " ++ "xmlns='http://jabber.org/protocol/httpbind'>" ++ ++ elements_to_string(StreamErrCond) ++ ++ "</body>"} ++ end; ++ true -> ++ {200, [?CT], ++ xml:element_to_string( ++ {xmlelement,"body", ++ [{"xmlns", ++ "http://jabber.org/protocol/httpbind"}], ++ OutEls})} ++ end + end + end. + @@ -395,19 +490,21 @@ Index: src/web/ejabberd_http_bind.erl +handle_sync_event(activate, From, StateName, StateData) -> + case StateData#state.input of + "" -> -+ {reply, ok, StateName, StateData#state{waiting_input = From}}; ++ {reply, ok, StateName, StateData#state{ ++ waiting_input = From}}; + Input -> + From ! {tcp, {http_bind, self()}, list_to_binary(Input)}, -+ {reply, ok, StateName, StateData#state{input = "", -+ waiting_input = false, -+ last_receiver = From}} ++ {reply, ok, StateName, StateData#state{ ++ input = "", ++ waiting_input = false, ++ last_receiver = From}} + end; + +handle_sync_event(stop, _From, _StateName, StateData) -> + Reply = ok, + {stop, normal, Reply, StateData}; + -+handle_sync_event({http_put, RID, Key, NewKey, Hold, Packet}, ++handle_sync_event({http_put, RID, Key, NewKey, Hold, Packet, StartTo}, + _From, StateName, StateData) -> + %% check if RID valid + RidAllow = case RID of @@ -419,11 +516,14 @@ Index: src/web/ejabberd_http_bind.erl + %% first request - nothing saved so far + true; + OldRID -> -+ ?DEBUG("state.rid/cur rid: ~p/~p", [OldRID, RID]), ++ ?DEBUG("state.rid/cur rid: ~p/~p", ++ [OldRID, RID]), + if -+ (OldRID < RID) and (RID =< (OldRID + Hold + 1)) -> ++ (OldRID < RID) and ++ (RID =< (OldRID + Hold + 1)) -> + true; -+ (RID =< OldRID) and (RID > OldRID - Hold - 1) -> ++ (RID =< OldRID) and ++ (RID > OldRID - Hold - 1) -> + repeat; + true -> + false @@ -441,9 +541,11 @@ Index: src/web/ejabberd_http_bind.erl + "" -> + true; + OldKey -> -+ NextKey = httpd_util:to_lower(hex( -+ binary_to_list(crypto:sha(Key)))), -+ ?DEBUG("Key/OldKey/NextKey: ~s/~s/~s", [Key, OldKey, NextKey]), ++ NextKey = httpd_util:to_lower( ++ hex(binary_to_list( ++ crypto:sha(Key)))), ++ ?DEBUG("Key/OldKey/NextKey: ~s/~s/~s", ++ [Key, OldKey, NextKey]), + if + OldKey == NextKey -> + true; @@ -459,11 +561,12 @@ Index: src/web/ejabberd_http_bind.erl + Packet == "" -> + TNow; + true -> -+ StateData#state.last_poll ++ 0 + end, + {MinPoll, _} = string:to_integer(?MIN_POLLING), + if -+ (Packet == "") and (TNow - StateData#state.last_poll < MinPoll*1000*1000) -> ++ (Packet == "") and ++ (TNow - StateData#state.last_poll < MinPoll*1000*1000) -> + Reply = {error, polling_too_frequently}, + {reply, Reply, StateName, StateData}; + KeyAllow -> @@ -472,15 +575,18 @@ Index: src/web/ejabberd_http_bind.erl + Reply = {error, not_exists}, + {reply, Reply, StateName, StateData}; + repeat -> -+ ?DEBUG("repeating ~p", [RID]), -+ [Out | _XS] = [El#hbr.out || El <- StateData#state.req_list, El#hbr.rid == RID], ++ ?DEBUG("REPEATING ~p", [RID]), ++ [Out | _XS] = [El#hbr.out || ++ El <- StateData#state.req_list, ++ El#hbr.rid == RID], + case Out of + [[] | OutPacket] -> + Reply = {repeat, OutPacket}; + _ -> + Reply = {repeat, Out} + end, -+ {reply, Reply, StateName, StateData#state{last_poll = LastPoll}}; ++ {reply, Reply, StateName, ++ StateData#state{input = "cancel", last_poll = LastPoll}}; + true -> + SaveKey = if + NewKey == "" -> @@ -497,15 +603,15 @@ Index: src/web/ejabberd_http_bind.erl + out=StateData#state.output + } | + [El || El <- StateData#state.req_list, -+ El#hbr.rid < RID, El#hbr.rid > (RID - 1 - Hold) ] ++ El#hbr.rid < RID, ++ El#hbr.rid > (RID - 1 - Hold)] + ], -+ -+ ?DEBUG("reqlist: ~p", [ReqList]), -+ ++%% ?DEBUG("reqlist: ~p", [ReqList]), + case StateData#state.waiting_input of + false -> + cancel_timer(StateData#state.timer), -+ Timer = erlang:start_timer(?MAX_INACTIVITY, self(), []), ++ Timer = erlang:start_timer( ++ ?MAX_INACTIVITY, self(), []), + Input = Packet ++ [StateData#state.input], + Reply = ok, + {reply, Reply, StateName, @@ -518,10 +624,23 @@ Index: src/web/ejabberd_http_bind.erl + req_list = ReqList + }}; + {Receiver, _Tag} -> ++ SendPacket = ++ if ++ StartTo /= "" -> ++ ["<stream:stream to='", ++ StartTo, ++ "' xmlns='jabber:client' " ++ "version='1.0' " ++ "xmlns:stream='http://etherx.jabber.org/streams'>"] ++ Packet; ++ true -> ++ Packet ++ end, ++ ?DEBUG("really sending now: ~s", [SendPacket]), + Receiver ! {tcp, {http_bind, self()}, -+ list_to_binary(Packet)}, ++ list_to_binary(SendPacket)}, + cancel_timer(StateData#state.timer), -+ Timer = erlang:start_timer(?MAX_INACTIVITY, self(), []), ++ Timer = erlang:start_timer( ++ ?MAX_INACTIVITY, self(), []), + Reply = ok, + {reply, Reply, StateName, + StateData#state{waiting_input = false, @@ -544,17 +663,21 @@ Index: src/web/ejabberd_http_bind.erl +handle_sync_event({http_get, RID, Wait, Hold}, _From, StateName, StateData) -> + {_,TSec,TMSec} = now(), + TNow = TSec*1000*1000 + TMSec, -+%% ?DEBUG("Wait/Hold/cTime/Now: ~p/~p/~p/~p", [Wait, Hold, StateData#state.ctime,TNow]), + cancel_timer(StateData#state.timer), + Timer = erlang:start_timer(?MAX_INACTIVITY, self(), []), + if + (Hold > 0) and + (StateData#state.output == "") and + ((TNow - StateData#state.ctime) < (Wait*1000*1000)) and -+ (StateData#state.rid == RID) -> ++ (StateData#state.rid == RID) and ++ (StateData#state.input /= "cancel") -> + Output = StateData#state.output, + ReqList = StateData#state.req_list, + Reply = {ok, keep_on_hold}; ++ (StateData#state.input == "cancel") -> ++ Output = StateData#state.output, ++ ReqList = StateData#state.req_list, ++ Reply = {ok, cancel}; + true -> + case StateData#state.output of + [[]| OutPacket] -> @@ -573,9 +696,11 @@ Index: src/web/ejabberd_http_bind.erl + ], + Output = "" + end, -+ {reply, Reply, StateName, StateData#state{output = Output, -+ timer = Timer, -+ req_list = ReqList}}; ++ {reply, Reply, StateName, StateData#state{ ++ input = "", ++ output = Output, ++ timer = Timer, ++ req_list = ReqList}}; + +handle_sync_event(_Event, _From, StateName, StateData) -> + Reply = ok, @@ -624,13 +749,22 @@ Index: src/web/ejabberd_http_bind.erl +%%%---------------------------------------------------------------------- + + -+http_put(ID, RID, Key, NewKey, Hold, Packet) -> ++http_put(ID, RID, Key, NewKey, Hold, Packet, Restart) -> ++ ?DEBUG("http-put",[]), + case mnesia:dirty_read({http_bind, ID}) of + [] -> ++ ?DEBUG("not found",[]), + {error, not_exists}; -+ [#http_bind{pid = FsmRef}] -> -+ gen_fsm:sync_send_all_state_event( -+ FsmRef, {http_put, RID, Key, NewKey, Hold, Packet}) ++ [#http_bind{pid = FsmRef,to=To}] -> ++ case Restart of ++ true -> ++ ?DEBUG("restart requested for ~s", [To]), ++ gen_fsm:sync_send_all_state_event( ++ FsmRef, {http_put, RID, Key, NewKey, Hold, Packet, To}); ++ _ -> ++ gen_fsm:sync_send_all_state_event( ++ FsmRef, {http_put, RID, Key, NewKey, Hold, Packet, ""}) ++ end + end. + +http_get(ID,RID) -> @@ -638,12 +772,14 @@ Index: src/web/ejabberd_http_bind.erl + [] -> + {error, not_exists}; + [#http_bind{pid = FsmRef, wait = Wait, hold = Hold}] -> -+ gen_fsm:sync_send_all_state_event(FsmRef, {http_get, RID, Wait, Hold}) ++ gen_fsm:sync_send_all_state_event(FsmRef, ++ {http_get, RID, Wait, Hold}) + end. + + +parse_request(Data) -> -+ ?DEBUG("--- incoming data --- ~n~s~n --- END incoming data END --- ",[Data]), ++ ?DEBUG("--- incoming data --- ~n~s~n --- END --- ", ++ [Data]), + case xml_stream:parse_element(Data) of + El when element(1, El) == xmlelement -> + {xmlelement, Name, Attrs, Els} = El, @@ -652,8 +788,17 @@ Index: src/web/ejabberd_http_bind.erl + Key = xml:get_attr_s("key",Attrs), + NewKey = xml:get_attr_s("newkey",Attrs), + Xmlns = xml:get_attr_s("xmlns",Attrs), -+ Packet = [xml:element_to_string(xml:remove_tag_attr("xmlns",E)) || E <- Els], -+ ?DEBUG(" --- incoming packet --- ~n~s~n --- END incoming packet END --- ", [Packet]), ++ lists:map(fun(E) -> ++ EXmlns = xml:get_tag_attr_s("xmlns",E), ++ if ++ EXmlns == "jabber:client" -> ++ xml:remove_tag_attr("xmlns",E); ++ true -> ++ ok ++ end ++ end, Els), ++ Packet = [xml:element_to_string(E) || E <- Els], ++ ?DEBUG("ns fixed packet(s): ~s", [Packet]), + if + Name /= "body" -> + {error, bad_request}; @@ -684,6 +829,11 @@ Index: src/web/ejabberd_http_bind.erl + true -> erlang:integer_to_list(H,16) + end, + [A,B|hex(T)]. ++ ++elements_to_string([]) -> ++ []; ++elements_to_string([El | Els]) -> ++ xml:element_to_string(El) ++ elements_to_string(Els). Index: src/web/ejabberd_web.erl =================================================================== --- src/web/ejabberd_web.erl (Revision 565) @@ -853,3 +1003,4 @@ Index: src/ejabberd_sup.erl + HTTPBindSupervisor, IQSupervisor, Listener]}}. + diff --git a/net-im/ejabberd/files/mod_irc_utf-8.patch b/net-im/ejabberd/files/mod_irc_utf-8.patch new file mode 100644 index 00000000..1f09aeeb --- /dev/null +++ b/net-im/ejabberd/files/mod_irc_utf-8.patch @@ -0,0 +1,11 @@ +--- src/mod_irc/mod_irc.erl.ori 2006-12-21 08:38:09.000000000 +0100 ++++ src/mod_irc/mod_irc.erl 2006-12-21 08:38:29.000000000 +0100 +@@ -27,7 +27,7 @@ + -include("ejabberd.hrl"). + -include("jlib.hrl"). + +--define(DEFAULT_IRC_ENCODING, "koi8-r"). ++-define(DEFAULT_IRC_ENCODING, "utf-8"). + + -record(irc_connection, {jid_server_host, pid}). + -record(irc_custom, {us_host, data}). |