Smack 4.4.0-alpha3: MultiUserChat Proper handling of join chat room with captcha challenge protection

Below is a capture of the aTalk debug log when joining chat room protected with captcha challenge.

Detail process when join room with captcha protection in aTalk:
a. On receive an invitation to join group chat, user click accept in invitation dialog to join room.
b. Instead of accepting invitation, the server returns with a captcha challenge message.
c. aTalk displays the captcha challenge prompt to user
d. Before user replies to the captcha challenge prompt, smack throws response timeout (5 seconds)
e. aTalk ignores this timeout, and continue to allow user to reply to the captcha prompt
f. When the captcha reply is validated, server proceeds to send <presence/>, indicating the join room has been completed successfully.
e. Because of the response timeout, smack is not in sync with the server status, and created problems either in sending or receiving messages from the conference room.

In all previous aTalk releases, it extends the smack reply time to 30s before join room, so as to allow time for user to reply. This works under normal condition when aTalk is in foreground. However this approach created problem when the captcha challenge prompt is not in focus i.e. invisible to user behind other views; the whole aTalk just hangs with Android Not Response (ANR) problem.

Appreciate if smack can look into uncouple the join room reply <presence> with join room stanza sending. Alternatively to provide a method call for app to update the room join status.

2020-02-08 10:25:15.835 25311-25965/org.atalk.android D/SMACK: RECV (0): 
    <message to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org'>
      <x xmlns='http://jabber.org/protocol/muc#user'>
        <invite from='leopard@atalk.org/atalk'>
          <reason>
            Group chat invitation
          </reason>
        </invite>
      </x>
      <x reason='Group chat invitation' jid='chatroom-f3ji@conference.atalk.org' xmlns='jabber:x:conference'/>
      <body xml:lang='en'>
        leopard@atalk.org/atalk invites you to the room chatroom-f3ji@conference.atalk.org (Group chat invitation) 
      </body>
    </message>

2020-02-08 10:25:27.073 25311-25963/org.atalk.android D/SMACK: SENT (0): 
    <iq to='chatroom-f3ji@conference.atalk.org' id='W8VII-127' type='get'>
      <query xmlns='http://jabber.org/protocol/disco#info'>
      </query>
    </iq>
2020-02-08 10:25:27.096 25311-25965/org.atalk.android D/SMACK: RECV (0): 
    <iq xml:lang='en-GB' to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org' type='result' id='W8VII-127'>
      <query xmlns='http://jabber.org/protocol/disco#info'>
        <identity name='chatroom-f3ji' type='text' category='conference'/>
        <feature var='vcard-temp'/>
        <feature var='http://jabber.org/protocol/muc'/>
        <feature var='muc_hidden'/>
        <feature var='muc_temporary'/>
        <feature var='muc_open'/>
        <feature var='muc_nonanonymous'/>
        <feature var='muc_moderated'/>
        <feature var='muc_unsecured'/>
        <feature var='urn:xmpp:mam:tmp'/>
        <feature var='urn:xmpp:mam:0'/>
        <feature var='urn:xmpp:mam:1'/>
        <feature var='urn:xmpp:mam:2'/>
        <feature var='urn:xmpp:sid:0'/>
        <x type='result' xmlns='jabber:x:data'>
          <field var='FORM_TYPE' type='hidden'>
            <value>
              http://jabber.org/protocol/muc#roominfo
            </value>
          </field>
          <field var='muc#roominfo_occupants' type='text-single' label='Number of occupants'>
            <value>
              1
            </value>
          </field>
          <field var='muc#roomconfig_roomname' type='text-single' label='Natural-Language Room Name'/>
          <field var='muc#roominfo_description' type='text-single' label='Room description'/>
          <field var='muc#roominfo_contactjid' type='jid-multi' label='Contact Addresses (normally, room owner or owners)'>
            <value>
              leopard@atalk.org
            </value>
          </field>
          <field var='muc#roominfo_changesubject' type='boolean' label='Occupants May Change the Subject'>
            <value>
              1
            </value>
          </field>
          <field var='muc#roomconfig_allowinvites' type='boolean' label='Occupants are allowed to invite others'>
            <value>
              1
            </value>
          </field>
          <field var='muc#roomconfig_allowpm' type='list-single' label='Roles that May Send Private Messages'>
            <value>
              anyone
            </value>
            <option label='Anyone'>
              <value>
                anyone
              </value>
            </option>
            <option label='Anyone with Voice'>
              <value>
                participants
              </value>
            </option>
            <option label='Moderators Only'>
              <value>
                moderators
              </value>
            </option>
            <option label='Nobody'>
              <value>
                none
              </value>
            </option>
          </field>
          <field var='muc#roominfo_lang' type='text-single' label='Natural Language for Room Discussions'>
            <value/>
          </field>
        </x>
      </query>
    </iq>
