add example for sanitizing xchat_set_pluginpref_int input
This commit is contained in:
parent
588c862f66
commit
71036733e3
|
@ -1068,7 +1068,32 @@ You should never need to edit this file manually.
|
||||||
<br>
|
<br>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<b>Returns:</b> 1 for success, 0 for failure.
|
<b>Returns:</b> 1 for success, 0 for failure.
|
||||||
<br><br><br>
|
<br><br><b>Example:</b>
|
||||||
|
<blockquote>
|
||||||
|
<pre>static int saveint_cb (char *word[], char *word_eol[], void *user_data)
|
||||||
|
{
|
||||||
|
int buffer = atoi (word[2]);
|
||||||
|
|
||||||
|
if (buffer > 0 && buffer < INT_MAX)
|
||||||
|
{
|
||||||
|
if (xchat_set_pluginpref_int (ph, "myint1", buffer))
|
||||||
|
{
|
||||||
|
xchat_printf (ph, "Setting successfully saved!\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xchat_printf (ph, "Error while saving!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xchat_printf (ph, "Invalid input!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return XCHAT_EAT_XCHAT;
|
||||||
|
}</pre>
|
||||||
|
</blockquote>
|
||||||
|
<br><br>
|
||||||
|
|
||||||
<h3><a class=cmd name="xchat_get_pluginpref_int"> xchat_get_pluginpref_int() </a><small>(new for 2.8.10)</small></h3>
|
<h3><a class=cmd name="xchat_get_pluginpref_int"> xchat_get_pluginpref_int() </a><small>(new for 2.8.10)</small></h3>
|
||||||
<b>Prototype:</b> int xchat_get_pluginpref_int (xchat_plugin *ph, const char *var);
|
<b>Prototype:</b> int xchat_get_pluginpref_int (xchat_plugin *ph, const char *var);
|
||||||
|
|
Loading…
Reference in New Issue