- Timestamp:
- 2015-05-06T20:58:51Z (10 years ago)
- Children:
- e9face7
- Parents:
- 6f903c3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/implugin.py
r6f903c3 r2533d10 10 10 import time 11 11 12 import feedparser 13 12 14 # List of functions an IM plugin can export. This library will indicate to 13 15 # BitlBee which functions are actually implemented so omitted features 14 16 # will be disabled, but note that some/many functions are simply mandatory. 17 # (Currently login/-out, buddy_msg, add/remove_buddy.) 15 18 SUPPORTED_FUNCTIONS = [ 16 19 'login', 'keepalive', 'logout', 'buddy_msg', 'set_away', … … 43 46 # Supported away states. If your protocol supports a specific set of 44 47 # away states, put them in a list in this variable. 45 AWAY_STATES = ["Away", "Busy"] #None48 AWAY_STATES = None 46 49 47 50 # Filled in during initialisation: … … 68 71 self.bitlbee_version = bee["version"] 69 72 self.bitlbee_version_str = bee["version_str"] 73 74 self.feeds = {} 75 70 76 # TODO: See how to call into the module here. 71 77 return { … … 101 107 102 108 def add_buddy(self, handle, group): 103 print "%s is my new best friend in %s \o/" % (handle, group) 104 self.bee.add_buddy(handle, group) 105 self.bee.buddy_status(handle, 5, "Friend", "Best friend!") 106 print self.bee.bee_user_by_handle(handle) 107 print self.bee.set_setstr("test", handle) 108 print self.bee.set_reset("test") 109 self.bee.add_buddy(handle, None) 110 self.feeds[handle] = { 111 "url": handle, 112 "seen": set(), 113 } 109 114 110 def set_away(self, state, message): 111 print "You're a slacker: %s (%r)" % (state, message) 115 def buddy_msg(self, handle, msg, flags): 116 feed = self.feeds[handle] 117 cmd = re.split(r"\s+", msg) 118 if cmd[0] == "list": 119 fp = feedparser.parse(handle) 120 for art in fp.entries: 121 line = "%(title)s <%(link)s>" % art 122 ts = 0 123 if "updated_parsed" in art: 124 ts = int(time.mktime(art.updated_parsed)) 125 self.bee.buddy_msg(handle, line, 0, ts) 126 feed["seen"].add(art.id) 112 127 113 128 def set_set(self, setting, value):
Note: See TracChangeset
for help on using the changeset viewer.