2020-02-08 10:25:27.139 25311-25963/org.atalk.android D/SMACK: SENT (0): 
    <iq to='conference.atalk.org' id='W8VII-130' type='get'>
      <query xmlns='http://jabber.org/protocol/disco#info'>
      </query>
    </iq>
2020-02-08 10:25:27.156 25311-25965/org.atalk.android D/SMACK: RECV (0): 
    <a h='25' xmlns='urn:xmpp:sm:3'/>
2020-02-08 10:25:27.163 25311-25965/org.atalk.android D/SMACK: RECV (0): 
    <iq xml:lang='en-GB' to='swordfish@atalk.org/atalk' from='conference.atalk.org' type='result' id='W8VII-130'>
      <query xmlns='http://jabber.org/protocol/disco#info'>
        <identity name='Chatrooms' type='text' category='conference'/>
        <feature var='http://jabber.org/protocol/disco#info'/>
        <feature var='http://jabber.org/protocol/disco#items'/>
        <feature var='http://jabber.org/protocol/muc'/>
        <feature var='vcard-temp'/>
        <feature var='urn:xmpp:mucsub:0'/>
        <feature var='http://jabber.org/protocol/muc#unique'/>
        <feature var='jabber:iq:register'/>
        <feature var='http://jabber.org/protocol/rsm'/>
        <feature var='urn:xmpp:mam:tmp'/>
        <feature var='urn:xmpp:mam:0'/>
        <feature var='urn:xmpp:mam:1'/>
        <feature var='urn:xmpp:mam:2'/>
        <x type='result' xmlns='jabber:x:data'>
          <field var='FORM_TYPE' type='hidden'>
            <value>
              http://jabber.org/network/serverinfo
            </value>
          </field>
        </x>
      </query>
    </iq>
2020-02-08 10:25:27.177 25311-25963/org.atalk.android D/SMACK: SENT (0): 
    <a xmlns='urn:xmpp:sm:3' h='43'/>
    <presence to='chatroom-f3ji@conference.atalk.org/swordfish' id='W8VII-129'>
      <x xmlns='http://jabber.org/protocol/muc'>
      </x>
      <c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://android.atalk.org' ver='C8m/4hb7TJHmm8dpt7KpttXz6sY='/>
    </presence>

2020-02-08 10:25:27.400 25311-25965/org.atalk.android D/SMACK: RECV (0): 
    <message to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org' id='17267810418355597201'>
      <x xmlns='jabber:x:oob'>
        <url>
          https://atalk.sytes.net:5443/captcha/17267810418355597201
        </url>
      </x>
      <captcha xmlns='urn:xmpp:captcha'>
        <x type='form' xmlns='jabber:x:data'>
          <field var='FORM_TYPE' type='hidden'>
            <value>
              urn:xmpp:captcha
            </value>
          </field>
          <field var='from' type='hidden'>
            <value>
              chatroom-f3ji@conference.atalk.org/swordfish
            </value>
          </field>
          <field var='challenge' type='hidden'>
            <value>
              17267810418355597201
            </value>
          </field>
          <field var='sid' type='hidden'>
            <value>
              W8VII-129
            </value>
          </field>
          <field var='ocr' type='text-single' label='Enter the text you see'>
            <media xmlns='urn:xmpp:media-element'>
              <uri type='image/png'>
                cid:sha1+61af7e04430f1a376893222106f04341ae370944@bob.xmpp.org
              </uri>
            </media>
            <required/>
          </field>
        </x>
      </captcha>
      <data type='image/png' max-age='0' cid='sha1+61af7e04430f1a376893222106f04341ae370944@bob.xmpp.org' xmlns='urn:xmpp:bob'>
        iVBORw0KGgoAAAANSUhEUgAAAIwAAAA8CAAAAACRYQ2XAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfkAggKGRvih22ZAAAMTUlEQVRo3u1ZaXhUVbZdt4akkspIgAwQCGFKCDyJQIA0IiiCgoDdPEVpxgBGQGiIhJhGUKRpFXFolUFQEDDQTQvI2GqDUaYYGQzEGELIHJKQVGWoebh1V/+4VRk00vj1e5/9I+dP7bPvOfusc+7ea+97SiD+e5oCHWA6wHSA6QDz/9tUv3hGWZGuPqh7z1Cv/3swwp0Z2HTbpInwdzQvbN28Jiw+ItQlevUe2vduT9UhqFs6FDyS+bvoiLsHU19UkK9W1OYgvWeMfILfJD75lr/D7jTV5GXXpY/2CfL5+om94+URR07mDZqRWF6hSQD028vnyOXl1lNpkUXFcUOAovP9tN2Df+7r4NaBFQBAUQ0AxnEj3wYAXLnS/z7AdCgvwC//Y2GM39i5CtXezCGxw+Uzsm3fEB07cNBIzbZqlTrybPVBDQAs6P5uYmpcCBxl5z85nzJzTuib8gspm74rFi4lkBnVy6UQ2ing3a1gOEly5cckaZ+W5i5OTjTQ8tmeCwbaGx44Ur07eeWm/MkPnyjyFF2u


