Browse Source

Merge pull request 'jenkins' (#3) from jenkins into master

Reviewed-on: https://git.scd31.com/stephen/cat-disruptor-7000/pulls/3
tags/v0.5.0 v0.5.0
stephen 10 months ago
parent
commit
63684a7ec2
4 changed files with 54 additions and 18 deletions
  1. +11
    -0
      .editorconfig
  2. +28
    -0
      Jenkinsfile
  3. +13
    -16
      src/main.rs
  4. +2
    -2
      src/relation.rs

+ 11
- 0
.editorconfig View File

@ -0,0 +1,11 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
indent_size = 4

+ 28
- 0
Jenkinsfile View File

@ -0,0 +1,28 @@
pipeline {
agent {
docker {
image 'rust:latest'
}
}
stages {
stage('Clippy') {
steps {
sh "rustup component add clippy"
sh "cargo clippy --all-targets --all-features -- -D warnings"
}
}
stage('Build') {
steps {
sh "cargo install cargo-deb"
sh "cargo deb"
}
}
}
post {
always {
archiveArtifacts artifacts: 'target/debian/*.deb', fingerprint: true
}
}
}

+ 13
- 16
src/main.rs View File

@ -73,22 +73,19 @@ impl EventEmitter for EventCallback {
room_member: &StrippedStateEventStub<MemberEventContent>,
_: Option<MemberEventContent>) {
if room_member.state_key == self.user_id {
match sync_room {
RoomState::Invited(x) => {
let room = x.read().await;
println!("Invitation received from {}", room.display_name());
match self.client.join_room_by_id(&room.room_id).await {
Ok(_) => {
println!("Joined {}", room.display_name());
self.statsd_client.incr("joined.success");
},
Err(_) => {
println!("There was an error while joining {}", room.display_name());
self.statsd_client.incr("joined.error");
}
};
},
_ => {}
if let RoomState::Invited(x) = sync_room {
let room = x.read().await;
println!("Invitation received from {}", room.display_name());
match self.client.join_room_by_id(&room.room_id).await {
Ok(_) => {
println!("Joined {}", room.display_name());
self.statsd_client.incr("joined.success");
},
Err(_) => {
println!("There was an error while joining {}", room.display_name());
self.statsd_client.incr("joined.error");
}
};
}
}
}


+ 2
- 2
src/relation.rs View File

@ -25,13 +25,13 @@ pub async fn react(client: &Client,
content_hm.insert("m.relates_to".to_string(),
ContentStruct {
rel_type: "m.annotation".to_string(),
event_id: event_id,
event_id,
key: emoji
});
let request = create_message_event::Request {
event_type: EventType::Custom("m.reaction".into()),
room_id: room_id,
room_id,
txn_id: Uuid::new_v4().to_string(),
data: serde_json::value::to_raw_value(&content_hm).unwrap()
};


Loading…
Cancel
Save