weechat-idc.py 792 B

12345678910111213141516171819202122232425262728293031323334
  1. import weechat
  2. import socket
  3. import time
  4. weechat.register(
  5. "weechat-idc",
  6. "Andrew Yu",
  7. "0.0.1",
  8. "UNLICENSE",
  9. "Internet Delay Chat Protocol for WeeChat",
  10. "",
  11. "",
  12. ) # last: shutdown_function and charset
  13. def get_status(data):
  14. return "this is the result"
  15. def go_idc(data, command, return_code, out, err):
  16. if return_code == weechat.WEECHAT_HOOK_PROCESS_ERROR:
  17. weechat.prnt("", "Error with command '%s'" % command)
  18. return weechat.WEECHAT_RC_OK
  19. if return_code >= 0:
  20. weechat.prnt("", "return_code = %d" % return_code)
  21. if out:
  22. weechat.prnt("", "stdout: %s" % out)
  23. if err:
  24. weechat.prnt("", "stderr: %s" % err)
  25. return weechat.WEECHAT_RC_OK
  26. hook = weechat.hook_process("func:go_idc", 5000, "go_idc", "")