2020-02-08 10:25:32.175 25311-27026/org.atalk.android E/(ChatRoomJabberImpl.java:713)#joinAs: Failed to join room:
    chatroom-f3ji@conference.atalk.org with nickname: swordfish@atalk.org.: No response received within reply timeout. Timeout was 5000ms (~5s). StanzaCollector has been cancelled. Waited for response using: AndFilter: (StanzaTypeFilter: Presence, OrFilter: (AndFilter: (FromMatchesFilter (ignoreResourcepart): chatroom-f3ji@conference.atalk.org, MUCUserStatusCodeFilter: status=110), AndFilter: (FromMatchesFilter (full): chatroom-f3ji@conference.atalk.org/swordfish, StanzaIdFilter: id=W8VII-129, PresenceTypeFilter: type=error))).
2020-02-08 10:25:32.176 25311-27026/org.atalk.android D/(ChatRoomJabberImpl.java:718)#joinAs: Join room - received captcha challenge or user canceled (Ignore NoResponseException)

2020-02-08 10:26:10.819 25311-25963/org.atalk.android D/SMACK: SENT (0): 
    <iq to='chatroom-f3ji@conference.atalk.org' id='W8VII-133' type='get'>
      <query xmlns='http://jabber.org/protocol/disco#info'>
      </query>
    </iq>
2020-02-08 10:26:10.842 25311-25965/org.atalk.android D/SMACK: RECV (0): 
    <iq xml:lang='en-GB' to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org' type='result' id='W8VII-133'>
      <query xmlns='http://jabber.org/protocol/disco#info'>
        <identity name='chatroom-f3ji' type='text' category='conference'/>
        <feature var='vcard-temp'/>
        <feature var='http://jabber.org/protocol/muc'/>
        <feature var='muc_hidden'/>
        <feature var='muc_temporary'/>
        <feature var='muc_open'/>
        <feature var='muc_nonanonymous'/>
        <feature var='muc_moderated'/>
        <feature var='muc_unsecured'/>
        <feature var='urn:xmpp:mam:tmp'/>
        <feature var='urn:xmpp:mam:0'/>
        <feature var='urn:xmpp:mam:1'/>
        <feature var='urn:xmpp:mam:2'/>
        <feature var='urn:xmpp:sid:0'/>
        <x type='result' xmlns='jabber:x:data'>
          <field var='FORM_TYPE' type='hidden'>
            <value>
              http://jabber.org/protocol/muc#roominfo
            </value>
          </field>
          <field var='muc#roominfo_occupants' type='text-single' label='Number of occupants'>
            <value>
              1
            </value>
          </field>
          <field var='muc#roomconfig_roomname' type='text-single' label='Natural-Language Room Name'/>
          <field var='muc#roominfo_description' type='text-single' label='Room description'/>
          <field var='muc#roominfo_contactjid' type='jid-multi' label='Contact Addresses (normally, room owner or owners)'>
            <value>
              leopard@atalk.org
            </value>
          </field>
          <field var='muc#roominfo_changesubject' type='boolean' label='Occupants May Change the Subject'>
            <value>
              1
            </value>
          </field>
          <field var='muc#roomconfig_allowinvites' type='boolean' label='Occupants are allowed to invite others'>
            <value>
              1
            </value>
          </field>
          <field var='muc#roomconfig_allowpm' type='list-single' label='Roles that May Send Private Messages'>
            <value>
              anyone
            </value>
            <option label='Anyone'>
              <value>
                anyone
              </value>
            </option>
            <option label='Anyone with Voice'>
              <value>
                participants
              </value>
            </option>
            <option label='Moderators Only'>
              <value>
                moderators
              </value>
            </option>
            <option label='Nobody'>
              <value>
                none
              </value>
            </option>
          </field>
          <field var='muc#roominfo_lang' type='text-single' label='Natural Language for Room Discussions'>
            <value/>
          </field>
        </x>
      </query>
    </iq>

