Remove useless messageEncodings struct

This commit is contained in:
Kagami Hiiragi 2015-01-18 13:20:32 +03:00
parent 3e9f3a62a6
commit 9208e95e20
3 changed files with 0 additions and 35 deletions

View File

@ -34,7 +34,6 @@ API documentation is available [here](https://bitchan.github.io/bitmessage/docs/
- [x] net_addr
- [x] inv_vect
- [x] encrypted
- [x] message encodings
- [x] service features
- [x] pubkey features
- [x] Message types

View File

@ -496,29 +496,6 @@ exports.encrypted = {
},
};
/**
* Message encodings. Extends {@link var_int} by adding known encoding type
* constants.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#Message_Encodings}
* @namespace
*/
exports.messageEncodings = objectAssign(Object.create(var_int), {
/**
* Any data with this number may be ignored. The sending node might
* simply be sharing its public key with you.
*/
IGNORE: 0,
/**
* UTF-8. No 'Subject' or 'Body' sections. Useful for simple strings
* of data, like URIs or magnet links.
*/
TRIVIAL: 1,
/**
* UTF-8. Uses 'Subject' and 'Body' sections. No MIME is used.
*/
SIMPLE: 2,
});
// Creates bitfield class of the specified size.
var bitfield = function(size) {
var bytesize = size / 8;

11
test.js
View File

@ -14,7 +14,6 @@ var var_int_list = structs.var_int_list;
var net_addr = structs.net_addr;
var inv_vect = structs.inv_vect;
var encrypted = structs.encrypted;
var messageEncodings = structs.messageEncodings;
var serviceFeatures = structs.serviceFeatures;
var pubkeyFeatures = structs.pubkeyFeatures;
var messages = bitmessage.messages;
@ -263,16 +262,6 @@ describe("Common structures", function() {
});
});
describe("message encodings", function() {
it("should decode", function() {
expect(messageEncodings.decode(Buffer([2])).value).to.equal(messageEncodings.SIMPLE);
});
it("should encode", function() {
expect(messageEncodings.encode(messageEncodings.SIMPLE).toString("hex")).to.equal("02");
});
});
describe("service features", function() {
it("should decode", function() {
expect(serviceFeatures.decode(Buffer("0000000000000001", "hex"))).to.have.members([serviceFeatures.NODE_NETWORK]);