Skip to content

Commit fc1b093

Browse files
authored
Merge pull request #8 from EgosOwn/master
patch empty message remaining being zero
2 parents 87e799a + fbf11c8 commit fc1b093

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

sms_counter/main.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ def _get_gsm_7bit_map(cls):
2222
46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
2323
63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2424
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, 95, 97, 98, 99,
25-
100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
26-
113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 161, 163, 164,
27-
165, 191, 196, 197, 198, 199, 201, 209, 214, 216, 220, 223, 224,
28-
228, 229, 230, 232, 233, 236, 241, 242, 246, 248, 249, 252, 915,
25+
100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
26+
113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 161, 163, 164,
27+
165, 191, 196, 197, 198, 199, 201, 209, 214, 216, 220, 223, 224,
28+
228, 229, 230, 232, 233, 236, 241, 242, 246, 248, 249, 252, 915,
2929
916, 920, 923, 926, 928, 931, 934, 936, 937]
3030
return gsm_7bit_map
3131

@@ -84,7 +84,11 @@ def count(cls, plaintext):
8484
# and then convert the ceil result to int
8585
# since python 2.7 return a float
8686
messages = int(ceil(length / float(permessage)))
87-
remaining = (permessage * messages) - length
87+
88+
if length == 0:
89+
remaining = permessage
90+
else:
91+
remaining = (permessage * messages) - length
8892

8993
returnset = {
9094
'encoding': encoding,

0 commit comments

Comments
 (0)