2020-02-08 10:26:22.296 25311-25963/org.atalk.android D/SMACK: SENT (0): 
    <iq to='chatroom-f3ji@conference.atalk.org' id='W8VII-135' type='set'>
      <captcha xmlns='urn:xmpp:captcha'>
        <x xmlns='jabber:x:data' type='submit'>
          <field var='FORM_TYPE'>
            <value>
              urn:xmpp:captcha
            </value>
          </field>
          <field var='from'>
            <value>
              chatroom-f3ji@conference.atalk.org/swordfish
            </value>
          </field>
          <field var='challenge'>
            <value>
              17267810418355597201
            </value>
          </field>
          <field var='sid'>
            <value>
              W8VII-129
            </value>
          </field>
          <field var='username'>
            <value>
              swordfish@atalk.org/atalk
            </value>
          </field>
          <field var='ocr'>
            <value>
              122322
            </value>
          </field>
        </x>
      </captcha>
    </iq>

2020-02-08 10:26:22.317 25311-25965/org.atalk.android D/SMACK: RECV (0): 
    <presence to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org' id='17640902051881643590'>
      <c ver='h/nb9v1ZWVLaSPkbUurrhICkvXA=' node='http://www.process-one.net/en/ejabberd/' hash='sha-1' xmlns='http://jabber.org/protocol/caps'/>
    </presence>
2020-02-08 10:26:22.328 25311-25965/org.atalk.android D/SMACK: RECV (0): 
    <presence xml:lang='en-GB' to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org/leopard' id='RMSI4-152'>
      <c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://android.atalk.org' ver='C8m/4hb7TJHmm8dpt7KpttXz6sY='/>
      <x xmlns='vcard-temp:x:update'>
        <photo>
          9df0ce43f9e27c2849ff1b317427cade4af92a74
        </photo>
      </x>
      <x xmlns='http://jabber.org/protocol/muc#user'>
        <item jid='leopard@atalk.org/atalk' role='moderator' affiliation='owner'/>
      </x>
    </presence>
2020-02-08 10:26:22.351 25311-25965/org.atalk.android D/SMACK: RECV (0): 
    <presence xml:lang='en-GB' to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org/swordfish' id='W8VII-129'>
      <c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://android.atalk.org' ver='C8m/4hb7TJHmm8dpt7KpttXz6sY='/>
      <x xmlns='vcard-temp:x:update'>
        <photo>
          cc39fa1cc9cff4e67851a63bd1b78ba937be6a90
        </photo>
      </x>
      <x xmlns='http://jabber.org/protocol/muc#user'>
        <item jid='swordfish@atalk.org/atalk' role='participant' affiliation='none'/>
        <status code='100'/>
        <status code='110'/>
      </x>
    </presence>
2020-02-08 10:26:22.356 25311-25965/org.atalk.android D/SMACK: RECV (0): 
    <message to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org' type='groupchat'>
      <subject/>
    </message>

After the captcha challenge is validated, aTalk proceeds to re-join() the room if MultiUserChat.isJoined() == false. The ejabberd server seems to accept this re-joined without complaint.

So aTalk now uses this to overcome the earlier reported problem.

FYI: Here is the debug log captured for aTalk after captcha challenge

2020-02-09 18:13:14.904 17698-17803/org.atalk.android D/SMACK: SENT (0): 
    <presence to='chatroom-f3ji@conference.atalk.org/swordfish' id='SR3W2-267'>
      <x xmlns='http://jabber.org/protocol/muc'>
      </x>
      <c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://android.atalk.org' ver='C8m/4hb7TJHmm8dpt7KpttXz6sY='/>
    </presence>

