def get_presence(jid, from_jid=None, get_show=False):
 if (not jid):
  raise InvalidJidError()
 request = xmpp_service_pb.PresenceRequest()
 response = xmpp_service_pb.PresenceResponse()
 request.set_jid(_to_str(jid))
 if from_jid:
  request.set_from_jid(_to_str(from_jid))
 try:
  apiproxy_stub_map.MakeSyncCall('xmpp', 'GetPresence', request, response)
 except apiproxy_errors.ApplicationError as e:
  if (e.application_error == xmpp_service_pb.XmppServiceError.INVALID_JID):
   raise InvalidJidError()
  else:
   raise Error()
 if get_show:
  show = None
  if response.has_presence():
   presence = response.presence()
   if (presence == xmpp_service_pb.PresenceResponse.NORMAL):
    show = PRESENCE_SHOW_NONE
   elif (presence == xmpp_service_pb.PresenceResponse.AWAY):
    show = PRESENCE_SHOW_AWAY
   elif (presence == xmpp_service_pb.PresenceResponse.DO_NOT_DISTURB):
    show = PRESENCE_SHOW_DND
   elif (presence == xmpp_service_pb.PresenceResponse.CHAT):
    show = PRESENCE_SHOW_CHAT
   elif (presence == xmpp_service_pb.PresenceResponse.EXTENDED_AWAY):
    show = PRESENCE_SHOW_XA
  return (bool(response.is_available()), show)
 else:
  return bool(response.is_available())

def get_presence ( jid , from_jid = None , get_show = False ) : if ( not jid ) : raise InvalidJidError ( ) request = xmpp_service_pb . PresenceRequest ( ) response = xmpp_service_pb . PresenceResponse ( ) request . set_jid ( _to_str ( jid ) ) if from_jid : request . set_from_jid ( _to_str ( from_jid ) ) try : apiproxy_stub_map . MakeSyncCall ( 'xmpp' , 'GetPresence' , request , response ) except apiproxy_errors . ApplicationError as e : if ( e . application_error == xmpp_service_pb . XmppServiceError . INVALID_JID ) : raise InvalidJidError ( ) else : raise Error ( ) if get_show : show = None if response . has_presence ( ) : presence = response . presence ( ) if ( presence == xmpp_service_pb . PresenceResponse . NORMAL ) : show = PRESENCE_SHOW_NONE elif ( presence == xmpp_service_pb . PresenceResponse . AWAY ) : show = PRESENCE_SHOW_AWAY elif ( presence == xmpp_service_pb . PresenceResponse . DO_NOT_DISTURB ) : show = PRESENCE_SHOW_DND elif ( presence == xmpp_service_pb . PresenceResponse . CHAT ) : show = PRESENCE_SHOW_CHAT elif ( presence == xmpp_service_pb . PresenceResponse . EXTENDED_AWAY ) : show = PRESENCE_SHOW_XA return ( bool ( response . is_available ( ) ) , show ) else : return bool ( response . is_available ( ) )
gets the presence for a jid .