Logical solution about Instant messenger

I am creating a instant messenger service for my user,

I am new in openfire xmpp technology

i don’t know how to solve my logical problem.

I have one database in my server1 which contain

table: user (id,mob, hash, username,gender,pass,profilepic, etc)

pmsg: (from,to,msg,date,time)

block: (from,to,date,time)

Basic Concept REST API:-

when new user come and register mobile no. then all information store in user table.

when user login API request then we check authentication by PHP reverse the response.

when USER A send Msg to USER B we check the block table that USER B AND USER A not block condition if we not found then store msg USER A in pmsg.

This is our simple concept which working currently.

I want to implement the XMPP in msg sending to user get real time message.

We have test the XMPP in andoid app its working fine.

Basic Concept XMPP:-

If USER A send msg to USER B

then XMPP need XMPP USERB@hostname

it send successfully.

I am confuse in how we can check that USER A is not Blocked by USER B.

If yes then how can we check and response to USER A that u have blocked by USER B.

there is any way in openfire that we can set condition and parameter like userblock: true/false

I AM NEW IN XMPP TECHNOLOGY PLZ EXPERT HELP ME.