wiomoc/whatsappweb-rs

Getting error on login!

Closed this issue · 12 comments

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

@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.

@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

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

  • first you need to hava protoc installed.
  • then use cargo run --package whatsappweb --example presence
  • this will generate qrcode as png file on project root.
  • scan it soon after generated.

@infahash
yes I am getting same error as yours.

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

@infahash
How did you resolved that error ?

@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

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

hotfix is on master

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

@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.

@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