diff options
Diffstat (limited to 'plugins/plugin20.html')
-rw-r--r-- | plugins/plugin20.html | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/plugins/plugin20.html b/plugins/plugin20.html index 2c2d106c..e17f3346 100644 --- a/plugins/plugin20.html +++ b/plugins/plugin20.html @@ -101,12 +101,12 @@ margin-right: 32px; </blockquote><br> <h3><a name=intro>Introduction</a></h3> -Plugins for XChat are written in C. The interface aims to keep 100% -binary compatability. This means that if you upgrade XChat, you will +Plugins for HexChat are written in C. The interface aims to keep 100% +binary compatability. This means that if you upgrade HexChat, you will not need to recompile your plugins, they'll continue to work. The interface doesn't depend on any structures and offsets, so compiler versions shouldn't have an impact either. The only real requirement of -an XChat plugin, is that it define a "xchat_plugin_init" symbol. This +an HexChat plugin, is that it define a "xchat_plugin_init" symbol. This is your entry point function, see the example below. You should make all your global variables and functions <i>static</i>, so that a symbol is not exported. There is no harm in exporting these symbols, but they @@ -130,7 +130,7 @@ of locale. <a href="#unicode">What does this mean</a>? <h3><a name=sample>Sample plugin</a></h3> This simple plugin autoOps anyone who joins a channel you're in. It also adds a new command /AUTOOPTOGGLE, which can be used to turn the feature ON -or OFF. Every XChat plugin must define an xchat_plugin_init function, this +or OFF. Every HexChat plugin must define an xchat_plugin_init function, this is the normal entry point. xchat_plugin_deinit is optional. <br> <div style="color: #ffffff; background-color: #111199;"> @@ -142,7 +142,7 @@ is the normal entry point. xchat_plugin_deinit is optional. <font color="#00ff00">#define PDESC </font><font color="#00ffff">"Auto Ops anyone that joins"</font> <font color="#00ff00">#define PVERSION </font><font color="#00ffff">"0.1"</font> -<font color="#ffa500"><b>static</b></font> xchat_plugin *ph; <font color="#bebebe"><b>/*</b></font><font color="#bebebe"><b> plugin handle </b></font><font color="#bebebe"><b>*/</b></font> +<font color="#ffa500"><b>static</b></font> hexchat_plugin *ph; <font color="#bebebe"><b>/*</b></font><font color="#bebebe"><b> plugin handle </b></font><font color="#bebebe"><b>*/</b></font> <font color="#ffa500"><b>static</b></font> <font color="#ffa500"><b>int</b></font> enable = <font color="#00ffff">1</font>; <font color="#ffa500"><b>static</b></font> <font color="#ffa500"><b>int</b></font> join_cb(<font color="#ffa500"><b>char</b></font> *word[], <font color="#ffa500"><b>void</b></font> *userdata) @@ -152,7 +152,7 @@ is the normal entry point. xchat_plugin_deinit is optional. xchat_commandf(ph, <font color="#00ffff">"OP </font><font color="#ff00ff">%s</font><font color="#00ffff">"</font>, word[<font color="#00ffff">1</font>]); <font color="#bebebe"><b>/*</b></font><font color="#bebebe"><b> word[1] is the nickname, as in the Settings->Advanced->TextEvents window in xchat </b></font><font color="#bebebe"><b>*/</b></font> - <font color="#ffff00">return</font> XCHAT_EAT_NONE; <font color="#bebebe"><b>/*</b></font><font color="#bebebe"><b> don't eat this event, xchat needs to see it! </b></font><font color="#bebebe"><b>*/</b></font> + <font color="#ffff00">return</font> XCHAT_EAT_NONE; <font color="#bebebe"><b>/*</b></font><font color="#bebebe"><b> don't eat this event, HexChat needs to see it! </b></font><font color="#bebebe"><b>*/</b></font> } <font color="#ffa500"><b>static</b></font> <font color="#ffa500"><b>int</b></font> autooptoggle_cb(<font color="#ffa500"><b>char</b></font> *word[], <font color="#ffa500"><b>char</b></font> *word_eol[], <font color="#ffa500"><b>void</b></font> *userdata) @@ -167,7 +167,7 @@ is the normal entry point. xchat_plugin_deinit is optional. xchat_print(ph, <font color="#00ffff">"AutoOping now disabled!</font><font color="#ff00ff">\n</font><font color="#00ffff">"</font>); } - <font color="#ffff00">return</font> XCHAT_EAT_ALL; <font color="#bebebe"><b>/*</b></font><font color="#bebebe"><b> eat this command so xchat and other plugins can't process it </b></font><font color="#bebebe"><b>*/</b></font> + <font color="#ffff00">return</font> XCHAT_EAT_ALL; <font color="#bebebe"><b>/*</b></font><font color="#bebebe"><b> eat this command so HexChat and other plugins can't process it </b></font><font color="#bebebe"><b>*/</b></font> } <font color="#ffa500"><b>void</b></font> xchat_plugin_get_info(<font color="#ffa500"><b>char</b></font> **name, <font color="#ffa500"><b>char</b></font> **desc, <font color="#ffa500"><b>char</b></font> **version, <font color="#ffa500"><b>void</b></font> **reserved) @@ -186,7 +186,7 @@ is the normal entry point. xchat_plugin_deinit is optional. <font color="#bebebe"><b>/*</b></font><font color="#bebebe"><b> we need to save this for use with any xchat_* functions </b></font><font color="#bebebe"><b>*/</b></font> ph = plugin_handle; - <font color="#bebebe"><b>/*</b></font><font color="#bebebe"><b> tell xchat our info </b></font><font color="#bebebe"><b>*/</b></font> + <font color="#bebebe"><b>/*</b></font><font color="#bebebe"><b> tell HexChat our info </b></font><font color="#bebebe"><b>*/</b></font> *plugin_name = PNAME; *plugin_desc = PDESC; *plugin_version = PVERSION; @@ -358,7 +358,7 @@ Yes, it can be done. All you need is either Simply compile your plugin as a DLL. You should have the following files: <ul> -<li><a href="http://xchat.org/docs/xchat-plugin.h">xchat-plugin.h</a> - Main Plugin header</li> +<li><a href="https://github.com/hexchat/hexchat/blob/master/plugins/hexchat-plugin.h">hexchat-plugin.h</a> - Main Plugin header</li> <li>plugin.c - Your plugin, you need to write this one :)</li> <li>plugin.def - A simple text file containing the following:</li> </ul> @@ -395,16 +395,16 @@ xchat_command(ph, "GUI .....");. </p> <blockquote> <table border=0 cellpadding=4> - <tr><td>GUI ATTACH</td><td>Same function as "Attach Window" in the XChat menu (new for 2.6.2).</td></tr> - <tr><td>GUI DETACH</td><td>Same function as "Detach Tab" in the XChat menu (new for 2.6.2).</td></tr> + <tr><td>GUI ATTACH</td><td>Same function as "Attach Window" in the HexChat menu (new for 2.6.2).</td></tr> + <tr><td>GUI DETACH</td><td>Same function as "Detach Tab" in the HexChat menu (new for 2.6.2).</td></tr> <tr><td>GUI APPLY</td><td>Similar to clicking OK in the settings window. Execute this after /SET to activate GUI changes (new for 2.8.0)</td></tr> <tr><td>GUI COLOR <i>n</i></td><td>Change the tab color of the current context, where n is a number from 0 to 3.</td></tr> <tr><td>GUI FOCUS</td><td>Focus the current window or tab.</td></tr> <tr><td>GUI FLASH</td><td>Flash the taskbar button. It will flash only if the window isn't focused and will stop when it is focused by the user.</td></tr> - <tr><td>GUI HIDE</td><td>Hide the main xchat window completely (this is used by the Systray plugin).</td></tr> - <tr><td>GUI ICONIFY</td><td>Iconify (minimize to taskbar) the current xchat window.</td></tr> + <tr><td>GUI HIDE</td><td>Hide the main HexChat window completely (this is used by the Systray plugin).</td></tr> + <tr><td>GUI ICONIFY</td><td>Iconify (minimize to taskbar) the current HexChat window.</td></tr> <tr><td>GUI MSGBOX <i>text</i></td><td>Displays a asynchronous message box with your text (new for 2.4.5).</td></tr> - <tr><td>GUI SHOW</td><td>Show the main xchat window (if currently hidden).</td></tr> + <tr><td>GUI SHOW</td><td>Show the main HexChat window (if currently hidden).</td></tr> </table> </blockquote> <p> @@ -439,11 +439,11 @@ Parameters and flags: If you want to change an item's toggle state or enabled flag, just ADD an item with exactly the same name and command and specify the -tX -eX parameters you need. -<br><br>It's also possible to add items to XChat's existing menus, for example:<br> +<br><br>It's also possible to add items to HexChat's existing menus, for example:<br> <pre> MENU ADD "Settings/Sub Menu" MENU -t0 ADD "Settings/Sub Menu/My Setting" myseton mysetoff </pre> -However, internal names and layouts of XChat's menu may change in the future, so use at own risk. +However, internal names and layouts of HexChat's menu may change in the future, so use at own risk. <br><br> Here is an example of Radio items: <pre> MENU ADD "Language" @@ -468,10 +468,10 @@ From 2.8.0, you can also change menus other than the main one (i.e popup menus). </pre> <br> -<a name=tray>Starting from 2.8.0 you can manipulate XChat's system tray icon using the /TRAY command</a>: +<a name=tray>Starting from 2.8.0 you can manipulate HexChat's system tray icon using the /TRAY command</a>: <pre> Usage: - TRAY -f <timeout> <file1> [<file2>] Flash tray between two icons. Leave off file2 to use default xchat icon. + TRAY -f <timeout> <file1> [<file2>] Flash tray between two icons. Leave off file2 to use default HexChat icon. TRAY -f <filename> Set tray to a fixed icon. TRAY -i <number> Flash tray with an internal icon. <small>2=Message 5=Highlight 8=Private 11=File</small> @@ -479,12 +479,12 @@ From 2.8.0, you can also change menus other than the main one (i.e popup menus). TRAY -b <title> <text> Set the tray balloon. <small>Supported on Windows from 2.8.1 and 2.8.2 on Linux (libnotify required on Linux).</small> </pre> -Filenames can be ICO or PNG format. PNG format is supported on Linux/BSD and Windows XP (but requires installation of GDI+ on Windows 2000). Set a timeout of -1 to use XChat's default. +Filenames can be ICO or PNG format. PNG format is supported on Linux/BSD and Windows XP (but requires installation of GDI+ on Windows 2000). Set a timeout of -1 to use HexChat's default. <br><br> <h3><a name=unicode>Handling UTF-8/Unicode strings</a></h3> <p> -The XChat plugin API specifies that strings passed to and from xchat must be encoded in UTF-8. +The HexChat plugin API specifies that strings passed to and from HexChat must be encoded in UTF-8. <br><br> What does this mean for the plugin programmer? You just have to be a little careful when passing strings obtained from IRC to system calls. For example, if you're writing a file-server @@ -512,7 +512,7 @@ static void get_file_name(char *nick, char *fname) char buf[256]; FILE *fp; -<font color="#777777"> /* the fname is in UTF-8, because it came from the xchat API */</font> +<font color="#777777"> /* the fname is in UTF-8, because it came from the HexChat API */</font> </pre><font color="#33aa44">#ifdef _WIN32</font><pre> wchar_t wide_name[MAX_PATH]; @@ -601,7 +601,7 @@ xchat_hook_command(ph, "ONOTICE", XCHAT_PRI_NORM, onotice_cb, <blockquote><b>ph:</b> Plugin handle (as given to xchat_plugin_init). <br><b>fd:</b> The file descriptor or socket. <br><b>flags:</b> One or more of XCHAT_FD_READ, XCHAT_FD_WRITE, XCHAT_FD_EXCEPTION, XCHAT_FD_NOTSOCKET. Use bitwise OR to combine them. -XCHAT_FD_NOTSOCKET tells xchat that the provided <b>fd</b> is not a socket, but a "MSVCRT.DLL" pipe. +XCHAT_FD_NOTSOCKET tells HexChat that the provided <b>fd</b> is not a socket, but a "MSVCRT.DLL" pipe. <br><b>callb:</b> Callback function. This will be called when the socket is available for reading/writing or exception (depending on your chosen <b>flags</b>) <br><b>userdata:</b> Pointer passed to the callback function.</blockquote> <b>Returns:</b> Pointer to the hook. Can be passed to xchat_unhook. @@ -644,7 +644,7 @@ tab-window is focused by the window manager. static int youpart_cb(char *word[], void *userdata) { xchat_printf(ph, "You have left channel %s\n", word[3]); - return XCHAT_EAT_XCHAT; /* dont let xchat do its normal printing */ + return XCHAT_EAT_XCHAT; /* dont let HexChat do its normal printing */ } xchat_hook_print(ph, "You Part", XCHAT_PRI_NORM, youpart_cb, NULL); @@ -673,7 +673,7 @@ hook every line that comes from the IRC server, you may use the special name of static int kick_cb(char *word[], char *word_eol[], void *userdata) { xchat_printf(ph, "%s was kicked from %s (reason=%s)\n", word[4], word[3], word_eol[5]); - return XCHAT_EAT_NONE; /* don't eat this event, let other plugins and xchat see it too */ + return XCHAT_EAT_NONE; /* don't eat this event, let other plugins and HexChat see it too */ } xchat_hook_server(ph, "KICK", XCHAT_PRI_NORM, kick_cb, NULL); @@ -737,7 +737,7 @@ removed, so you don't need to call this within your xchat_plugin_deinit() functi <h3><a class=cmd name="xchat_command"> xchat_command() </a></h3> <b>Prototype:</b> void xchat_command(xchat_plugin *ph, const char *command); <br> -<br><b>Description:</b> Executes a command as if it were typed in xchat's input box. +<br><b>Description:</b> Executes a command as if it were typed in HexChat's input box. <br> <br><b>Arguments:</b> <blockquote><b>ph:</b> Plugin handle (as given to xchat_plugin_init). @@ -748,7 +748,7 @@ removed, so you don't need to call this within your xchat_plugin_deinit() functi <h3><a class=cmd name="xchat_commandf"> xchat_commandf() </a></h3> <b>Prototype:</b> void xchat_commandf(xchat_plugin *ph, const char *format, ...); <br> -<br><b>Description:</b> Executes a command as if it were typed in xchat's input box and provides string formating like printf. +<br><b>Description:</b> Executes a command as if it were typed in HexChat's input box and provides string formating like printf. <br> <br><b>Arguments:</b> <blockquote><b>ph:</b> Plugin handle (as given to xchat_plugin_init). @@ -877,7 +877,7 @@ Changed in 2.6.1. If servname is NULL, it finds the channel (or query) by the gi <tr><td>win_ptr</td><td>native window pointer. Unix: (GtkWindow *) Win32: HWND (since 2.6.0).</td></tr> <tr><td>win_status</td><td>window status: "active", "hidden" or "normal" (since 2.0.9).</td> <tr><td>xchatdir</td><td>xchat config directory, e.g.: /home/user/.xchat2 <small>This string is encoded in UTF-8, which means you _should_ convert it to "locale" encoding before using functions like open() or OpenFile(). For best <a href="#unicode">Unicode support</a> on Linux, convert this string using g_filename_from_utf8 and on Windows convert this string to UTF-16LE (wide) and use OpenFileW() etc.</small></td></tr> - <tr><td>xchatdirfs</td><td>xchat config directory, e.g.: /home/user/.xchat2 (since 2.0.9).<small>This string is encoded in local file system encoding, making it ideal for direct use with functions like open() or OpenFile(). For real Unicode support on Windows, it's best not to use xchatdirfs, but xchatdir instead.</small></td></tr> + <tr><td>xchatdirfs</td><td>xchat config directory, e.g.: /home/user/.xchat2 (since 2.0.9).<small>This string is encoded in local file system encoding, making it ideal for direct use with functions like open() or OpenFile(). For real Unicode support on Windows, it's best not to use HexChatdirfs, but HexChatdir instead.</small></td></tr> </table> </blockquote> </blockquote> |