.....
.....

2020-02-09 18:13:19.907 17698-16673/org.atalk.android E/(ChatRoomJabberImpl.java:716)#joinAs: Failed to join room:
    chatroom-f3ji@conference.atalk.org with nickname: swordfish@atalk.org.: No response received within reply timeout. Timeout was 5000ms (~5s). StanzaCollector has been cancelled. Waited for response using: AndFilter: (StanzaTypeFilter: Presence, OrFilter: (AndFilter: (FromMatchesFilter (ignoreResourcepart): chatroom-f3ji@conference.atalk.org, MUCUserStatusCodeFilter: status=110), AndFilter: (FromMatchesFilter (full): chatroom-f3ji@conference.atalk.org/swordfish, StanzaIdFilter: id=SR3W2-267, PresenceTypeFilter: type=error))).

2020-02-09 18:13:21.897 17698-17803/org.atalk.android D/SMACK: SENT (0): 
    <iq to='chatroom-f3ji@conference.atalk.org' id='SR3W2-273' type='set'>
      <captcha xmlns='urn:xmpp:captcha'>
        <x xmlns='jabber:x:data' type='submit'>
          <field var='FORM_TYPE'>
            <value>
              urn:xmpp:captcha
            </value>
          </field>
          <field var='from'>
            <value>
              chatroom-f3ji@conference.atalk.org/swordfish
            </value>
          </field>
          <field var='challenge'>
            <value>
              4091833997371023265
            </value>
          </field>
          <field var='sid'>
            <value>
              SR3W2-267
            </value>
          </field>
          <field var='username'>
            <value>
              swordfish@atalk.org/atalk
            </value>
          </field>
          <field var='ocr'>
            <value>
              178108
            </value>
          </field>
        </x>
      </captcha>
    </iq>

2020-02-09 18:13:21.906 17698-17804/org.atalk.android D/SMACK: RECV (0): 
    <iq xml:lang='en-GB' to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org' type='result' id='SR3W2-273'/>
2020-02-09 18:13:21.910 17698-17698/org.atalk.android D/(ChatRoomJabberImpl.java:297)#onResult: Rejoined chat room after captcha challenge
2020-02-09 18:13:21.916 17698-17803/org.atalk.android D/SMACK: SENT (0): 
    <presence to='chatroom-f3ji@conference.atalk.org/swordfish' id='SR3W2-275'>
      <x xmlns='http://jabber.org/protocol/muc'>
      </x>
      <c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://android.atalk.org' ver='C8m/4hb7TJHmm8dpt7KpttXz6sY='/>
    </presence>
2020-02-09 18:13:21.919 17698-17804/org.atalk.android D/SMACK: RECV (0): 
    <presence to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org' id='256364031839267179'>
      <c ver='h/nb9v1ZWVLaSPkbUurrhICkvXA=' node='http://www.process-one.net/en/ejabberd/' hash='sha-1' xmlns='http://jabber.org/protocol/caps'/>
    </presence>
2020-02-09 18:13:21.932 17698-17804/org.atalk.android D/SMACK: RECV (0): 
    <presence xml:lang='en-GB' to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org/leopard' id='P54GE-137'>
      <c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://android.atalk.org' ver='C8m/4hb7TJHmm8dpt7KpttXz6sY='/>
      <x xmlns='vcard-temp:x:update'>
        <photo>
          9df0ce43f9e27c2849ff1b317427cade4af92a74
        </photo>
      </x>
      <x xmlns='http://jabber.org/protocol/muc#user'>
        <item jid='leopard@atalk.org/atalk' role='moderator' affiliation='owner'/>
      </x>
    </presence>
2020-02-09 18:13:21.939 17698-16487/org.atalk.android I/(ChatRoomJabberImpl.java:1258)#joined: chatroom-f3ji@conference.atalk.org/leopard has joined chatRoom: chatroom-f3ji@conference.atalk.org
2020-02-09 18:13:21.943 17698-17804/org.atalk.android D/SMACK: RECV (0): 
    <presence xml:lang='en-GB' to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org/swordfish' id='SR3W2-267'>
      <c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://android.atalk.org' ver='C8m/4hb7TJHmm8dpt7KpttXz6sY='/>
      <x xmlns='vcard-temp:x:update'>
        <photo>
          cc39fa1cc9cff4e67851a63bd1b78ba937be6a90
        </photo>
      </x>
      <x xmlns='http://jabber.org/protocol/muc#user'>
        <item jid='swordfish@atalk.org/atalk' role='participant' affiliation='none'/>
        <status code='100'/>
        <status code='110'/>
      </x>
    </presence>
