Remove some debug statements
This commit is contained in:
@@ -296,7 +296,7 @@ class EchoComponent(ComponentXMPP):
|
|||||||
self.connect()
|
self.connect()
|
||||||
|
|
||||||
def session_start(self, *args):
|
def session_start(self, *args):
|
||||||
log.info(f"START {args}")
|
log.info(f"Session started: {args}")
|
||||||
|
|
||||||
async def request_upload_slot(self, recipient, filename, content_type, size):
|
async def request_upload_slot(self, recipient, filename, content_type, size):
|
||||||
"""
|
"""
|
||||||
@@ -332,8 +332,6 @@ class EchoComponent(ComponentXMPP):
|
|||||||
log.error(f"Failed to obtain upload slot for {filename}")
|
log.error(f"Failed to obtain upload slot for {filename}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
log.info(f"Slot: {slot}")
|
|
||||||
|
|
||||||
# Parse the XML response
|
# Parse the XML response
|
||||||
root = ET.fromstring(str(slot)) # Convert to string if necessary
|
root = ET.fromstring(str(slot)) # Convert to string if necessary
|
||||||
namespace = "{urn:xmpp:http:upload:0}" # Define the namespace
|
namespace = "{urn:xmpp:http:upload:0}" # Define the namespace
|
||||||
@@ -342,8 +340,6 @@ class EchoComponent(ComponentXMPP):
|
|||||||
put_element = root.find(f".//{namespace}put")
|
put_element = root.find(f".//{namespace}put")
|
||||||
put_url = put_element.attrib.get("url")
|
put_url = put_element.attrib.get("url")
|
||||||
|
|
||||||
log.info(f"Put element: {ET.tostring(put_element, encoding='unicode')}") # Debugging
|
|
||||||
|
|
||||||
# Extract the Authorization header correctly
|
# Extract the Authorization header correctly
|
||||||
header_element = put_element.find(f"./{namespace}header[@name='Authorization']")
|
header_element = put_element.find(f"./{namespace}header[@name='Authorization']")
|
||||||
auth_header = header_element.text.strip() if header_element is not None else None
|
auth_header = header_element.text.strip() if header_element is not None else None
|
||||||
@@ -352,8 +348,6 @@ class EchoComponent(ComponentXMPP):
|
|||||||
log.error(f"Missing URLs in upload slot: {slot}")
|
log.error(f"Missing URLs in upload slot: {slot}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
log.info(f"Got upload slot: {get_url}, Authorization: {auth_header}")
|
|
||||||
|
|
||||||
return get_url, put_url, auth_header
|
return get_url, put_url, auth_header
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -499,11 +493,10 @@ class EchoComponent(ComponentXMPP):
|
|||||||
text_msg["body"] = text
|
text_msg["body"] = text
|
||||||
log.info(f"Sending separate text message: {text}")
|
log.info(f"Sending separate text message: {text}")
|
||||||
if detail.is_outgoing_message:
|
if detail.is_outgoing_message:
|
||||||
log.info("OUT")
|
log.info("Outgoing message, not forwarding")
|
||||||
...
|
...
|
||||||
else:
|
else:
|
||||||
log.info(f"Final XMPP message: {text_msg.xml}")
|
log.info(f"Final XMPP message: {text_msg.xml}")
|
||||||
log.info(f"Sending message")
|
|
||||||
text_msg.send()
|
text_msg.send()
|
||||||
|
|
||||||
for att in attachments:
|
for att in attachments:
|
||||||
@@ -541,11 +534,10 @@ class EchoComponent(ComponentXMPP):
|
|||||||
|
|
||||||
log.info(f"Sending file attachment message with URL: {upload_url}")
|
log.info(f"Sending file attachment message with URL: {upload_url}")
|
||||||
if detail.is_outgoing_message:
|
if detail.is_outgoing_message:
|
||||||
log.info("OUT")
|
log.info("Outgoing message, not forwarding")
|
||||||
...
|
...
|
||||||
else:
|
else:
|
||||||
log.info(f"Final XMPP message: {msg.xml}")
|
log.info(f"Final XMPP message: {msg.xml}")
|
||||||
log.info(f"Sending message")
|
|
||||||
msg.send()
|
msg.send()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -559,12 +551,10 @@ async def stream(**kwargs):
|
|||||||
message = await pubsub.get_message(ignore_subscribe_messages=True)
|
message = await pubsub.get_message(ignore_subscribe_messages=True)
|
||||||
if message is not None:
|
if message is not None:
|
||||||
try:
|
try:
|
||||||
log.info("GOT", message)
|
|
||||||
data = message["data"]
|
data = message["data"]
|
||||||
unpacked = msgpack.unpackb(data, raw=False)
|
unpacked = msgpack.unpackb(data, raw=False)
|
||||||
log.info(f"Unpacked: {unpacked}")
|
log.info(f"Unpacked: {unpacked}")
|
||||||
except TypeError:
|
except TypeError:
|
||||||
log.info(f"FAILED {message}")
|
|
||||||
continue
|
continue
|
||||||
if "type" in unpacked.keys():
|
if "type" in unpacked.keys():
|
||||||
if unpacked["type"] == "def":
|
if unpacked["type"] == "def":
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ class HandleMessage(Command):
|
|||||||
"mentions": c.message.mentions,
|
"mentions": c.message.mentions,
|
||||||
"raw_message": c.message.raw_message
|
"raw_message": c.message.raw_message
|
||||||
}
|
}
|
||||||
log.info("1")
|
|
||||||
raw = json.loads(c.message.raw_message)
|
raw = json.loads(c.message.raw_message)
|
||||||
print(json.dumps(c.message.raw_message, indent=2))
|
print(json.dumps(c.message.raw_message, indent=2))
|
||||||
#dest = c.message.raw_message.get("envelope", {}).get("syncMessage", {}).get("sentMessage", {}).get("destinationUuid")
|
#dest = c.message.raw_message.get("envelope", {}).get("syncMessage", {}).get("sentMessage", {}).get("destinationUuid")
|
||||||
@@ -47,10 +46,8 @@ class HandleMessage(Command):
|
|||||||
|
|
||||||
#account = c.message.raw_message.get("account", "")
|
#account = c.message.raw_message.get("account", "")
|
||||||
account = raw.get("account", "")
|
account = raw.get("account", "")
|
||||||
log.info("2")
|
|
||||||
#source_name = msg["raw_message"].get("envelope", {}).get("sourceName", "")
|
#source_name = msg["raw_message"].get("envelope", {}).get("sourceName", "")
|
||||||
source_name = raw.get("envelope", {}).get("sourceName", "")
|
source_name = raw.get("envelope", {}).get("sourceName", "")
|
||||||
log.info("3")
|
|
||||||
|
|
||||||
source_number = c.message.source_number
|
source_number = c.message.source_number
|
||||||
source_uuid = c.message.source_uuid
|
source_uuid = c.message.source_uuid
|
||||||
@@ -158,7 +155,6 @@ class HandleMessage(Command):
|
|||||||
text=result,
|
text=result,
|
||||||
ts=ts + 1,
|
ts=ts + 1,
|
||||||
)
|
)
|
||||||
# log.info("NOT SENDING CHECK CODE IS OK")
|
|
||||||
# await natural.natural_send_message(c, result)
|
# await natural.natural_send_message(c, result)
|
||||||
tss = await natural.natural_send_message(
|
tss = await natural.natural_send_message(
|
||||||
result,
|
result,
|
||||||
@@ -236,12 +232,9 @@ async def stream():
|
|||||||
message = await pubsub.get_message(ignore_subscribe_messages=True)
|
message = await pubsub.get_message(ignore_subscribe_messages=True)
|
||||||
if message is not None:
|
if message is not None:
|
||||||
try:
|
try:
|
||||||
log.info("GOT", message)
|
|
||||||
data = message["data"]
|
data = message["data"]
|
||||||
unpacked = msgpack.unpackb(data, raw=False)
|
unpacked = msgpack.unpackb(data, raw=False)
|
||||||
log.info(f"Unpacked: {unpacked}")
|
|
||||||
except TypeError:
|
except TypeError:
|
||||||
log.info(f"FAILED {message}")
|
|
||||||
continue
|
continue
|
||||||
if "type" in unpacked.keys():
|
if "type" in unpacked.keys():
|
||||||
if unpacked["type"] == "def":
|
if unpacked["type"] == "def":
|
||||||
|
|||||||
Reference in New Issue
Block a user