summaryrefslogtreecommitdiff
path: root/src/mods/commands/yc_invisible.cpp
blob: 58a8912f09aa478e2c5cc4a8b351502d3d360727 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "../../incl.h"
#include "../../chat/room.h"
#include "../../chat/user.h"

using namespace std;

extern "C"
{
  int extern_function(void *v_arg)
  {
    container *c=(container *)v_arg;

    user* p_user = (user*) c->elem[1];		// the corresponding user
    conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF;

    bool b_invisible = p_user->get_invisible();

    string s_msg = b_invisible
                   ? p_conf->get_elem("chat.msgs.setmodeinvisible")
                   + "<br>\n"
                   : p_conf->get_elem("chat.msgs.unsetmodeinvisible")
                   + "<br>\n";

    p_user->set_invisible( !b_invisible );
    p_user->get_room()->reload_onlineframe();
    p_user->msg_post ( &s_msg  );

    return 0;
  }
}