mirror of
https://github.com/chatmail/core.git
synced 2026-04-26 09:56:35 +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());
|
||||
} else if command == SystemMessage::WebxdcStatusUpdate {
|
||||
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));
|
||||
} 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
|
||||
.render_webxdc_status_update_object(self.msg.id, None)
|
||||
.await?
|
||||
|
||||
@@ -505,7 +505,7 @@ impl Context {
|
||||
.sql
|
||||
.query_row_optional(
|
||||
"SELECT 1 FROM iroh_gossip_peers WHERE topic=?",
|
||||
(topic,),
|
||||
(topic.as_bytes(),),
|
||||
|_| Ok(()),
|
||||
)
|
||||
.await
|
||||
@@ -520,8 +520,20 @@ impl Context {
|
||||
if !topic_exists {
|
||||
info!(
|
||||
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;
|
||||
} else {
|
||||
if let Some(ref gossip) = *self.gossip.lock().await {
|
||||
|
||||
Reference in New Issue
Block a user