Module meshchatlib

Synopsis

Functions
meshchatlib.die()

Exit the program with an error message

meshchatlib.capture()

Execute a command and capture the output

meshchatlib.node_name()

Retrieve the current node name

meshchatlib.zone_name()

Retrieve the current MeshChat zone name that the node is operating under

meshchatlib.file_md5()

Generate the MD5 sum of a file

meshchatlib.hash()

Generate a unique hash

meshchatlib.str_escape()

Escape percent signs

meshchatlib.die(msg)

Exit the program with an error message.

Parameters
msg (string)

Message to display

meshchatlib.capture(cmd)

Execute a command and capture the output.

Parameters
cmd (string)

Command line to execute

Return Values
(string)

stdout of the command

meshchatlib.node_name()

Retrieve the current node name.

This function will interogate the UCI settings to retrieve the current node name stored in the hsmmmesh settings.

Return Values
(string)

Name of current node

meshchatlib.zone_name()

Retrieve the current MeshChat zone name that the node is operating under.

Return Values
(string)

Name of MeshChat zone

meshchatlib.file_md5(file)

Generate the MD5 sum of a file.

This under the covers relies on md5sum and executes md5sum against the specified file.

Note

There is no checking to determine if md5sum is installed or executable. In the future, this may change.

Parameters
file (string)

Path to file

Return Values
(string)

Result of md5sum of the file

meshchatlib.hash()

Generate a unique hash.

Combine the current time (epoch time) and a randomly generated number between 0 - 99999 and run through md5sum to generate a random hash.

Note

There is no checking to determine if md5sum is installed or executable. In the future, this may change.

Return Values
(string)

Generated hash value

meshchatlib.str_escape(str)

Escape percent signs.

Parameters
str (string)

String to encode

Return Values
(string)

Encoded string