/[weechat]/weechat/src/plugins/python/wee-python.c
ViewVC logotype

Diff of /weechat/src/plugins/python/wee-python.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by flashcode, Thu May 5 16:26:34 2005 UTC revision 1.3 by kolter, Thu Jun 16 16:41:41 2005 UTC
# Line 58  wee_python_register (PyObject *self, PyO Line 58  wee_python_register (PyObject *self, PyO
58          irc_display_prefix (NULL, PREFIX_ERROR);          irc_display_prefix (NULL, PREFIX_ERROR);
59          gui_printf (NULL,          gui_printf (NULL,
60                      _("%s error: wrong parameters for \"%s\" function\n"),                      _("%s error: wrong parameters for \"%s\" function\n"),
61                      "Python", "print_with_channel");                      "Python", "register");
62          return NULL;          return NULL;
63      }      }
64            
# Line 140  wee_python_print (PyObject *self, PyObje Line 140  wee_python_print (PyObject *self, PyObje
140          irc_display_prefix (NULL, PREFIX_ERROR);          irc_display_prefix (NULL, PREFIX_ERROR);
141          gui_printf (NULL,          gui_printf (NULL,
142                      _("%s error: wrong parameters for \"%s\" function\n"),                      _("%s error: wrong parameters for \"%s\" function\n"),
143                      "Python", "print");                      "Python", "prnt");
144          return NULL;          return NULL;
145      }      }
146            
# Line 407  wee_python_init () Line 407  wee_python_init ()
407      {      {
408          wee_log_printf (_("Loading %s module \"weechat\"\n"), "Python");          wee_log_printf (_("Loading %s module \"weechat\"\n"), "Python");
409          Py_InitModule ("weechat", weechat_funcs);          Py_InitModule ("weechat", weechat_funcs);
410    
411            if (PyRun_SimpleString (
412                                    "import weechat, sys, string\n"
413    
414                                    "class weechatStdout:\n"
415                                    "\tdef write(self, str):\n"
416                                    "\t\tstr = string.strip(str)\n"
417                                    "\t\tif str != \"\":\n"
418                                    "\t\t\tweechat.prnt(\"Python stdout : \" + str, \"\")\n"
419    
420                                    "class weechatStderr:\n"
421                                    "\tdef write(self, str):\n"
422                                    "\t\tstr = string.strip(str)\n"
423                                    "\t\tif str != \"\":\n"
424                                    "\t\t\tweechat.prnt(\"Python stderr : \" + str, \"\")\n"
425    
426                                    "sys.stdout = weechatStdout()\n"
427                                    "sys.stderr = weechatStderr()\n"
428                                    ) != 0)
429              {
430                irc_display_prefix (NULL, PREFIX_PLUGIN);
431                gui_printf (NULL,
432                            _("%s error: error while redirecting stdout and stderr\n"),
433                            "Python");
434              }
435      }      }
436  }  }
437    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26