mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
add self to topic and add pubkey
This commit is contained in:
@@ -1284,17 +1284,19 @@ impl<'a> MimeFactory<'a> {
|
|||||||
self.sync_ids_to_delete = Some(ids.to_string());
|
self.sync_ids_to_delete = Some(ids.to_string());
|
||||||
} else if command == SystemMessage::WebxdcStatusUpdate {
|
} else if command == SystemMessage::WebxdcStatusUpdate {
|
||||||
let json = self.msg.param.get(Param::Arg).unwrap_or_default();
|
let json = self.msg.param.get(Param::Arg).unwrap_or_default();
|
||||||
|
|
||||||
|
if json.find("gossip_topic").is_some() {
|
||||||
|
if let Some(ref endpoint) = *context.endpoint.lock().await {
|
||||||
|
// Add iroh NodeAddr to headers so peers can connect to us.
|
||||||
|
let node_addr = endpoint.my_addr().await.unwrap();
|
||||||
|
headers.protected.push(Header::new(
|
||||||
|
HeaderDef::IrohPublicGossip.get_headername().to_string(),
|
||||||
|
serde_json::to_string(&node_addr)?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
parts.push(context.build_status_update_part(json));
|
parts.push(context.build_status_update_part(json));
|
||||||
} else if self.msg.viewtype == Viewtype::Webxdc {
|
} else if self.msg.viewtype == Viewtype::Webxdc {
|
||||||
if let Some(ref endpoint) = *context.endpoint.lock().await {
|
|
||||||
// Add iroh NodeAddr to headers so peers can connect to us.
|
|
||||||
let node_addr = endpoint.my_addr().await.unwrap();
|
|
||||||
headers.protected.push(Header::new(
|
|
||||||
HeaderDef::IrohPublicGossip.get_headername().to_string(),
|
|
||||||
serde_json::to_string(&node_addr)?,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(json) = context
|
if let Some(json) = context
|
||||||
.render_webxdc_status_update_object(self.msg.id, None)
|
.render_webxdc_status_update_object(self.msg.id, None)
|
||||||
.await?
|
.await?
|
||||||
|
|||||||
@@ -505,7 +505,7 @@ impl Context {
|
|||||||
.sql
|
.sql
|
||||||
.query_row_optional(
|
.query_row_optional(
|
||||||
"SELECT 1 FROM iroh_gossip_peers WHERE topic=?",
|
"SELECT 1 FROM iroh_gossip_peers WHERE topic=?",
|
||||||
(topic,),
|
(topic.as_bytes(),),
|
||||||
|_| Ok(()),
|
|_| Ok(()),
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
@@ -520,8 +520,20 @@ impl Context {
|
|||||||
if !topic_exists {
|
if !topic_exists {
|
||||||
info!(
|
info!(
|
||||||
self,
|
self,
|
||||||
"Gossip topic {topic} does not exist, sending over smpt",
|
"Gossip topic {topic} does not exist, sending over smtp",
|
||||||
);
|
);
|
||||||
|
let addr = self
|
||||||
|
.endpoint
|
||||||
|
.lock()
|
||||||
|
.await
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.my_addr()
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
self.add_peer_for_topic(instance_msg_id, topic, addr.node_id)
|
||||||
|
.await?;
|
||||||
ephemeral = false;
|
ephemeral = false;
|
||||||
} else {
|
} else {
|
||||||
if let Some(ref gossip) = *self.gossip.lock().await {
|
if let Some(ref gossip) = *self.gossip.lock().await {
|
||||||
|
|||||||
Reference in New Issue
Block a user