Exemple #1
0
void show_task_state(unsigned int f)
{
	printf("task->state = ");

	if (!f) {
		printf("TASK_SLEEPING\n");
		return;
	}

	SHOW_FLAG(f, TASK_WOKEN_OTHER);
	SHOW_FLAG(f, TASK_WOKEN_RES);
	SHOW_FLAG(f, TASK_WOKEN_MSG);
	SHOW_FLAG(f, TASK_WOKEN_SIGNAL);
	SHOW_FLAG(f, TASK_WOKEN_IO);
	SHOW_FLAG(f, TASK_WOKEN_TIMER);
	SHOW_FLAG(f, TASK_WOKEN_INIT);
	SHOW_FLAG(f, TASK_RUNNING);

	if (f) {
		printf("EXTRA(0x%08x)", f);
	}
	putchar('\n');
}
Exemple #2
0
void show_conn_flags(unsigned int f)
{
	printf("conn->flags = ");
	if (!f) {
		printf("0\n");
		return;
	}

	SHOW_FLAG(f, CO_FL_XPRT_TRACKED);
	SHOW_FLAG(f, CO_FL_PRIVATE);
	SHOW_FLAG(f, CO_FL_ACCEPT_PROXY);
	SHOW_FLAG(f, CO_FL_SSL_WAIT_HS);
	SHOW_FLAG(f, CO_FL_SEND_PROXY);
	SHOW_FLAG(f, CO_FL_WAIT_L6_CONN);
	SHOW_FLAG(f, CO_FL_WAIT_L4_CONN);
	SHOW_FLAG(f, CO_FL_CONNECTED);
	SHOW_FLAG(f, CO_FL_ERROR);
	SHOW_FLAG(f, CO_FL_SOCK_WR_SH);
	SHOW_FLAG(f, CO_FL_SOCK_RD_SH);
	SHOW_FLAG(f, CO_FL_DATA_WR_SH);
	SHOW_FLAG(f, CO_FL_DATA_RD_SH);
	SHOW_FLAG(f, CO_FL_WAKE_DATA);
	SHOW_FLAG(f, CO_FL_INIT_DATA);
	SHOW_FLAG(f, CO_FL_ADDR_TO_SET);
	SHOW_FLAG(f, CO_FL_ADDR_FROM_SET);
	SHOW_FLAG(f, CO_FL_WAIT_ROOM);
	SHOW_FLAG(f, CO_FL_WAIT_DATA);
	SHOW_FLAG(f, CO_FL_XPRT_READY);
	SHOW_FLAG(f, CO_FL_CTRL_READY);
	SHOW_FLAG(f, CO_FL_CURR_WR_ENA);
	SHOW_FLAG(f, CO_FL_DATA_WR_ENA);
	SHOW_FLAG(f, CO_FL_SOCK_WR_ENA);
	SHOW_FLAG(f, CO_FL_CURR_RD_ENA);
	SHOW_FLAG(f, CO_FL_DATA_RD_ENA);
	SHOW_FLAG(f, CO_FL_SOCK_RD_ENA);

	if (f) {
		printf("EXTRA(0x%08x)", f);
	}
	putchar('\n');
}
Exemple #3
0
void show_chn_flags(unsigned int f)
{
	printf("chn->flags  = ");

	if (!f) {
		printf("0\n");
		return;
	}

	SHOW_FLAG(f, CF_ISRESP);
	SHOW_FLAG(f, CF_WAKE_ONCE);
	SHOW_FLAG(f, CF_NEVER_WAIT);
	SHOW_FLAG(f, CF_SEND_DONTWAIT);
	SHOW_FLAG(f, CF_EXPECT_MORE);
	SHOW_FLAG(f, CF_DONT_READ);
	SHOW_FLAG(f, CF_AUTO_CONNECT);
	SHOW_FLAG(f, CF_READ_DONTWAIT);
	SHOW_FLAG(f, CF_KERN_SPLICING);
	SHOW_FLAG(f, CF_READ_ATTACHED);
	SHOW_FLAG(f, CF_ANA_TIMEOUT);
	SHOW_FLAG(f, CF_WROTE_DATA);
	SHOW_FLAG(f, CF_STREAMER_FAST);
	SHOW_FLAG(f, CF_STREAMER);
	SHOW_FLAG(f, CF_AUTO_CLOSE);
	SHOW_FLAG(f, CF_SHUTW_NOW);
	SHOW_FLAG(f, CF_SHUTW);
	SHOW_FLAG(f, CF_WAKE_WRITE);
	SHOW_FLAG(f, CF_WRITE_ERROR);
	SHOW_FLAG(f, CF_WRITE_TIMEOUT);
	SHOW_FLAG(f, CF_WRITE_PARTIAL);
	SHOW_FLAG(f, CF_WRITE_NULL);
	SHOW_FLAG(f, CF_READ_NOEXP);
	SHOW_FLAG(f, CF_SHUTR_NOW);
	SHOW_FLAG(f, CF_SHUTR);
	SHOW_FLAG(f, CF_WAKE_CONNECT);
	SHOW_FLAG(f, CF_READ_ERROR);
	SHOW_FLAG(f, CF_READ_TIMEOUT);
	SHOW_FLAG(f, CF_READ_PARTIAL);
	SHOW_FLAG(f, CF_READ_NULL);

	if (f) {
		printf("EXTRA(0x%08x)", f);
	}
	putchar('\n');
}
Exemple #4
0
void show_strm_flags(unsigned int f)
{
	printf("strm->flags = ");

	if (!f) {
		printf("0\n");
		return;
	}

	SHOW_FLAG(f, SF_SRV_REUSED);
	SHOW_FLAG(f, SF_IGNORE_PRST);

	//printf("%s", f ? "" : " | ");
	switch (f & SF_FINST_MASK) {
	case SF_FINST_R: f &= ~SF_FINST_MASK ; printf("SF_FINST_R%s", f ? " | " : ""); break;
	case SF_FINST_C: f &= ~SF_FINST_MASK ; printf("SF_FINST_C%s", f ? " | " : ""); break;
	case SF_FINST_H: f &= ~SF_FINST_MASK ; printf("SF_FINST_H%s", f ? " | " : ""); break;
	case SF_FINST_D: f &= ~SF_FINST_MASK ; printf("SF_FINST_D%s", f ? " | " : ""); break;
	case SF_FINST_L: f &= ~SF_FINST_MASK ; printf("SF_FINST_L%s", f ? " | " : ""); break;
	case SF_FINST_Q: f &= ~SF_FINST_MASK ; printf("SF_FINST_Q%s", f ? " | " : ""); break;
	case SF_FINST_T: f &= ~SF_FINST_MASK ; printf("SF_FINST_T%s", f ? " | " : ""); break;
	}

	switch (f & SF_ERR_MASK) {
	case SF_ERR_LOCAL:    f &= ~SF_ERR_MASK ; printf("SF_ERR_LOCAL%s",    f ? " | " : ""); break;
	case SF_ERR_CLITO:    f &= ~SF_ERR_MASK ; printf("SF_ERR_CLITO%s",    f ? " | " : ""); break;
	case SF_ERR_CLICL:    f &= ~SF_ERR_MASK ; printf("SF_ERR_CLICL%s",    f ? " | " : ""); break;
	case SF_ERR_SRVTO:    f &= ~SF_ERR_MASK ; printf("SF_ERR_SRVTO%s",    f ? " | " : ""); break;
	case SF_ERR_SRVCL:    f &= ~SF_ERR_MASK ; printf("SF_ERR_SRVCL%s",    f ? " | " : ""); break;
	case SF_ERR_PRXCOND:  f &= ~SF_ERR_MASK ; printf("SF_ERR_PRXCOND%s",  f ? " | " : ""); break;
	case SF_ERR_RESOURCE: f &= ~SF_ERR_MASK ; printf("SF_ERR_RESOURCE%s", f ? " | " : ""); break;
	case SF_ERR_INTERNAL: f &= ~SF_ERR_MASK ; printf("SF_ERR_INTERNAL%s", f ? " | " : ""); break;
	case SF_ERR_DOWN:     f &= ~SF_ERR_MASK ; printf("SF_ERR_DOWN%s",     f ? " | " : ""); break;
	case SF_ERR_KILLED:   f &= ~SF_ERR_MASK ; printf("SF_ERR_KILLED%s",   f ? " | " : ""); break;
	case SF_ERR_UP:       f &= ~SF_ERR_MASK ; printf("SF_ERR_UP%s",       f ? " | " : ""); break;
	case SF_ERR_CHK_PORT: f &= ~SF_ERR_MASK ; printf("SF_ERR_CHK_PORT%s",       f ? " | " : ""); break;
	}

	SHOW_FLAG(f, SF_TUNNEL);
	SHOW_FLAG(f, SF_REDIRECTABLE);
	SHOW_FLAG(f, SF_CONN_TAR);
	SHOW_FLAG(f, SF_REDISP);
	SHOW_FLAG(f, SF_INITIALIZED);
	SHOW_FLAG(f, SF_CURR_SESS);
	SHOW_FLAG(f, SF_MONITOR);
	SHOW_FLAG(f, SF_FORCE_PRST);
	SHOW_FLAG(f, SF_BE_ASSIGNED);
	SHOW_FLAG(f, SF_ADDR_SET);
	SHOW_FLAG(f, SF_ASSIGNED);
	SHOW_FLAG(f, SF_DIRECT);

	if (f) {
		printf("EXTRA(0x%08x)", f);
	}
	putchar('\n');
}
Exemple #5
0
void show_txn_flags(unsigned int f)
{
	printf("txn->flags  = ");

	if (!f) {
		printf("0\n");
		return;
	}

	SHOW_FLAG(f, TX_NOT_FIRST);
	SHOW_FLAG(f, TX_USE_PX_CONN);
	SHOW_FLAG(f, TX_HDR_CONN_KAL);
	SHOW_FLAG(f, TX_HDR_CONN_CLO);
	SHOW_FLAG(f, TX_HDR_CONN_PRS);
	SHOW_FLAG(f, TX_WAIT_NEXT_RQ);
	SHOW_FLAG(f, TX_HDR_CONN_UPG);
	SHOW_FLAG(f, TX_PREFER_LAST);
	SHOW_FLAG(f, TX_CON_KAL_SET);
	SHOW_FLAG(f, TX_CON_CLO_SET);

	//printf("%s", f ? "" : " | ");
	switch (f & TX_CON_WANT_MSK) {
	case TX_CON_WANT_KAL: /*f &= ~TX_CON_WANT_MSK ; printf("TX_CON_WANT_KAL%s", f ? " | " : "");*/ break;
	case TX_CON_WANT_TUN: f &= ~TX_CON_WANT_MSK ; printf("TX_CON_WANT_TUN%s", f ? " | " : ""); break;
	case TX_CON_WANT_SCL: f &= ~TX_CON_WANT_MSK ; printf("TX_CON_WANT_SCL%s", f ? " | " : ""); break;
	case TX_CON_WANT_CLO: f &= ~TX_CON_WANT_MSK ; printf("TX_CON_WANT_CLO%s", f ? " | " : ""); break;
	}

	SHOW_FLAG(f, TX_CACHE_COOK);
	SHOW_FLAG(f, TX_CACHEABLE);
	SHOW_FLAG(f, TX_SCK_PRESENT);

	//printf("%s", f ? "" : " | ");
	switch (f & TX_SCK_MASK) {
	case TX_SCK_NONE:                        f &= ~TX_SCK_MASK ; /*printf("TX_SCK_NONE%s",     f ? " | " : "");*/ break;
	case TX_SCK_FOUND:                       f &= ~TX_SCK_MASK ; printf("TX_SCK_FOUND%s",    f ? " | " : ""); break;
	case TX_SCK_DELETED:                     f &= ~TX_SCK_MASK ; printf("TX_SCK_DELETED%s",  f ? " | " : ""); break;
	case TX_SCK_INSERTED:                    f &= ~TX_SCK_MASK ; printf("TX_SCK_INSERTED%s", f ? " | " : ""); break;
	case TX_SCK_REPLACED:                    f &= ~TX_SCK_MASK ; printf("TX_SCK_REPLACED%s", f ? " | " : ""); break;
	case TX_SCK_UPDATED:                     f &= ~TX_SCK_MASK ; printf("TX_SCK_UPDATED%s",  f ? " | " : ""); break;
	default: printf("TX_SCK_MASK(%02x)", f); f &= ~TX_SCK_MASK ; printf("%s",                f ? " | " : ""); break;
	}

	//printf("%s", f ? "" : " | ");
	switch (f & TX_CK_MASK) {
	case TX_CK_NONE:                        f &= ~TX_CK_MASK ; /*printf("TX_CK_NONE%s",    f ? " | " : "");*/ break;
	case TX_CK_INVALID:                     f &= ~TX_CK_MASK ; printf("TX_CK_INVALID%s", f ? " | " : ""); break;
	case TX_CK_DOWN:                        f &= ~TX_CK_MASK ; printf("TX_CK_DOWN%s",    f ? " | " : ""); break;
	case TX_CK_VALID:                       f &= ~TX_CK_MASK ; printf("TX_CK_VALID%s",   f ? " | " : ""); break;
	case TX_CK_EXPIRED:                     f &= ~TX_CK_MASK ; printf("TX_CK_EXPIRED%s", f ? " | " : ""); break;
	case TX_CK_OLD:                         f &= ~TX_CK_MASK ; printf("TX_CK_OLD%s",     f ? " | " : ""); break;
	case TX_CK_UNUSED:                      f &= ~TX_CK_MASK ; printf("TX_CK_UNUSED%s",  f ? " | " : ""); break;
	default: printf("TX_CK_MASK(%02x)", f); f &= ~TX_CK_MASK ; printf("%s",              f ? " | " : ""); break;
	}

	SHOW_FLAG(f, TX_CLTARPIT);
	SHOW_FLAG(f, TX_SVALLOW);
	SHOW_FLAG(f, TX_SVDENY);
	SHOW_FLAG(f, TX_CLALLOW);
	SHOW_FLAG(f, TX_CLDENY);

	if (f) {
		printf("EXTRA(0x%08x)", f);
	}
	putchar('\n');
}
Exemple #6
0
void show_chn_ana(unsigned int f)
{
	printf("chn->ana    = ");

	if (!f) {
		printf("0\n");
		return;
	}

	SHOW_FLAG(f, AN_REQ_INSPECT_FE);
	SHOW_FLAG(f, AN_REQ_WAIT_HTTP);
	SHOW_FLAG(f, AN_REQ_HTTP_BODY);
	SHOW_FLAG(f, AN_REQ_HTTP_PROCESS_FE);
	SHOW_FLAG(f, AN_REQ_SWITCHING_RULES);
	SHOW_FLAG(f, AN_REQ_INSPECT_BE);
	SHOW_FLAG(f, AN_REQ_HTTP_PROCESS_BE);
	SHOW_FLAG(f, AN_REQ_SRV_RULES);
	SHOW_FLAG(f, AN_REQ_HTTP_INNER);
	SHOW_FLAG(f, AN_REQ_HTTP_TARPIT);
	SHOW_FLAG(f, AN_REQ_STICKING_RULES);
	SHOW_FLAG(f, AN_REQ_PRST_RDP_COOKIE);
	SHOW_FLAG(f, AN_REQ_HTTP_XFER_BODY);
	SHOW_FLAG(f, AN_REQ_ALL);
	SHOW_FLAG(f, AN_RES_INSPECT);
	SHOW_FLAG(f, AN_RES_WAIT_HTTP);
	SHOW_FLAG(f, AN_RES_HTTP_PROCESS_BE);
	SHOW_FLAG(f, AN_RES_HTTP_PROCESS_FE);
	SHOW_FLAG(f, AN_RES_STORE_RULES);
	SHOW_FLAG(f, AN_RES_HTTP_XFER_BODY);

	if (f) {
		printf("EXTRA(0x%08x)", f);
	}
	putchar('\n');
}
Exemple #7
0
void show_si_flags(unsigned int f)
{
	f &= 0xFFFF;

	printf("si->flags   = ");
	if (!f) {
		printf("SI_FL_NONE\n");
		return;
	}

	SHOW_FLAG(f, SI_FL_EXP);
	SHOW_FLAG(f, SI_FL_ERR);
	SHOW_FLAG(f, SI_FL_WAIT_ROOM);
	SHOW_FLAG(f, SI_FL_WAIT_DATA);
	SHOW_FLAG(f, SI_FL_ISBACK);
	SHOW_FLAG(f, SI_FL_DONT_WAKE);
	SHOW_FLAG(f, SI_FL_INDEP_STR);
	SHOW_FLAG(f, SI_FL_NOLINGER);
	SHOW_FLAG(f, SI_FL_NOHALF);
	SHOW_FLAG(f, SI_FL_SRC_ADDR);
	SHOW_FLAG(f, SI_FL_WANT_PUT);
	SHOW_FLAG(f, SI_FL_WANT_GET);

	if (f) {
		printf("EXTRA(0x%04x)", f);
	}
	putchar('\n');
}
Exemple #8
0
void show_si_et(unsigned int f)
{
	printf("si->et      = ");
	if (!f) {
		printf("SI_ET_NONE\n");
		return;
	}

	SHOW_FLAG(f, SI_ET_QUEUE_TO);
	SHOW_FLAG(f, SI_ET_QUEUE_ERR);
	SHOW_FLAG(f, SI_ET_QUEUE_ABRT);
	SHOW_FLAG(f, SI_ET_CONN_TO);
	SHOW_FLAG(f, SI_ET_CONN_ERR);
	SHOW_FLAG(f, SI_ET_CONN_ABRT);
	SHOW_FLAG(f, SI_ET_CONN_RES);
	SHOW_FLAG(f, SI_ET_CONN_OTHER);
	SHOW_FLAG(f, SI_ET_DATA_TO);
	SHOW_FLAG(f, SI_ET_DATA_ERR);
	SHOW_FLAG(f, SI_ET_DATA_ABRT);

	if (f) {
		printf("EXTRA(0x%08x)", f);
	}
	putchar('\n');
}
Exemple #9
0
static void cmd_chaninfo(int idx, char *par)
{
  char *chname = NULL, work[512] = "";
  struct chanset_t *chan = NULL;
  int cnt = 0;

  if (!par[0]) {
    chname = dcc[idx].u.chat->con_chan;
    if (chname[0] == '*') {
      dprintf(idx, "Your console channel is invalid.\n");
      return;
    }
  } else {
    chname = newsplit(&par);
    get_user_flagrec(dcc[idx].user, &user, chname);
    if (!glob_master(user) && !chan_master(user)) {
      dprintf(idx, "You don't have access to %s.\n", chname);
      return;
    }
  }
  if (!strcasecmp(chname, "default"))
    chan = chanset_default;
  else
    chan = findchan_by_dname(chname);
  if (!chan || (chan && privchan(user, chan, PRIV_OP))) {
    dprintf(idx, "No such channel.\n");
    return;
  } else {
    char nick[HANDLEN + 1] = "", date[81] = "";
    int deflag = 0;

    if (chan->added_ts) {
      strftime(date, sizeof date, "%c %Z", gmtime(&(chan->added_ts)));
    } else
      date[0] = 0;
    if (chan->added_by && chan->added_by[0])
      strlcpy(nick, chan->added_by, sizeof(nick));
    else
      nick[0] = 0;
    putlog(LOG_CMDS, "*", "#%s# chaninfo %s", dcc[idx].nick, chname);
    if (nick[0] && date[0])
      dprintf(idx, "Settings for channel %s (Added %s by %s%s%s):\n", chan->dname, date, BOLD(idx), nick, BOLD_END(idx));
    else
      dprintf(idx, "Settings for channel %s:\n", chan->dname);
/* FIXME: SHOW_CHAR() here */
    get_mode_protect(chan, work, sizeof(work));
    dprintf(idx, "Protect modes (chanmode): %s\n", work[0] ? work : "None");
    dprintf(idx, "Groups: %s\n", chan->groups && chan->groups->length() ? static_cast<bd::String>(chan->groups->join(" ")).c_str() : "None");
    dprintf(idx, "FiSH Key: %s\n", chan->fish_key[0] ? chan->fish_key : "not set");
//    dprintf(idx, "Protect topic (topic)   : %s\n", chan->topic[0] ? chan->topic : "");
/* Chanchar template
 *  dprintf(idx, "String temp: %s\n", chan->temp[0] ? chan->temp : "NULL");
 */
    dprintf(idx, "Channel flags:\n");
    work[0] = 0;
    SHOW_FLAG("autoop",		channel_autoop(chan));
    SHOW_FLAG("backup",		channel_backup(chan));
    SHOW_FLAG("bitch",		channel_bitch(chan));
    SHOW_FLAG("botbitch",       channel_botbitch(chan));
    SHOW_FLAG("closed",		channel_closed(chan));
    SHOW_FLAG("cycle",		channel_cycle(chan));
    SHOW_FLAG("enforcebans", 	channel_enforcebans(chan));
    SHOW_FLAG("fastop",		channel_fastop(chan));
    SHOW_FLAG("floodban", channel_floodban(chan));
    SHOW_FLAG("inactive",	channel_inactive(chan));
    SHOW_FLAG("nodesynch",	channel_nodesynch(chan));
    SHOW_FLAG("private",	channel_privchan(chan));
    SHOW_FLAG("protect",	channel_protect(chan));
    SHOW_FLAG("rbl",		channel_rbl(chan));
    if (HAVE_TAKE)
      SHOW_FLAG("take",		channel_take(chan));
    SHOW_FLAG("voice",		channel_voice(chan));
    SHOW_FLAG("voicebitch",		channel_voicebitch(chan));
    SHOW_FLAG("", 0);
    SHOW_FLAG("dynamicbans",	channel_dynamicbans(chan));
    SHOW_FLAG("userbans",	!channel_nouserbans(chan));
    SHOW_FLAG("dynamicexempts",	channel_dynamicexempts(chan));
    SHOW_FLAG("userexempts",	!channel_nouserexempts(chan));
    SHOW_FLAG("dynamicinvites",	channel_dynamicinvites(chan));
    SHOW_FLAG("userinvites",	!channel_nouserinvites(chan));
    SHOW_FLAG("", 0);
    work[0] = 0;

/* Chanflag template
 *  SHOW_FLAG("template", channel_template(chan));
 * also include %ctemp in dprintf.
 */

    work[0] = cnt = 0;
/* Chanint template
 * SHOW_INT("Desc: ", integer, "YES", "NO");
 */
    dprintf(idx, "Channel settings:\n");
    deflag = chan->bad_cookie;
    SHOW_INT("Auto-delay: ", chan->auto_delay, NULL, "None");
    SHOW_INT("Bad-cookie:" , chan->bad_cookie, DEFLAG_STR, "Ignore");
    SHOW_INT("Ban-time: ", chan->ban_time, NULL, "Forever");
    SHOW_INT("Ban-type: ", chan->ban_type, NULL, "3");
    SHOW_INT("Closed-ban: ", chan->closed_ban, NULL, "Don't!");
    SHOW_INT("Closed-invite:", chan->closed_invite, NULL, "Don't!");
    SHOW_INT("Closed-Private:", chan->closed_private, NULL, "Don't!");
    SHOW_INT("Closed-Exempt:", chan->closed_exempt_mode, F_STR(chan->closed_exempt_mode), "None");
    SHOW_INT("Exempt-time: ", chan->exempt_time, NULL, "Forever");
    SHOW_INT("Flood-exempt: ", chan->flood_exempt_mode, F_STR(chan->flood_exempt_mode), "None");
    SHOW_INT("Flood-lock-time: ", chan->flood_lock_time, NULL, "Don't");
    SHOW_INT("Caps-Limit(%): ", chan->capslimit, NULL, "None");
    SHOW_INT("Color-Limit: ", chan->colorlimit, NULL, "None");
    SHOW_INT("Invite-time: ", chan->invite_time, NULL, "Forever");
    SHOW_INT("Knock: ", chan->knock_flags, F_STR(chan->knock_flags), "None");
    SHOW_INT("Limit raise (limit): ", chan->limitraise, NULL, "Disabled");
    deflag = chan->manop;
    SHOW_INT("Manop: ", chan->manop, DEFLAG_STR, "Ignore");
    deflag = chan->mdop;
    SHOW_INT("Mdop: ", chan->mdop, DEFLAG_STR, "Ignore");
    deflag = chan->mop;
    SHOW_INT("Mop: ", chan->mop, DEFLAG_STR, "Ignore");
    deflag = chan->revenge;
    SHOW_INT("Revenge: ", chan->revenge, DEFLAG_STR, "Ignore");
    SHOW_INT("Protect-backup: ", chan->protect_backup, "Do!", "Don't!");
    SHOW_INT("Voice-non-ident: ", chan->voice_non_ident, "Do!", "Don't!");
    SHOW_INT("Voice-moderate:", chan->voice_moderate, "Do!", "Don't!");

    dprintf(idx, "Flood settings:   chan bytes ctcp join kick deop nick mjoin mpub mbytes mctcp\n");
    dprintf(idx, "  number:          %3d  %4d  %3d  %3d  %3d  %3d  %3d   %3d  %3d   %4d   %3d\n",
	    chan->flood_pub_thr, chan->flood_bytes_thr, chan->flood_ctcp_thr,
	    chan->flood_join_thr, chan->flood_kick_thr,
	    chan->flood_deop_thr, chan->flood_nick_thr,
            chan->flood_mjoin_thr, chan->flood_mpub_thr,
            chan->flood_mbytes_thr, chan->flood_mctcp_thr);
    dprintf(idx, "  time  :          %3u  %4u  %3u  %3u  %3u  %3u  %3u   %3u  %3u   %4u  %4u\n",
	    chan->flood_pub_time, chan->flood_bytes_time, chan->flood_ctcp_time,
	    chan->flood_join_time, chan->flood_kick_time,
	    chan->flood_deop_time, chan->flood_nick_time,
            chan->flood_mjoin_time, chan->flood_mpub_time,
            chan->flood_mbytes_time, chan->flood_mctcp_time);
  }
}
Exemple #10
0
void 
fill_window_data()
{
	ASWindowData *wd;
	INT32 encoding;
	char *name, *names[5];
	static char buf[4096], buf2[4096];
	ASRawHints    raw ;
	ASDatabaseRecord db_rec ;

	wd = fetch_window_by_id( MyArgs.src_window );
	LOCAL_DEBUG_OUT( "src_window = %lX, wd = %p", MyArgs.src_window, wd );
	encoding = AS_Text_ASCII ;
	name = get_window_name(wd, ASN_Name, &encoding );
	   
	add_property( "Window name:", name, encoding, True );
	name = get_window_name(wd, ASN_NameMatched, &encoding );
	add_property( "Window name matched:", name, encoding, True );
	name = get_window_name(wd, ASN_IconName, &encoding );
	add_property( "Icon name:", name, encoding, True );		
	name = get_window_name(wd, ASN_ResClass, &encoding );
	add_property( "Resource class:", name, encoding, False );
	name = get_window_name(wd, ASN_ResName, &encoding );
	add_property( "Resource name:", name, encoding, False );

	sprintf( buf, "0x%lX ( %ld )", wd->client, wd->client );
	add_property("Client Window ID:", buf, AS_Text_ASCII, False);
	sprintf( buf, "0x%lX ( %ld )", wd->frame, wd->frame );
	add_property("Frame Window ID:", buf, AS_Text_ASCII, False);
	sprintf( buf, "%ldx%ld%+ld%+ld", wd->frame_rect.width, wd->frame_rect.height, wd->frame_rect.x, wd->frame_rect.y );
	add_property("Frame Geometry:", buf, AS_Text_ASCII, False);

#define SHOW_FLAG(flags,flg)   \
	do{ if( get_flags( flags, AS_##flg)){ if( buf[0] != '\0' ) strcat( buf, ", "); strcat( buf, #flg );}}while(0)
#define SHOW_WM_FLAG(flags,flg)   \
	do{ if( get_flags( flags, flg)){ if( buf[0] != '\0' ) strcat( buf, ", "); strcat( buf, #flg );}}while(0)
#define SHOW_MWM_FLAG(flags,type,flg)   \
	do{ if( get_flags( flags, MWM_##type##_##flg)){ if( buf[0] != '\0' ) strcat( buf, ", "); strcat( buf, #flg );}}while(0)
#define SHOW_EXTWM_FLAG(flags,type,flg)   \
	do{ if( get_flags( flags, EXTWM_##type##flg)){ if( buf[0] != '\0' ) strcat( buf, ", "); strcat( buf, #flg );}}while(0)
#define SHOW_GNOME_FLAG(flags,type,flg)   \
	do{ if( get_flags( flags, WIN_##type##_##flg)){ if( buf[0] != '\0' ) strcat( buf, ", "); strcat( buf, #flg );}}while(0)

	buf[0] = '\0' ;
	if( (wd->state_flags & (AS_MaximizedX|AS_MaximizedY)) == (AS_MaximizedX|AS_MaximizedY) )
	{
		strcpy( buf, "Maximized"); 
	}else
	{
		SHOW_FLAG(wd->state_flags,MaximizedX);
		SHOW_FLAG(wd->state_flags,MaximizedY);    
	}
	SHOW_FLAG(wd->state_flags,Iconic);
	SHOW_FLAG(wd->state_flags,Fullscreen);    
	SHOW_FLAG(wd->state_flags,Sticky);    
	SHOW_FLAG(wd->state_flags,Shaded);        
	SHOW_FLAG(wd->state_flags,Withdrawn);
	SHOW_FLAG(wd->state_flags,Dead);     
	SHOW_FLAG(wd->state_flags,Mapped);
	SHOW_FLAG(wd->state_flags,IconMapped);
	SHOW_FLAG(wd->state_flags,Hidden);
	SHOW_FLAG(wd->state_flags,Shaped);
	SHOW_FLAG(wd->state_flags,ShapedDecor);
	SHOW_FLAG(wd->state_flags,ShapedIcon);
	SHOW_FLAG(wd->state_flags,Urgent);
		   
	add_property("Current state flags:", buf, AS_Text_ASCII, True);
	
	buf[0] = '\0' ;
	SHOW_FLAG(wd->flags,Iconic);
	SHOW_FLAG(wd->flags,Transient);
	SHOW_FLAG(wd->flags,AcceptsFocus);
	SHOW_FLAG(wd->flags,ClickToFocus);
	SHOW_FLAG(wd->flags,Titlebar);
	SHOW_FLAG(wd->flags,VerticalTitle);
	SHOW_FLAG(wd->flags,Border);
	SHOW_FLAG(wd->flags,Handles);
	SHOW_FLAG(wd->flags,Frame);		
	SHOW_FLAG(wd->flags,SkipWinList); 
	SHOW_FLAG(wd->flags,DontCirculate); 
	SHOW_FLAG(wd->flags,AvoidCover);          
	SHOW_FLAG(wd->flags,IconTitle);
	SHOW_FLAG(wd->flags,Icon);          
	SHOW_FLAG(wd->client_icon_flags,ClientIcon);
	SHOW_FLAG(wd->client_icon_flags,ClientIconPixmap);    
	SHOW_FLAG(wd->client_icon_flags,ClientIconPosition);
	SHOW_FLAG(wd->flags,FocusOnMap);          
	SHOW_FLAG(wd->flags,ShortLived);
	SHOW_FLAG(wd->flags,Module);
	SHOW_FLAG(wd->flags,IgnoreConfigRequest);
	SHOW_FLAG(wd->flags,IgnoreRestackRequest);
	SHOW_FLAG(wd->flags,WMDockApp);
	
	add_property("Current hints flags:", buf, AS_Text_ASCII, True);
	
	buf[0] = '\0' ;
	SHOW_FLAG(wd->flags,Windowbox);           
	SHOW_FLAG(wd->flags,Aspect);
	SHOW_FLAG(wd->flags,PID);
	SHOW_FLAG(wd->flags,MinSize);
	SHOW_FLAG(wd->flags,MaxSize);
	SHOW_FLAG(wd->flags,SizeInc);
	SHOW_FLAG(wd->flags,BaseSize);
	SHOW_FLAG(wd->flags,Gravity);
	
	add_property("Specified hint values:", buf, AS_Text_ASCII, True);

    if( collect_hints( ASDefaultScr, wd->client, HINT_ANY, &raw ) )
	{
		ExtendedWMHints *eh = &(raw.extwm_hints);
		GnomeHints *gh = &(raw.gnome_hints);
		
		if (raw.wm_hints)
		{
			if( raw.wm_hints->flags != 0 ) 
			{
				buf[0] = '\0' ;
				SHOW_WM_FLAG(raw.wm_hints->flags,UrgencyHint );
				SHOW_WM_FLAG(raw.wm_hints->flags,InputHint);
				SHOW_WM_FLAG(raw.wm_hints->flags,StateHint);
				SHOW_WM_FLAG(raw.wm_hints->flags,IconPixmapHint);
				SHOW_WM_FLAG(raw.wm_hints->flags,IconWindowHint);
				SHOW_WM_FLAG(raw.wm_hints->flags,IconPositionHint);
				SHOW_WM_FLAG(raw.wm_hints->flags,IconMaskHint);
				SHOW_WM_FLAG(raw.wm_hints->flags,WindowGroupHint);
				add_property("WM Hints flags:", buf, AS_Text_ASCII, True);
				if( get_flags (raw.wm_hints->flags, WindowGroupHint) )
				{
					sprintf( buf, "0x%lX ( %ld )", raw.wm_hints->window_group, raw.wm_hints->window_group );
					add_property("WM Group leader:", buf, AS_Text_ASCII, True);
				}
			}
		}
		if (raw.wm_normal_hints)
		{
			if( raw.wm_normal_hints->flags != 0 ) 
			{
				buf[0] = '\0' ;
				SHOW_WM_FLAG(raw.wm_normal_hints->flags,USPosition );
				SHOW_WM_FLAG(raw.wm_normal_hints->flags,USSize );
				SHOW_WM_FLAG(raw.wm_normal_hints->flags,PPosition );
				SHOW_WM_FLAG(raw.wm_normal_hints->flags,PSize );
				SHOW_WM_FLAG(raw.wm_normal_hints->flags,PMinSize );
				SHOW_WM_FLAG(raw.wm_normal_hints->flags,PMaxSize );
				SHOW_WM_FLAG(raw.wm_normal_hints->flags,PResizeInc );
				SHOW_WM_FLAG(raw.wm_normal_hints->flags,PAspect );
				SHOW_WM_FLAG(raw.wm_normal_hints->flags,PBaseSize );
				SHOW_WM_FLAG(raw.wm_normal_hints->flags,PWinGravity );
				add_property("WM Size Hints flags:", buf, AS_Text_ASCII, True);
			}
			if( get_flags(raw.wm_normal_hints->flags, PWinGravity ) && 
				raw.wm_normal_hints->win_gravity >= 0 && raw.wm_normal_hints->win_gravity <= StaticGravity ) 
			{
				static char *gravity_types[] = 
					{"Forget","NorthWest","North","NorthEast","West",
					 "Center","East","SouthWest","South","SouthEast",
					 "Static" };

					add_property("Gravity:", gravity_types[raw.wm_normal_hints->win_gravity], AS_Text_ASCII, True);
			}
		}
		if( raw.transient_for)
		{
			sprintf( buf, "0x%lX", raw.transient_for->flags );
			add_property("flags:", buf, AS_Text_ASCII, False);
			sprintf( buf, "0x%lX ( %ld )", raw.transient_for->parent, raw.transient_for->parent );
			add_property("Transient For:", buf, AS_Text_ASCII, False);
			sprintf( buf, "%+d%+d", raw.transient_for->viewport_x, raw.transient_for->viewport_y);
			add_property("Transient viewport:", buf, AS_Text_ASCII, False);
			sprintf( buf, "%d", raw.transient_for->desktop );
			add_property("Transient desktop:", buf, AS_Text_ASCII, False);
		}
		if (raw.motif_hints)
		{
			buf[0] = '\0' ;
			if (get_flags (raw.motif_hints->flags, MWM_HINTS_INPUT_MODE))
			{
				INT32 input_mode = raw.motif_hints->inputMode;
					  
				if (input_mode == MWM_INPUT_SYSTEM_MODAL)
					add_property("Motif Input mode:", "System modal", AS_Text_ASCII, False);
				else if (input_mode == MWM_INPUT_FULL_APPLICATION_MODAL)
					add_property("Motif Input mode:", "Full application modal", AS_Text_ASCII, False);
			}

 			check_motif_hints_sanity( raw.motif_hints );

			if (get_flags (raw.motif_hints->flags, MWM_HINTS_FUNCTIONS))
			{	
				ASFlagType funcs = raw.motif_hints->functions;
				buf[0] = '\0' ;
				SHOW_MWM_FLAG(funcs,FUNC,RESIZE);
				SHOW_MWM_FLAG(funcs,FUNC,MOVE);
				SHOW_MWM_FLAG(funcs,FUNC,MINIMIZE);
				SHOW_MWM_FLAG(funcs,FUNC,MAXIMIZE);
				SHOW_MWM_FLAG(funcs,FUNC,CLOSE);
				add_property("Motif Functionality hints:", buf, AS_Text_ASCII, False);
			}
			if (get_flags (raw.motif_hints->flags, MWM_HINTS_DECORATIONS))
			{	
				ASFlagType decor = raw.motif_hints->decorations;
				buf[0] = '\0' ;
				SHOW_MWM_FLAG(decor,DECOR,BORDER);
				SHOW_MWM_FLAG(decor,DECOR,RESIZEH);
				SHOW_MWM_FLAG(decor,DECOR,TITLE);
				SHOW_MWM_FLAG(decor,DECOR,MENU);
				SHOW_MWM_FLAG(decor,DECOR,MINIMIZE);
				SHOW_MWM_FLAG(decor,DECOR,MAXIMIZE);
				add_property("Motif decor hints:", buf, AS_Text_ASCII, False);
			}
		}	 
		/* window state hints : */
		if (get_flags (eh->state_flags, EXTWM_StateEverything))
		{
			buf[0] = '\0' ;
			SHOW_EXTWM_FLAG(eh->state_flags,State,Modal );
			SHOW_EXTWM_FLAG(eh->state_flags,State,Sticky );
			SHOW_EXTWM_FLAG(eh->state_flags,State,MaximizedV );
			SHOW_EXTWM_FLAG(eh->state_flags,State,MaximizedH );
			SHOW_EXTWM_FLAG(eh->state_flags,State,Shaded );
			SHOW_EXTWM_FLAG(eh->state_flags,State,SkipTaskbar );
			SHOW_EXTWM_FLAG(eh->state_flags,State,SkipPager );
			SHOW_EXTWM_FLAG(eh->state_flags,State,Fullscreen );
			SHOW_EXTWM_FLAG(eh->state_flags,State,Above );
			SHOW_EXTWM_FLAG(eh->state_flags,State,Below );
			SHOW_EXTWM_FLAG(eh->state_flags,State,Hidden );
			SHOW_EXTWM_FLAG(eh->state_flags,State,DemandsAttention );
			
			add_property("Extended WM status flags:", buf, AS_Text_ASCII, True);
		}
		/* window type hints : */
		if (get_flags (eh->type_flags, EXTWM_TypeEverything))
		{
			buf[0] = '\0' ;
			SHOW_EXTWM_FLAG(eh->type_flags,Type,Desktop);
			SHOW_EXTWM_FLAG(eh->type_flags,Type,Dock);
			SHOW_EXTWM_FLAG(eh->type_flags,Type,Toolbar);
			SHOW_EXTWM_FLAG(eh->type_flags,Type,Menu);
			SHOW_EXTWM_FLAG(eh->type_flags,Type,Dialog);
			SHOW_EXTWM_FLAG(eh->type_flags,Type,Normal);
			SHOW_EXTWM_FLAG(eh->type_flags,Type,Utility);
			SHOW_EXTWM_FLAG(eh->type_flags,Type,Splash);
			add_property("Extended WM type flags:", buf, AS_Text_ASCII, True);
		}
		
		if (get_flags (eh->flags, EXTWM_PID))
		{
			sprintf( buf, "%d", (int)eh->pid );
			add_property("Extended WM PID:", buf, AS_Text_ASCII, False);
		}

		if (get_flags (eh->flags, EXTWM_DoesWMPing))
			add_property("Extended WM protocols:", "DoesWMPing", AS_Text_ASCII, False);
		
		if (get_flags (eh->flags, EXTWM_WINDOW_OPACITY))
		{
			sprintf( buf, "%d", (int)eh->window_opacity );
			add_property("ExtWM Window Opacity :",  buf, AS_Text_ASCII, False);
		}
		
		if (get_flags (eh->flags, EXTWM_DESKTOP))
		{
			if (eh->desktop == 0xFFFFFFFF)
				strcpy(buf, "sticky");
			else
				sprintf( buf, "%d", (int)eh->desktop );
			add_property("Extended WM desktop:", buf, AS_Text_ASCII, False);
		}

		if (get_flags (gh->flags, GNOME_LAYER))
		{
			sprintf( buf, "%d", (int)gh->layer );
			add_property("Gnome hints layer:", buf, AS_Text_ASCII, False);
		}
		if (get_flags (gh->flags, GNOME_WORKSPACE))
		{
			sprintf( buf, "%d", (int)gh->workspace );
			add_property("Gnome hints desktop:", buf, AS_Text_ASCII, False);
		}
		if (get_flags (gh->flags, GNOME_STATE) && gh->state != 0)
		{
			buf[0] = '\0' ;
			SHOW_GNOME_FLAG(gh->state,STATE,STICKY);
			SHOW_GNOME_FLAG(gh->state,STATE,MINIMIZED);
			SHOW_GNOME_FLAG(gh->state,STATE,MAXIMIZED_VERT);
			SHOW_GNOME_FLAG(gh->state,STATE,MAXIMIZED_HORIZ);
			SHOW_GNOME_FLAG(gh->state,STATE,SHADED);
			add_property("Gnome state flags:", buf, AS_Text_ASCII, False);
		}

		if (get_flags (gh->flags, GNOME_HINTS) && gh->hints != 0)
		{	
			buf[0] = '\0' ;
			SHOW_GNOME_FLAG(gh->state,HINTS,SKIP_FOCUS);
			SHOW_GNOME_FLAG(gh->state,HINTS,SKIP_WINLIST);
			SHOW_GNOME_FLAG(gh->state,HINTS,SKIP_TASKBAR);
			SHOW_GNOME_FLAG(gh->state,HINTS,FOCUS_ON_CLICK);
			add_property("Gnome hints flags:", buf, AS_Text_ASCII, False);
		}
	}

	names[0] = get_window_name(wd, ASN_NameMatched, &encoding );
	names[1] = get_window_name(wd, ASN_IconName, &encoding );
	names[2] = get_window_name(wd, ASN_ResClass, &encoding );
	names[3] = get_window_name(wd, ASN_ResName, &encoding );
	names[4] = NULL ;

#define APPEND_DBSTYLE_TEXT(text) 	\
			do { if( !first ) strcat( buf, ", "); else first = False ; strcat( buf, text); } while(0)

	if ( fill_asdb_record (Database, names, &db_rec, False) != NULL )
	{
		int i ;
		add_property("Matched Styles:", "", AS_Text_ASCII, True);
		for( i = 0 ; Database->match_list[i] >= 0 ; ++i )
		{
			ASDatabaseRecord *dr = 	get_asdb_record (Database, Database->match_list[i]);
			int f ;
			Bool first = True ;
			if( is_default_asdb_record(Database, dr) ) 
				sprintf(buf, "\"*\" \t");
			else if( dr->regexp ) 
				sprintf( buf, "\"%s\" \t", dr->regexp->raw );
			else
				sprintf( buf, "\"(none)\" \t" );

			for( f = 0 ; DatabaseFlagsList[f].name_set != NULL ; ++f ) 
			{	
				if( get_flags( dr->set_flags, DatabaseFlagsList[f].flag ) ) 
				{	
					name = get_flags( dr->flags, DatabaseFlagsList[f].flag )?
									DatabaseFlagsList[f].name_set : DatabaseFlagsList[f].name_unset ;
					APPEND_DBSTYLE_TEXT(name);
				}
			}	

			if( get_flags( dr->set_data_flags, STYLE_ICON ) )
			{	
				sprintf( buf2, "Icon \"%s\"", dr->icon_file );
				APPEND_DBSTYLE_TEXT(buf2);
			}
#if 1			
			if( get_flags( dr->set_data_flags, STYLE_STARTUP_DESK ) )
			{	
				sprintf( buf2, "StartsOnDesk %d", dr->desk );
				APPEND_DBSTYLE_TEXT(buf2);
			}
			if( get_flags( dr->set_data_flags, STYLE_BORDER_WIDTH ) )
			{	
				sprintf( buf2, "BorderWidth %d", dr->border_width );
				APPEND_DBSTYLE_TEXT(buf2);
			}
			if( get_flags( dr->set_data_flags, STYLE_HANDLE_WIDTH ) )
			{	
				sprintf( buf2, "HandleWidth %d", dr->resize_width );
				APPEND_DBSTYLE_TEXT(buf2);
			}
			if( get_flags( dr->set_data_flags, STYLE_DEFAULT_GEOMETRY ) )
			{	
				sprintf( buf2, "DefaultGeometry %dx%d%+d%+d", dr->default_geometry.width, dr->default_geometry.height, dr->default_geometry.x, dr->default_geometry.y );
				APPEND_DBSTYLE_TEXT(buf2);
			}
			if( get_flags( dr->set_data_flags, STYLE_VIEWPORTX ) )
			{	
				sprintf( buf2, "ViewportX %d", dr->viewport_x );
				APPEND_DBSTYLE_TEXT(buf2);
			}
			if( get_flags( dr->set_data_flags, STYLE_VIEWPORTY ) )
			{	
				sprintf( buf2, "ViewportY %d", dr->viewport_y );
				APPEND_DBSTYLE_TEXT(buf2);
			}
			if( get_flags( dr->set_data_flags, STYLE_GRAVITY ) )
			{	
				sprintf( buf2, "OverrideGravity %s", Gravity2text[dr->gravity] );
				APPEND_DBSTYLE_TEXT(buf2);
			}
			if( get_flags( dr->set_data_flags, STYLE_LAYER ) )
			{	
				sprintf( buf2, "Layer %d", dr->layer );
				APPEND_DBSTYLE_TEXT(buf2);
			}
			if( get_flags( dr->set_data_flags, STYLE_FRAME ) )
			{	
				sprintf( buf2, "Frame \"%s\"", dr->frame_name );
				APPEND_DBSTYLE_TEXT(buf2);
			}
			if( get_flags( dr->set_data_flags, STYLE_WINDOWBOX ) )
			{	
				sprintf( buf2, "WindowBox \"%s\"", dr->windowbox_name );
				APPEND_DBSTYLE_TEXT(buf2);
			}
#endif		
			add_property("Style:", buf, AS_Text_ASCII, True);
		}	 
	}	 
	{
		ASDesktopEntry *de = fetch_desktop_entry( CombinedCategories, names[2]);
		if( de == NULL ) 
			de = fetch_desktop_entry( CombinedCategories, names[3]);				  
		if( de ) 
		{	
			char *categories = make_desktop_entry_categories( de );
			add_property("Categories:", categories?categories:"<none>", AS_Text_ASCII, False);
			destroy_string( &categories ) ;
			add_property(".desktop Entry Name:", de->Name, AS_Text_ASCII, False);
			add_property(".desktop Entry Comment:", de->Comment, AS_Text_ASCII, True);
			add_property(".desktop Entry Icon:", de->Icon, AS_Text_ASCII, True);
		}
	}
}