Beispiel #1
0
JoinEvent evt_join(struct raw_event *raw) {
    JoinEvent event;
    event.timestamp = &raw->timestamp;
    event.user = user_info(raw->prefix);
    event.channel = raw->params[0];
    return event;
}
Beispiel #2
0
QuitEvent evt_quit(struct raw_event *raw) {
    QuitEvent event;
    event.timestamp = &raw->timestamp;
    event.user = user_info(raw->prefix);
    event.message = raw->params[0];
    return event;
}
Beispiel #3
0
void lobby_info::process_userlist()
{
	SCOPE_LB;
	users_.clear();
	FOREACH(const AUTO & c, gamelist_.child_range("user"))
	{
		users_.push_back(user_info(c));
	}
	FOREACH(AUTO & ui, users_)
	{
		if(ui.game_id != 0) {
			game_info* g = get_game_by_id(ui.game_id);
			if(g == NULL) {
				WRN_NG << "User " << ui.name
					   << " has unknown game_id: " << ui.game_id << "\n";
			} else {
				switch(ui.relation) {
					case user_info::FRIEND:
						g->has_friends = true;
						break;
					case user_info::IGNORED:
						g->has_ignored = true;
						break;
					default:
						break;
				}
			}
		}
	}
}
Beispiel #4
0
NickEvent evt_nick(struct raw_event *raw) {
    NickEvent event;
    event.timestamp = &raw->timestamp;
    event.user = user_info(raw->prefix);
    event.new_nick = raw->params[0];
    return event;
}
Beispiel #5
0
InviteEvent evt_invite(struct raw_event *raw) {
    InviteEvent event;
    event.timestamp = &raw->timestamp;
    event.user = user_info(raw->prefix);
    event.nick = raw->params[0];
    event.channel = raw->params[1];
    return event;
}
Beispiel #6
0
TopicEvent evt_topic(struct raw_event *raw) {
    TopicEvent event;
    event.timestamp = &raw->timestamp;
    event.user = user_info(raw->prefix);
    event.channel = raw->params[0];
    event.topic = raw->params[1];
    return event;
}
Beispiel #7
0
PartEvent evt_part(struct raw_event *raw) {
    PartEvent event;
    event.timestamp = &raw->timestamp;
    event.user = user_info(raw->prefix);
    event.channel = raw->params[0];
    event.message = raw->params[1];
    return event;
}
Beispiel #8
0
MessageEvent evt_message(struct raw_event *raw) {
    MessageEvent event;
    event.timestamp = &raw->timestamp;
    event.user = user_info(raw->prefix);
    event.is_channel = (raw->params[0][0] == '#');
    event.to = raw->params[0];
    event.message = raw->params[1];
    return event;
}
Beispiel #9
0
KickEvent evt_kick(struct raw_event *raw) {
    KickEvent event;
    event.timestamp = &raw->timestamp;
    event.user = user_info(raw->prefix);
    event.channel = raw->params[0];
    event.nick = raw->params[1];
    event.message = raw->params[2];
    return event;
}
Beispiel #10
0
ModeEvent evt_mode(struct raw_event *raw) {
    ModeEvent event;
    int i;
    char op = '\0';  /* Invalid character to initialize variable */
    unsigned short int current_flag = 0x0000;
    char* flags = raw->params[1];

    event.timestamp = &raw->timestamp;
    event.is_channel = (raw->params[0][0] == '#');
    event.user = user_info(event.is_channel? raw->prefix : NULL);
    event.target = raw->params[0];
    event.set_flags = 0x0000;
    event.unset_flags = 0x0000;
    event.flag_str = flags;
    event.num_params = raw->num_params - 2;

    /* Process flags */
    for (i = 0; i < strlen(flags); i++) {
        if (flags[i] == '+' || flags[i] == '-') {
            op = flags[i];
            continue;
        }

        switch (flags[i]) {
            case 'p': current_flag = CH_PRIVATE;    break;
            case 't': current_flag = CH_TOPICLOCK;  break;
            case 'n': current_flag = CH_NOEXTMSGS;  break;
            case 'm': current_flag = CH_MODERATED;  break;
            case 'b': current_flag = CH_BAN;        break;
            case 'l': current_flag = CH_LIMIT;      break;
            case 'v': current_flag = CH_VOICE;      break;
            case 'k': current_flag = CH_KEY;        break;
            case 's': current_flag = CH_SECRET;     break;
            case 'w': current_flag = USR_WALLOPS;   break;
            case 'i': current_flag = event.is_channel? CH_INVITEONLY : USR_INVISIBLE;       break;
            case 'o': current_flag = event.is_channel? CH_OPERATOR   : USR_OPERATOR;        break;
            default:  current_flag = 0x0000; break;
        }

        /* Update the corresponding flags */
        if (op == '+') {
            event.set_flags |= current_flag;
        } else if (op == '-') {
            event.unset_flags |= current_flag;
        }
    }

    /* Add the mode parameters (only available in channel mode) */
    if (event.num_params > 0) {
        for (i = 0; i < event.num_params; i++) {
            event.params[i] = raw->params[i + 2];
        }
    }

    return event;
}
Beispiel #11
0
int main(int argc, char **argv) {
	int n, id;
	char name[21];
	printf("请输入代表数字:\n0.建表\n1.添加\n2.查看全部\n3.根据id查看\n4.根据name查看\n5.删除\n");
	printf("choose[0 - 5]:");
	scanf("%d", &n);
	switch(n) {
		case 0:
			creat_table();
			printf("建表成功\n");
			break;
		case 1:
			insert_data();
			printf("添加成功\n");
			break;
		case 2:
			search_data();
			printf("查看成功\n");
			break;
		case 3:
			printf("请输入id:");
			scanf("%d", &id);
			user_info(id, NULL);
			printf("查看成功\n");
			break;
		case 4:
			printf("请输入name:");
			scanf("%s", name);
			user_info(0, name);
			printf("查看成功\n");
			break;
		case 5:
			printf("请输入id:");
			scanf("%d", &id);
			user_del(id);
			printf("删除成功\n");
			break;
		default :
			printf("\nerror\n");
	}
	return 0;
}
Beispiel #12
0
void reset_user_info() {/*{{{*/
    if(user != NULL) free(user);
    user = user_info(conn);
    gtk_label_set_text(lbl_username, user->id);
    gtk_label_set_text(lbl_card, user->card);
    gtk_label_set_text(lbl_phone, user->phone);

    gtk_entry_set_text(et_password, user->password);
    gtk_entry_set_text(et_repassword, user->password);
    gtk_entry_set_text(et_card, user->card);
    gtk_entry_set_text(et_phone, user->phone);
}/*}}}*/
Beispiel #13
0
		URI::URI(const StringT & s) : _url(s), _port(0)
		{
			URIImpl::Components components;

			URIImpl::IteratorT end = URIImpl::Parser::parse(_url.data(), _url.data() + _url.size(), components);

			if (!components.complete) {
				throw InvalidFormatError(_url, end - _url.data());
			}

			if (components.scheme_begin != NULL) {
				_scheme = StringT(components.scheme_begin, components.scheme_end);
			}

			if (components.hierarchy_begin != NULL) {
				if (components.hierarchy.authority_begin != NULL) {
					_authority = StringT(components.hierarchy.authority_begin, components.hierarchy.authority_end);

					if (components.hierarchy.authority.user_info_begin != NULL) {
						StringT user_info(components.hierarchy.authority.user_info_begin, components.hierarchy.authority.user_info_end);
						split(user_info, ':', std::back_inserter(_user_info));
					}

					if (components.hierarchy.authority.host_begin != NULL) {
						_hostname = StringT(components.hierarchy.authority.host_begin, components.hierarchy.authority.host_end);
					}

					if (components.hierarchy.authority.port_begin != NULL) {
						_port = std::stoul(StringT(components.hierarchy.authority.port_begin, components.hierarchy.authority.port_end));
					}
				}

				if (components.hierarchy.path_begin != NULL) {
					_path = StringT(components.hierarchy.path_begin, components.hierarchy.path_end);
				}
			}

			if (components.query_begin != NULL) {
				_query = StringT(components.query_begin, components.query_end);
			}

			if (components.fragment_begin != NULL) {
				_fragment = StringT(components.fragment_begin, components.fragment_end);
			}
		}
