- Timestamp:
- 2015-05-09T12:17:54Z (10 years ago)
- Children:
- 17aa9a2
- Parents:
- 199d51c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/implugin.py
r199d51c rb20014b 25 25 ] 26 26 27 def make_version_tuple(hex): 28 """Convert the BitlBee binary-encoded version number into something 29 more "Pythonic". Could use distutils.version instead but its main 30 benefit appears to be string parsing which here is not that useful.""" 31 32 return (hex >> 16, (hex >> 8) & 0xff, hex & 0xff) 33 27 34 class RpcForwarder(object): 28 35 """Tiny object that forwards RPCs from local Python code to BitlBee … … 50 57 51 58 # Filled in during initialisation: 52 # Version code in hex. So if you need to do comparisions, for example 53 # check "self.bitlbee_version >= 0x030202" for versions 3.2.2+ 59 # Version number as a three-tuple, so 3.2 becomes (3, 2, 0). 54 60 bitlbee_version = None 55 61 # Full version string … … 75 81 def init(self, bee): 76 82 self.bee = RpcForwarder(bee["method_list"], self._conn.call) 77 self.bitlbee_version = bee["version"]83 self.bitlbee_version = make_version_tuple(bee["version"]) 78 84 self.bitlbee_version_str = bee["version_str"] 79 85 … … 104 110 creds = {"username": account["user"], "password": account["pass"]} 105 111 r = self.ua.post(self.url("/api/login"), creds) 112 self.bee.log("You're running BitlBee %d.%d.%d" % self.bitlbee_version) 106 113 if r.status_code != 200: 107 114 self.bee.error("HTTP error %d" % r.status_code)
Note: See TracChangeset
for help on using the changeset viewer.