tgalal / yowsup

The WhatsApp lib
GNU General Public License v3.0
7.08k stars 2.23k forks source link

Simplify your internal identification of plaintext and encryption version context #968

Open CharlesOkwuagwu opened 9 years ago

CharlesOkwuagwu commented 9 years ago

@tgalal https://github.com/tgalal/yowsup/blob/893cd581a69745cc4732ebf408aac5df04663d84/yowsup/layers/axolotl/layer.py#L46

self.skipEncJids = [] self.v2Jids = [] #people we're going to send v2 enc

Replace these with encContext , a dictionary keyed on JID having values 0,1, 2, ...

encContext[aaaaa@s.wa.net] = 0 # plain-text
encContext[bbbbb@s.wa.net] = 1 # enc V1
encContext[ccccc@s.wa.net] = 2 # enc V2
encContext[nnnnn@s.wa.net] = n # enc Vn

Will make it easier to manage case where clients are changing (upgrading) their enc versions, a JID only ever has one current context determined by the latest (non-group) message received from that JID

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

tgalal commented 9 years ago

I think it makes sense how you proposed it, so I'd like to keep that open till implemented