Skip to content

Commit 81a13a2

Browse files
committed
fix(conference): change file name of chane_name.rs
1 parent 5783622 commit 81a13a2

File tree

5 files changed

+44
-43
lines changed

5 files changed

+44
-43
lines changed

src/toxcore/messenger/conference/packet/conference_action.rs renamed to src/toxcore/messenger/conference/packet/action.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use nom::{be_u16, be_u32, rest};
66

77
use crate::toxcore::binary_io::*;
88

9-
/** ConferenceAction is the struct that holds info to send action to a conference.
9+
/** Action is the struct that holds info to send action to a conference.
1010
1111
Sent to notify action to all member of conference.
1212
@@ -23,7 +23,7 @@ variable | `action`(UTF-8 C String)
2323
2424
*/
2525
#[derive(Clone, Debug, Eq, PartialEq)]
26-
pub struct ConferenceAction {
26+
pub struct Action {
2727
conference_number: u16,
2828
peer_number: u16,
2929
message_number: u32,
@@ -32,15 +32,15 @@ pub struct ConferenceAction {
3232
action: String,
3333
}
3434

35-
impl FromBytes for ConferenceAction {
36-
named!(from_bytes<ConferenceAction>, do_parse!(
35+
impl FromBytes for Action {
36+
named!(from_bytes<Action>, do_parse!(
3737
tag!("\x63") >>
3838
conference_number: be_u16 >>
3939
peer_number: be_u16 >>
4040
message_number: be_u32 >>
4141
tag!("\x41") >>
4242
action: map_res!(rest, str::from_utf8) >>
43-
(ConferenceAction {
43+
(Action {
4444
conference_number,
4545
peer_number,
4646
message_number,
@@ -49,7 +49,7 @@ impl FromBytes for ConferenceAction {
4949
));
5050
}
5151

52-
impl ToBytes for ConferenceAction {
52+
impl ToBytes for Action {
5353
fn to_bytes<'a>(&self, buf: (&'a mut [u8], usize)) -> Result<(&'a mut [u8], usize), GenError> {
5454
do_gen!(buf,
5555
gen_be_u8!(0x63) >>
@@ -62,10 +62,10 @@ impl ToBytes for ConferenceAction {
6262
}
6363
}
6464

65-
impl ConferenceAction {
66-
/// Create new ConferenceAction object.
65+
impl Action {
66+
/// Create new Action object.
6767
pub fn new(conference_number: u16, peer_number: u16, message_number: u32, action: String) -> Self {
68-
ConferenceAction {
68+
Action {
6969
conference_number,
7070
peer_number,
7171
message_number,
@@ -80,14 +80,14 @@ mod tests {
8080

8181
encode_decode_test!(
8282
conference_action_encode_decode,
83-
ConferenceAction::new(1, 2, 3, "1234".to_owned())
83+
Action::new(1, 2, 3, "1234".to_owned())
8484
);
8585

8686
#[test]
8787
fn conference_action_from_bytes_encoding_error() {
8888
let err_string = vec![0, 159, 146, 150]; // not UTF8 bytes.
8989
let mut buf = vec![0x63, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x41];
9090
buf.extend_from_slice(&err_string);
91-
assert!(ConferenceAction::from_bytes(&buf).is_err());
91+
assert!(Action::from_bytes(&buf).is_err());
9292
}
9393
}

src/toxcore/messenger/conference/packet/chane_name.rs renamed to src/toxcore/messenger/conference/packet/change_name.rs

File renamed without changes.

src/toxcore/messenger/conference/packet/conference_message.rs renamed to src/toxcore/messenger/conference/packet/message.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use nom::{be_u16, be_u32, rest};
66

77
use crate::toxcore::binary_io::*;
88

9-
/** ConferenceMessage is the struct that holds info to send chat message to a conference.
9+
/** Message is the struct that holds info to send chat message to a conference.
1010
1111
Sent to notify chat message to all member of conference.
1212
@@ -23,7 +23,7 @@ variable | `message`(UTF-8 C String)
2323
2424
*/
2525
#[derive(Clone, Debug, Eq, PartialEq)]
26-
pub struct ConferenceMessage {
26+
pub struct Message {
2727
conference_number: u16,
2828
peer_number: u16,
2929
message_number: u32,
@@ -32,15 +32,15 @@ pub struct ConferenceMessage {
3232
message: String,
3333
}
3434

35-
impl FromBytes for ConferenceMessage {
36-
named!(from_bytes<ConferenceMessage>, do_parse!(
35+
impl FromBytes for Message {
36+
named!(from_bytes<Message>, do_parse!(
3737
tag!("\x63") >>
3838
conference_number: be_u16 >>
3939
peer_number: be_u16 >>
4040
message_number: be_u32 >>
4141
tag!("\x40") >>
4242
message: map_res!(rest, str::from_utf8) >>
43-
(ConferenceMessage {
43+
(Message {
4444
conference_number,
4545
peer_number,
4646
message_number,
@@ -49,7 +49,7 @@ impl FromBytes for ConferenceMessage {
4949
));
5050
}
5151

52-
impl ToBytes for ConferenceMessage {
52+
impl ToBytes for Message {
5353
fn to_bytes<'a>(&self, buf: (&'a mut [u8], usize)) -> Result<(&'a mut [u8], usize), GenError> {
5454
do_gen!(buf,
5555
gen_be_u8!(0x63) >>
@@ -62,10 +62,10 @@ impl ToBytes for ConferenceMessage {
6262
}
6363
}
6464

65-
impl ConferenceMessage {
66-
/// Create new ConferenceMessage object.
65+
impl Message {
66+
/// Create new Message object.
6767
pub fn new(conference_number: u16, peer_number: u16, message_number: u32, message: String) -> Self {
68-
ConferenceMessage {
68+
Message {
6969
conference_number,
7070
peer_number,
7171
message_number,
@@ -80,14 +80,14 @@ mod tests {
8080

8181
encode_decode_test!(
8282
conference_message_encode_decode,
83-
ConferenceMessage::new(1, 2, 3, "1234".to_owned())
83+
Message::new(1, 2, 3, "1234".to_owned())
8484
);
8585

8686
#[test]
8787
fn conference_message_from_bytes_encoding_error() {
8888
let err_string = vec![0, 159, 146, 150]; // not UTF8 bytes.
8989
let mut buf = vec![0x63, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40];
9090
buf.extend_from_slice(&err_string);
91-
assert!(ConferenceMessage::from_bytes(&buf).is_err());
91+
assert!(Message::from_bytes(&buf).is_err());
9292
}
9393
}

src/toxcore/messenger/conference/packet/mod.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ mod ping;
1212
mod new_peer;
1313
mod kill_peer;
1414
mod freeze_peer;
15-
mod chane_name;
15+
mod change_name;
1616
mod change_title;
17-
mod conference_message;
18-
mod conference_action;
17+
mod message;
18+
mod action;
1919

2020
pub use self::invite::*;
2121
pub use self::invite_response::*;
@@ -28,19 +28,19 @@ pub use self::ping::*;
2828
pub use self::new_peer::*;
2929
pub use self::kill_peer::*;
3030
pub use self::freeze_peer::*;
31-
pub use self::chane_name::*;
31+
pub use self::change_name::*;
3232
pub use self::change_title::*;
33-
pub use self::conference_message::*;
34-
pub use self::conference_action::*;
33+
pub use self::message::*;
34+
pub use self::action::*;
3535

3636
use nom::be_u8;
3737
use crate::toxcore::binary_io::*;
3838
use crate::toxcore::crypto_core::*;
3939

40-
/// Length in bytes of conference unique bytes
40+
/// Length in bytes of conference unique bytes.
4141
pub const CONFERENCE_UID_BYTES: usize = 32;
4242

43-
/// Length in bytes of various names in conference
43+
/// Length in bytes of various names in conference.
4444
pub const MAX_NAME_LENGTH_IN_CONFERENCE: usize = 128;
4545

4646
/// Unique id used in conference
@@ -83,9 +83,9 @@ impl ToBytes for ConferenceUID {
8383
/// Type of conference
8484
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
8585
pub enum ConferenceType {
86-
/// Text conference conference.
86+
/// Text conference.
8787
Text = 0x00,
88-
/// Audio conference conference.
88+
/// Audio conference.
8989
Audio,
9090
}
9191

@@ -128,10 +128,10 @@ pub enum Packet {
128128
ChangeName(ChangeName),
129129
/// [`ChangeTitle`](./struct.ChangeTitle.html) structure.
130130
ChangeTitle(ChangeTitle),
131-
/// [`ConferenceMessage`](./struct.ConferenceMessage.html) structure.
132-
ConferenceMessage(ConferenceMessage),
133-
/// [`ConferenceAction`](./struct.ConferenceAction.html) structure.
134-
ConferenceAction(ConferenceAction),
131+
/// [`Message`](./struct.Message.html) structure.
132+
Message(Message),
133+
/// [`Action`](./struct.Action.html) structure.
134+
Action(Action),
135135
}
136136

137137
impl ToBytes for Packet {
@@ -150,8 +150,8 @@ impl ToBytes for Packet {
150150
Packet::FreezePeer(ref p) => p.to_bytes(buf),
151151
Packet::ChangeName(ref p) => p.to_bytes(buf),
152152
Packet::ChangeTitle(ref p) => p.to_bytes(buf),
153-
Packet::ConferenceMessage(ref p) => p.to_bytes(buf),
154-
Packet::ConferenceAction(ref p) => p.to_bytes(buf),
153+
Packet::Message(ref p) => p.to_bytes(buf),
154+
Packet::Action(ref p) => p.to_bytes(buf),
155155
}
156156
}
157157
}
@@ -171,8 +171,8 @@ impl FromBytes for Packet {
171171
map!(FreezePeer::from_bytes, Packet::FreezePeer) |
172172
map!(ChangeName::from_bytes, Packet::ChangeName) |
173173
map!(ChangeTitle::from_bytes, Packet::ChangeTitle) |
174-
map!(ConferenceMessage::from_bytes, Packet::ConferenceMessage) |
175-
map!(ConferenceAction::from_bytes, Packet::ConferenceAction)
174+
map!(Message::from_bytes, Packet::Message) |
175+
map!(Action::from_bytes, Packet::Action)
176176
));
177177
}
178178

@@ -262,11 +262,11 @@ mod tests {
262262

263263
encode_decode_test!(
264264
packet_conference_message_encode_decode,
265-
Packet::ConferenceMessage(ConferenceMessage::new(1, 2, 3, "1234".to_owned()))
265+
Packet::Message(Message::new(1, 2, 3, "1234".to_owned()))
266266
);
267267

268268
encode_decode_test!(
269269
packet_conference_action_encode_decode,
270-
Packet::ConferenceAction(ConferenceAction::new(1, 2, 3, "1234".to_owned()))
270+
Packet::Action(Action::new(1, 2, 3, "1234".to_owned()))
271271
);
272272
}

src/toxcore/messenger/packet/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub use self::file_data::*;
2929
pub use self::status_message::*;
3030
pub use self::file_send_request::*;
3131

32-
pub use crate::toxcore::messenger::conference::packet::{Packet as ConferencePacket, *};
32+
pub use crate::toxcore::messenger::conference::packet::Packet as ConferencePacket;
3333

3434
/** Messenger packet enum that encapsulates all types of Messenger packets.
3535
*/
@@ -104,6 +104,7 @@ impl FromBytes for Packet {
104104
#[cfg(test)]
105105
mod tests {
106106
use super::*;
107+
use crate::toxcore::messenger::conference::packet::{ConferenceType, ConferenceUID, Invite};
107108

108109
encode_decode_test!(
109110
packet_online_encode_decode,

0 commit comments

Comments
 (0)