wiomoc / whatsappweb-rs

WhatsApp Web client for Rust
MIT License
121 stars 37 forks source link

Getting error on login! #1

Closed infahash closed 6 years ago

infahash commented 6 years ago

please add details about how to getting start with this repository.

infahash commented 6 years ago

@wiomoc Thanks! Getting error on login.

2018-07-02 05:56:43 INFO  [presence] new state: Connected
thread '<unnamed>' panicked at 'not yet implemented', src/node_wire.rs:436:22
note: Run with `RUST_BACKTRACE=1` for a backtrace.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Any', libcore/result.rs:945:5

Anyway I'm new to RUST language and I would like to contribute to your repository.

------- EDIT -------- found the reason for the problem. It's trying to get JID object from somewhere with giving "status, broadcast" as a parameter.

azharuddinkhan8898 commented 6 years ago

@infahash By using "cargo build" I build this project but I am not able to run it. And I just want to get online/offline for the particular number, can you please help

infahash commented 6 years ago

@azharuddinkhan8898 There are some errors in code. so not fully working. but you can build project correctly.

azharuddinkhan8898 commented 6 years ago

@infahash yes I am getting same error as yours.

infahash commented 6 years ago

@azharuddinkhan8898 @wiomoc same problem here that we are facing with whatsapp web on browser. presence->subscribe working only for contacts with chat initialized.

azharuddinkhan8898 commented 6 years ago

@infahash How did you resolved that error ?

infahash commented 6 years ago

@azharuddinkhan8898 Yes. I have fixed if from a bad way because I have no experience with rust language and it's hard to understand. boring.

I have changed node_wire.rs as follow.

impl Jid {
    fn from_node_pair(id: &str, surfix: &str) -> Jid {
        Jid {
            id: id.to_string(),
            is_group: match surfix {
                "c.us" => false,
                "g.us" => true,
                "s.whatsapp.net" => false,
//                _ => unimplemented!()//return Err(())
                _ => false//return Err(())
            }
        }
    }

    fn into_node_pair(self) -> (String, &'static str) {
        (self.id, if self.is_group {
            "g.us"
        } else {
            "c.us"
        })
    }
}

replaced _ => unimplemented!() as _ => false

wiomoc commented 6 years ago

I couldn't reproduce your errors so I implemented some error handling/tracing in the node parser. Could you test this again and send me the error(s)

@infahash

presence->subscribe working only for contacts with chat initialized.

If the contact enables "last online" sharing, you'll get directly a message including the last presence state. If not, you'll only get a message if the contact is online or the presence changes

wiomoc commented 6 years ago

hotfix is on master

infahash commented 6 years ago

@wiomoc How to subscribe for few numbers to get presence update?

azharuddinkhan8898 commented 6 years ago

@wiomoc @infahash getting below error.

2018-07-04 11:13:02 INFO  [presence] new state: Connected
thread '<unnamed>' panicked at 'index out of bounds: the len is 148 but the index is 148', src/node_wire.rs:206:39
note: Run with `RUST_BACKTRACE=1` for a backtrace.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Any', libcore/result.rs:945:5

Can you please help me with this.

azharuddinkhan8898 commented 6 years ago

@wiomoc @infahash getting this error too.

2018-07-04 12:10:47 INFO  [presence] new state: Connected
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Error(Msg("Node has invalid binary format"), State { next_error: Some(Error(Msg("Couldn\'t read node content (list), node decription: response"), State { next_error: Some(Error(Msg("Couldn\'t read list item: 115, size: 37379"), State { next_error: Some(Error(Msg("Couldn\'t read attribute :notify, node decription: user"), State { next_error: Some(Error(Msg("invalid jid surfix N"), State { next_error: None, backtrace: InternalBacktrace { backtrace: None } })), backtrace: InternalBacktrace { backtrace: None } })), backtrace: InternalBacktrace { backtrace: None } })), backtrace: InternalBacktrace { backtrace: None } })), backtrace: InternalBacktrace { backtrace: None } })', libcore/result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Any', libcore/result.rs:945:5