24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-02 21:17:12 +02:00
Commit Graph

66 Commits

Author SHA1 Message Date
chengshq
5cf9b052dd
Jid format when multicastc was cached (#3950)
The error log:

```2022-11-22 04:10:25.436648+00:00 [error] <0.515.0>@ejabberd_router:route/1:95 Failed to route packet:
#message{
    id = <<>>,type = normal,lang = <<>>,
    from =
        #jid{
            user = <<"a123">>,server = <<"conference.example.com">>,
            resource = <<>>,luser = <<"a123">>,
            lserver = <<"conference.example.com">>,lresource = <<>>},
    to = <<"multicast.app.example.com">>,subject = [],body = [],
    thread = undefined,
    sub_els =
        [#ps_event{
             items =
                 #ps_items{
                     xmlns = <<>>,
                     node = <<"urn:xmpp:mucsub:nodes:subscribers">>,
                     items =
                         [#ps_item{
                              xmlns = <<>>,id = <<"5803948964051348597">>,
                              sub_els =
                                  [#muc_subscribe{
                                       nick = <<"bb">>,password = <<>>,
                                       jid = undefined,events = []}],
                              node = <<>>,publisher = <<>>}],
                     max_items = undefined,subid = <<>>,retract = undefined},
             purge = undefined,subscription = undefined,delete = undefined,
             create = undefined,configuration = undefined},
         #addresses{
             list =
                 [#address{
                      type = bcc,
                      jid =
                          #jid{
                              user = <<"aaa">>,server = <<"app.example.com">>,
                              resource = <<>>,luser = <<"aaa">>,
                              lserver = <<"app.example.com">>,lresource = <<>>},
                      desc = <<>>,node = <<>>,delivered = undefined,
                      sub_els = []},
                  #address{
                      type = bcc,
                      jid =
                          #jid{
                              user = <<"bb">>,server = <<"app.example.com">>,
                              resource = <<>>,luser = <<"bb">>,
                              lserver = <<"app.example.com">>,lresource = <<>>},
                      desc = <<>>,node = <<>>,delivered = undefined,
                      sub_els = []}]}],
    meta = #{}}
** exception error: {badrecord,jid}
   in function  ejabberd_router:do_route/1 (src/ejabberd_router.erl, line 394)
   in call from ejabberd_router:route/1 (src/ejabberd_router.erl, line 92)
   in call from maps:fold_1/3 (maps.erl, line 232)
   in call from mod_multicast:handle_info/2 (src/mod_multicast.erl, line 206)
   in call from gen_server:try_dispatch/4 (gen_server.erl, line 637)
   in call from gen_server:handle_msg/6 (gen_server.erl, line 711)
   in call from proc_lib:init_p_do_apply/3 (proc_lib.erl, line 249)```


Then command debug select the multicastc:
```
(ejabberd@localhost)2> mnesia:dirty_read(multicastc, <<"app.example.com">>).
[{multicastc,<<"app.example.com">>,
             {{multicast_supported,<<"multicast.app.example.com">>,
                                   {limits,{default,20},{default,20}}},
              cached},
             63836303692}]```

The type of `Service` was binary.
2022-11-22 12:11:31 +01:00
Badlop
b71a481e63 Add details about XEP implementations to some protocol attributes 2022-11-07 18:56:46 +01:00
Badlop
fac74f623e Remove unused macro definitions detected by rebar3_hank
?OFFLINE_TABLE_LOCK_THRESHOLD is unused:
  definition and usage added in 4103f30812
  definition copied, and usage moved to mod_offline_mnesia, in 901d2e0aed
  definition and usage removed in mod_offline_mnesia in d88e4d495f
  this definition looks useless
?VERSION_MULTICAST is unused:
  added in 0cf8d1fa6e
  it was never used
?DISCO_QUERY_TIMEOUT is unused:
  added in 0cf8d1fa6e
  it was never used
?FEATURE/1 is unused:
  added in 0cf8d1fa6e
  usage removed in bc33a3873d
?DEFAULT_MAX_USERS_PRESENCE is unused:
  added in f817762cc4
  usage removed in ba2b650464
?CT_XML is unused:
  added in 46568fb959
  removed in 3dc55c6d47
2022-09-16 16:34:56 +02:00
Badlop
b3211b1f71 Update copyright year to 2022 2022-02-11 09:39:25 +01:00
Paweł Chmielowski
405a5172d5 Improve mod_multicast 2021-11-17 11:32:42 +01:00
Emmet McPoland
509331a563 Correctly strip only other bcc addresses i.e. bcc receiver should still be able to see their bcc address element and no other bcc address element 2021-07-07 16:44:58 +01:00
Badlop
6e0161470e Update newest copyright year to 2021 (#3464) 2021-01-27 17:02:06 +01:00
Neustradamus
4132aedb9c
XEP-0033 (#3467)
XEP-0033
2021-01-05 10:05:42 +01:00
Stu Tomlinson
bd11a00f8f
Use include_lib() to include headers from dependencies (#3369) 2020-09-03 13:45:57 +02:00
Badlop
9d923e8e6d Update syntax of some options so they are better displayed in Docs 2020-05-12 21:33:00 +02:00
Badlop
2d32c66fd7 Update copyright to 2020 (#3149) 2020-01-28 15:49:23 +01:00
Paweł Chmielowski
75094df25e Do not use ~ts format in string that are put in xmpp payload
We are expecting utf8 data here, and using that flag will convert those
to unicode codepoints, which aren't handled properly later.
2020-01-22 12:55:27 +01:00
Evgeny Khramtsov
97da380acd Generate ejabberd.yml.5 man page from source code directly
Several documentation callbacks (doc/0 and mod_doc/0) are implemented
and `ejabberdctl man` command is added to generate a man page. Note
that the command requires a2x to be installed (which is a part of
asciidoc package).
2020-01-08 12:24:51 +03:00
Evgeny Khramtsov
5770946f03 Correctly handle unicode in log messages 2019-09-23 15:17:20 +03:00
Evgeny Khramtsov
2168489ddf Don't retain module option on gen_mod supervisor
When module's options were updated (e.g. by reloading ejabberd.yml)
and, later, the module's process crashed, gen_mod supervisor
restarts the process with outdated options. This is now fixed.
2019-08-04 21:46:18 +03:00
Evgeny Khramtsov
5a976719fb Introduce 'vcard' option for the modules supporting vCards
The mapping between vCard's XML elements and YAML elements
of 'vcard' option is straightforward. For example, if you
want mod_muc to return the following vCard:
```
<vCard xmlns='vcard-temp'>
  <FN>Conferences</FN>
  <ADR>
    <WORK/>
    <STREET>Elm Street</STREET>
  </ADR>
</vCard>
```
you need to set the configuration as:
```
modules:
  ...
  mod_muc:
    vcard:
      fn: Conferences
      adr:
        -
          work: true
          street: Elm Street
  ...
```
2019-08-02 13:59:42 +03:00
Badlop
630cfe26b7 mod_multicast service discovery bugfix (thanks to McPo)(#2968) 2019-07-29 19:32:26 +02:00
Evgeny Khramtsov
a3e0cbbdd8 Make logging messages more consistent 2019-06-24 20:32:34 +03:00
Evgeny Khramtsov
00f2a736eb Improve extraction of translated strings
Now every such string MUST be encapsulated into ?T() macro.
The macro itself is defined in include/translate.hrl.
Example:

-module(foo).
-export([bar/1]).
-include("translate.hrl").

bar(Lang) ->
    translate:translate(Lang, ?T("baz")).
2019-06-22 17:08:45 +03:00
Evgeny Khramtsov
a205ebad2b Get rid of "well-known" type 2019-06-15 12:53:16 +03:00
Evgeny Khramtsov
a02cff0e78 Use new configuration validator 2019-06-14 12:33:26 +03:00
Badlop
55417dfb37 Update copyright to 2019 (#2756) 2019-01-08 22:53:27 +01:00
Alexey Shchepin
48594544ed Fix for the previous commit 2018-11-09 14:18:48 +03:00
Alexey Shchepin
d16b99d830 Track presences sent via a multicast service 2018-11-09 03:27:24 +03:00
Badlop
9f7d3520aa Fix unused variable warning 2018-11-06 00:08:45 +01:00
Badlop
602bfa3c3c Local stanzas are routed one by one, not by multicast 2018-11-06 00:07:34 +01:00
Evgeny Khramtsov
2d246f61dd Fix some dialyzer warnings 2018-09-09 09:59:08 +03:00
Evgeniy Khramtsov
68d12017cc Better detection of duplicated routes/hosts 2018-07-08 20:28:11 +03:00
Evgeniy Khramtsov
ed1ee6061e Move move randoms module to p1_utils repo 2018-07-05 11:51:49 +03:00
Evgeniy Khramtsov
9e83c45b3c Restore forgotten translations from previous commit 2018-06-20 12:50:36 +03:00
Evgeniy Khramtsov
fd8e07af47 Get rid of ejabberd.hrl header
The header consisted of too many unrelated stuff and macros misuse.
Some stuff is moved into scram.hrl and type_compat.hrl.
All macros have been replaced with the corresponding function calls.

TODO: probably type_compat.hrl is not even needed anymore since
we support only Erlang >= OTP 17.5
2018-06-14 14:00:47 +03:00
Paweł Chmielowski
45a3c7e0ce Improve mod_multicast 2018-04-04 12:06:35 +02:00
Evgeniy Khramtsov
b283cfa6f2 Remove unused variable 2018-03-29 10:34:09 +03:00
Paweł Chmielowski
dfbdffad44 Fix process_discoitems_result in mod_multicast 2018-03-28 11:23:28 +02:00
Evgeniy Khramtsov
ba2b650464 Introduce new gen_mod callback: mod_options/1
The callback is supposed to provide known options and their default
values, as long as the documentation. Passing default values into
get_mod functions is now deprecated: all defaults should be provided
by the Mod:mod_options/1 callback.
2018-01-23 10:54:52 +03:00
Evgeniy Khramtsov
9d94361466 Process 'name' option for all route-registering modules
The option allows to set arbitrary text for disco#info identity name.
Previously, option 'name' was supported by mod_proxy65 and mod_http_upload
only. Now, all the following modules support this option as well:
- mod_disco
- mod_irc
- mod_muc
- mod_multicast
- mod_pubsub
- mod_vcard

Example:
```
modules:
  ...
  mod_disco:
    name: "Cool XMPP Server"
  ...
```
2018-01-08 11:29:17 +03:00
Evgeniy Khramtsov
cdc7c1d1ed Update copyright dates 2018-01-05 23:18:58 +03:00
Evgeniy Khramtsov
bd064fa3fc Use xmpp:try_subtag/2 wherever possible 2017-12-11 09:46:26 +03:00
Evgeniy Khramtsov
f953621ed2 Use xmpp:io_format_error/1 wherever possible 2017-11-14 09:02:43 +03:00
Badlop
0b02d42836 Fix mod_multicast start and reading of configured limits (#1949) 2017-08-18 14:09:49 +02:00
Badlop
4ef1cdec12 Write validator for mod_multicast's limits option 2017-06-26 13:39:50 +02:00
Badlop
0534678028 Use YAML syntax for limits option in mod_multicast 2017-06-26 11:26:53 +02:00
Evgeniy Khramtsov
fddd6110e0 Don't validate an option in gen_mod:get*opt() functions
The changes are very similar to those from previous commit:
* Now there is no need to pass validating function in
  gen_mod:get_opt() and gen_mod:get_module_opt() functions,
  because the modules' configuration keeps already validated values.
* New functions gen_mod:get_opt/2 and gen_mod:get_module_opt/3 are
  introduced.
* Functions gen_mod:get_opt/4 and get_module_opt/5 are deprecated.
  If the functions are still called, the "function" argument is
  simply ignored.
* Validating callback Mod:listen_opt_type/1 is introduced to validate
  listening options at startup.
2017-04-30 19:01:47 +03:00
Evgeniy Khramtsov
c1439ddd5b Get rid of jid:to_string/1 and jid:from_string/1 2017-02-26 10:07:12 +03:00
Evgeniy Khramtsov
3c4057ff55 Reload modules when reloading configuration file 2017-02-22 19:46:47 +03:00
Evgeniy Khramtsov
8b2d308498 Change routing API
Now 'From' and 'To' arguments must be omitted in functions
and structures related to routing.
The commit deprecates the following functions:
     ejabberd_router:route/3 in favor of ejabberd_router:route/1
     ejabberd_router:route_error/4 in favor of ejabberd_router:route_error/2
     ejabberd_local:route_iq/4 in favor of ejabberd_local:route_iq/2
     ejabberd_local:route_iq/5 in favor of ejabberd_local:route_iq/3
The format of {route, From, To, Packet} is changed in favor of {route, Packet}
2017-02-16 11:10:24 +03:00
Evgeniy Khramtsov
28f66ddd7c Attach modules to gen_mod's supervisor 2017-02-14 12:39:26 +03:00
Evgeniy Khramtsov
f664e39374 Improve modules start/stop procedures 2017-02-14 10:25:08 +03:00
Badlop
5fdd1c39fe Update copyright date automatically (#1442) 2017-01-02 21:42:06 +01:00
Christophe Romain
92db9ff105 Improve handling of mnesia schema 2016-11-30 11:09:17 +01:00