Beispiel #14
0
    virtual void ProcessMessage( const osc::ReceivedMessage& m, 
			const IpEndpointName& remoteEndpoint )
    {
        try{
    
            if( std::strcmp( m.AddressPattern(), "/groupclient/user_info" ) == 0 ){
                user_info( m, remoteEndpoint );
            }else if( std::strcmp( m.AddressPattern(), "/groupclient/ping" ) == 0 ){
                ping( m, remoteEndpoint );
            }else if( std::strcmp( m.AddressPattern(), "/groupclient/user_alive_status" ) == 0 ){
                user_alive_status( m, remoteEndpoint );
            }else if( std::strcmp( m.AddressPattern(), "/groupclient/user_group_status" ) == 0 ){
                user_group_status( m, remoteEndpoint );
            }

        }catch( osc::Exception& e ){
            std::cout << "error while parsing message: " << e.what() << "\n";
        }
    }
Beispiel #15
0
inline
std::string authority(const uri &uri_) {
    std::string user_info(uri_.user_info());
	std::string host(uri_.host());
    std::string port(uri_.port());
	std::string authority;
	if (!boost::empty(user_info))
	{
		std::copy(boost::begin(user_info), boost::end(user_info), std::back_inserter(authority));
		authority.push_back('@');
	}
	if (!boost::empty(host))
	{
		std::copy(boost::begin(host), boost::end(host), std::back_inserter(authority));
	}
	if (!boost::empty(port))
	{
		authority.push_back(':');
		std::copy(boost::begin(port), boost::end(port), std::back_inserter(authority));
	}
	return authority;
}
Beispiel #16
0
base_device::base_device(const string &device_id, const int &device_type, const string &device_name, const string &device_manufacture, const string &device_ip, const long &device_port, const string &user_name, const string &user_pwd)
	:m_device_id(device_id), m_device_type(device_type), m_device_name(device_name), m_device_manufacture(device_manufacture), m_device_ip(device_ip), m_device_port(device_port), m_device_cur_status(vds_OK)
{
	DeviceUserInfo user_info(user_name, user_pwd);
	m_user_lists.insert(user_name, user_info);
}
Beispiel #17
0
/// Write isis_vms_compat
void SaveISISNexus::write_isis_vms_compat() {
  NXmakegroup(handle, "isis_vms_compat", "IXvms");
  NXopengroup(handle, "isis_vms_compat", "IXvms");
  int ndet = m_isisRaw->i_det;
  int nmon = m_isisRaw->i_mon;

  saveInt("ADD", &m_isisRaw->add, 9);
  saveInt("CODE", m_isisRaw->code, ndet);
  saveInt("CRAT", m_isisRaw->crat, ndet);

  write_rpb();
  write_spb();
  write_vpb();
  saveInt("DAEP", &m_isisRaw->daep, 64);
  saveInt("DELT", m_isisRaw->delt, ndet);
  saveInt("FORM", &m_isisRaw->data_format);
  saveChar("HDR", &m_isisRaw->hdr, 80);
  saveFloat("LEN2", m_isisRaw->len2, ndet);
  saveInt("MDET", m_isisRaw->mdet, nmon);
  saveInt("MODN", m_isisRaw->modn, ndet);
  saveInt("MONP", m_isisRaw->monp, nmon);
  saveInt("MPOS", m_isisRaw->mpos, ndet);
  saveChar("NAME", m_isisRaw->i_inst, 8);
  saveInt("NDET", &ndet);
  saveInt("NFPP", &m_isisRaw->t_nfpp);
  saveInt("NMON", &nmon);
  saveInt("NPER", &m_isisRaw->t_nper);
  saveInt("NSER", &m_isisRaw->e_nse);
  saveInt("NSP1", &m_isisRaw->t_nsp1);
  saveInt("NTC1", &m_isisRaw->t_ntc1);
  saveInt("NTRG", &m_isisRaw->t_ntrg);
  saveInt("NUSE", &m_isisRaw->i_use);
  saveInt("PMAP", &m_isisRaw->t_pmap, 256);
  saveInt("PRE1", &m_isisRaw->t_pre1);
  saveInt("RUN", &m_isisRaw->r_number);
  saveInt("SPEC", m_isisRaw->spec, ndet);
  saveInt("TCM1", &m_isisRaw->t_tcm1);
  saveFloat("TCP1", m_isisRaw->t_tcp1, 20);
  saveInt("TIMR", m_isisRaw->timr, ndet);
  saveChar("TITL", m_isisRaw->r_title, 80);
  saveFloat("TTHE", m_isisRaw->tthe, ndet);
  saveInt("UDET", m_isisRaw->udet, ndet);
  saveInt("ULEN", &m_isisRaw->u_len);
  std::string user_info(160, ' ');
  if (m_isisRaw->u_len > 0) {
    std::copy(reinterpret_cast<char *>(&m_isisRaw->user),
              reinterpret_cast<char *>(&m_isisRaw->user) + m_isisRaw->u_len,
              user_info.begin());
  }
  saveString("USER", user_info);
  saveInt("VER1", &m_isisRaw->frmt_ver_no);
  saveInt("VER2", &m_isisRaw->ver2);
  saveInt("VER3", &m_isisRaw->ver3);
  saveInt("VER4", &m_isisRaw->ver4);
  saveInt("VER5", &m_isisRaw->ver5);
  saveInt("VER6", &m_isisRaw->ver6);
  saveInt("VER7", &m_isisRaw->ver7);
  saveInt("VER8", &m_isisRaw->ver8);
  int tmp_int(0);
  saveInt("VER9", &tmp_int);

  int n = m_isisRaw->logsect.nlines;
  log_notes.resize(n);
  for (int i = 0; i < n; ++i) {
    log_notes[i].assign(m_isisRaw->logsect.lines[i].data,
                        m_isisRaw->logsect.lines[i].len);
  }
  int ll = saveStringVectorOpen("NOTE", log_notes);
  saveInt("NTNL", &n);
  saveInt("NTLL", &ll);

  NXclosegroup(handle); // isis_vms_compat
}
Beispiel #18
0
void url::
port(const stream9::opt<uint16_t> port)
{
    rebuild(scheme(), host(), port,
            path(), query(), fragment(), user_info());
}
Beispiel #19
0
void url::
fragment(const stream9::opt<boost::string_ref> &fragment)
{
    rebuild(scheme(), host(), port(), path(), query(),
                                      fragment, user_info());
}
Beispiel #20
0
void url::
scheme(const boost::string_ref &scheme)
{
    rebuild(scheme, host(), port(), path(), query(), fragment(), user_info());
}