2020-02-09 18:13:21.948 17698-17804/org.atalk.android D/SMACK: RECV (0): 
    <message to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org' type='groupchat'>
      <subject/>
    </message>
2020-02-09 18:13:21.953 17698-16488/org.atalk.android D/(ChatRoomJabberImpl.java:2137)#subjectUpdated: ChatRoom subject updated to ''
2020-02-09 18:13:21.978 17698-17804/org.atalk.android D/SMACK: RECV (0): 
    <presence to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org' id='18050484318158266285'>
      <c ver='h/nb9v1ZWVLaSPkbUurrhICkvXA=' node='http://www.process-one.net/en/ejabberd/' hash='sha-1' xmlns='http://jabber.org/protocol/caps'/>
    </presence>
2020-02-09 18:13:21.990 17698-17804/org.atalk.android D/SMACK: RECV (0): 
    <presence xml:lang='en-GB' to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org/leopard' id='P54GE-137'>
      <c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://android.atalk.org' ver='C8m/4hb7TJHmm8dpt7KpttXz6sY='/>
      <x xmlns='vcard-temp:x:update'>
        <photo>
          9df0ce43f9e27c2849ff1b317427cade4af92a74
        </photo>
      </x>
      <x xmlns='http://jabber.org/protocol/muc#user'>
        <item jid='leopard@atalk.org/atalk' role='moderator' affiliation='owner'/>
      </x>
    </presence>
2020-02-09 18:13:22.004 17698-17804/org.atalk.android D/SMACK: RECV (0): 
    <presence xml:lang='en-GB' to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org/swordfish' id='SR3W2-275'>
      <c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://android.atalk.org' ver='C8m/4hb7TJHmm8dpt7KpttXz6sY='/>
      <x xmlns='vcard-temp:x:update'>
        <photo>
          cc39fa1cc9cff4e67851a63bd1b78ba937be6a90
        </photo>
      </x>
      <x xmlns='http://jabber.org/protocol/muc#user'>
        <item jid='swordfish@atalk.org/atalk' role='participant' affiliation='none'/>
        <status code='100'/>
        <status code='110'/>
      </x>
    </presence>
2020-02-09 18:13:22.007 17698-17804/org.atalk.android D/SMACK: RECV (0): 
    <message to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org' type='groupchat'>
      <subject/>
    </message>

There is a lot of noise in your stanza capture that make it hard to follow whats going on.
Also it is not clear to me which stanza causes the timeout.

Usually when a user join a chat room, on his own or upon a chat invitation (this case for debug log example) by sending the join room <presence> request; the server usually replies the request well before the 5s smack reply timeout. There in no problem in this case.

However when the joining chat room is protected with captcha challenge, instead of granting the join room on request, the server sends a captcha challenge instead. (see attached image)

After user has entered the correct challenge code, the server will then response to the join room request as before. The join room process has actually completed successfully between server and client. This whole process usually takes more than 5s.

However due to the 5s reply timeout on the join room request stanza, smack throws Smack No Response exception; and ignore the server response. Hence the smack join room state is not in sync with the actual. Because of this, messages sent from client or received from server are not relayed to either end.

In the earlier aTalk releases, it actually increased this reply timeout to 30s, in order to get join room with captcha protection to work properly. This is working under normal operation while aTalk is in focus. However this created problem when aTalk is not in focus (e.g. minimized window during standby) and auto join chatroom is enabled; although the captcha dialog is shown, it is not visible to user. The whole aTalk is hanged in ANR (Android No Reponse) state, until the 30s has timeout

To avoid ANR, aTalk has changed the earlier design approach; the new approach has dropped using the 30s reply time during captcha challenge. It just ignore the smack no response exception. After a successful captcha validation by server, it re-issue the join room request, to bring smack to a sync state. This approach is working at this moment (as shown in second debug log).

aTalk request is smack may want to consider uncouple the join room request and server reply, so that smack can properly handle the server response even after the reply timeout exception; without aTalk a need to rejoin the chat room.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.