diff options
| author | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:42 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:42 +0200 |
| commit | 98eac951f8087b213f5850bd126dcb279db360a8 (patch) | |
| tree | c121f5c4df1aab847defa539990c1315bd5ba4a8 /mods/html/yc_help.cpp | |
| parent | 0537da9d1e0f593130fc3967befb71e673b016bc (diff) | |
tagging ychat-0.6ychat-0.6
Diffstat (limited to 'mods/html/yc_help.cpp')
| -rw-r--r-- | mods/html/yc_help.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/mods/html/yc_help.cpp b/mods/html/yc_help.cpp new file mode 100644 index 0000000..a746004 --- /dev/null +++ b/mods/html/yc_help.cpp @@ -0,0 +1,45 @@ +#include <iostream> +#include <string> +#include "../../glob.h" +#include "../../hmap.h" +#include "../../lang.h" + +/* + gcc -shared -o yc_name.so yc_name.cpp +*/ + +using namespace std; + +extern "C" { + export int extern_function(void *v_arg); + + int extern_function(void *v_arg) + { + container* c = (container*) v_arg; + string* s_content = &(*((map_string*) c->elem[2]))["content"]; + lang* p_lang = (lang*) c->elem[0]; + + vector<string>* p_vec_keys = + ((hmap<dynmod*,string>*) c->elem[1])->get_key_vector(); + + sort(p_vec_keys->begin(), p_vec_keys->end()); + vector<string>::iterator p_vec_keys_iter = p_vec_keys->begin(); + + while( p_vec_keys_iter != p_vec_keys->end() ) { + if ( p_vec_keys_iter->find( "mods/commands/", 0 ) != string::npos ) + { + s_content->append( "<tr><td>" ); + string s_helptext = p_lang->get_val( *p_vec_keys_iter ) ; + + unsigned int i_pos = s_helptext.find( "||", 0 ); + if ( i_pos != string::npos ) + s_helptext.replace( i_pos, 2, "</td><td>" ); + + s_content->append( s_helptext ); + s_content->append( "</td></tr>\n" ); + } + p_vec_keys_iter++; + } + } +} + |
