Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Crash #8

wants to merge 2 commits into from

Conversation

msantos
Copy link

@msantos msantos commented Jul 9, 2019

Fixes a crash if a bot joins a group chat with an avatar set in a vcard.

~~~
Compiling 1 file (.ex)
warning: variable "opts" is unused (if the variable is not meant to be used, prefix it with an underscore)
  lib/hedwig_xmpp.ex:109: Hedwig.Adapters.XMPP.handle_info/2

warning: variable "ns_muc_user" does not exist and is being expanded to "ns_muc_user()", please use parentheses to remove the ambiguity or change the variable name
  lib/hedwig_xmpp.ex:151: Hedwig.Adapters.XMPP.contains_muc_user_namespace?/1

warning: variable "self" does not exist and is being expanded to "self()", please use parentheses to remove the ambiguity or change the variable name
  lib/hedwig_xmpp.ex:161: Hedwig.Adapters.XMPP.get_roster/2

warning: variable "self" does not exist and is being expanded to "self()", please use parentheses to remove the ambiguity or change the variable name
  lib/hedwig_xmpp.ex:184: Hedwig.Adapters.XMPP.request_all_rooms/2
~~~
An "x" element without an item field will cause the bot to crash:

~~~
** (FunctionClauseError) no function clause matching in
:fxml.get_subtag/2
    (fast_xml)
fxml.erl:175:
:fxml.get_subtag(nil, "item")
    (romeo) lib/romeo/xml.ex:45: Romeo.XML.subelement/3
    (hedwig_xmpp) lib/hedwig_xmpp.ex:142:
Hedwig.Adapters.XMPP.real_jid_from_room_presence/1
~~~

For example, if a group chat contains a vcard for an avatar:

~~~
{:xmlel, "presence", [{"to", "dest"}, {"from", "source@muc"}, {"id", "1234"}],
 [
   {:xmlel, "x", [{"xmlns", "vcard-temp:x:update"}],
    [{:xmlel, "photo", [], [xmlcdata: "5678"]}]},
   {:xmlel, "c",
    [
      {"xmlns", "http://jabber.org/protocol/caps"},
      {"ver", "jiZ985RsHMpIJvoWKUczSnQ5MSs="},
      {"node", "http://www.process-one.net/en/ejabberd/"},
      {"hash", "sha-1"}
    ], []}
 ]}
~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant