void PHPEntityVariable::Store(wxSQLite3Database& db)
{
    // we keep only the function arguments in the databse and globals
    if(IsFunctionArg() || IsMember()) {
        try {
            wxSQLite3Statement statement =
                db.PrepareStatement("INSERT OR REPLACE INTO VARIABLES_TABLE VALUES (NULL, "
                                    ":SCOPE_ID, :FUNCTION_ID, :NAME, :FULLNAME, :SCOPE, :TYPEHINT, "
                                    ":FLAGS, :DOC_COMMENT, :LINE_NUMBER, :FILE_NAME)");
            statement.Bind(statement.GetParamIndex(":SCOPE_ID"), IsMember() ? Parent()->GetDbId() : wxLongLong(-1));
            statement.Bind(statement.GetParamIndex(":FUNCTION_ID"),
                           IsFunctionArg() ? Parent()->GetDbId() : wxLongLong(-1));
            statement.Bind(statement.GetParamIndex(":NAME"), GetShortName());
            statement.Bind(statement.GetParamIndex(":FULLNAME"), GetFullName());
            statement.Bind(statement.GetParamIndex(":SCOPE"), GetScope());
            statement.Bind(statement.GetParamIndex(":TYPEHINT"), GetTypeHint());
            statement.Bind(statement.GetParamIndex(":FLAGS"), (int)GetFlags());
            statement.Bind(statement.GetParamIndex(":DOC_COMMENT"), GetDocComment());
            statement.Bind(statement.GetParamIndex(":LINE_NUMBER"), GetLine());
            statement.Bind(statement.GetParamIndex(":FILE_NAME"), GetFilename().GetFullPath());
            statement.ExecuteUpdate();
            SetDbId(db.GetLastRowId());

        } catch(wxSQLite3Exception& exc) {
            wxUnusedVar(exc);
        }
    }
}
Exemple #2
0
//
//   This file contains the C++ code from Program 12.20 of
//   "Data Structures and Algorithms
//    with Object-Oriented Design Patterns in C++"
//   by Bruno R. Preiss.
//
//   Copyright (c) 1998 by Bruno R. Preiss, P.Eng.  All rights reserved.
//
//   http://www.pads.uwaterloo.ca/Bruno.Preiss/books/opus4/programs/pgm12_20.cpp
//
void PartitionAsForest::CheckArguments (
    PartitionTree const& s, PartitionTree const& t)
{
    if (!IsMember (s) || s.parent != 0 ||
	!IsMember (t) || t.parent != 0 || s == t)
	throw invalid_argument ("incompatible sets");
}
Exemple #3
0
BOOL CParty::NewMember( u_long uPlayerId, LONG nLevel, LONG nJob, BYTE nSex, LPSTR szName )
#endif	// __SYS_PLAYER_DATA
{
#if __VER < 11 // __SYS_PLAYER_DATA
	if( szName == NULL )
		return FALSE;
#endif	// __SYS_PLAYER_DATA
	
	if( IsMember( uPlayerId ) == FALSE && m_nSizeofMember < MAX_PTMEMBER_SIZE )
	{
		m_aMember[m_nSizeofMember].m_uPlayerId = uPlayerId;
#if __VER < 11 // __SYS_PLAYER_DATA
		m_aMember[m_nSizeofMember].m_nLevel = nLevel;
		m_aMember[m_nSizeofMember].m_nJob = nJob;
		m_aMember[m_nSizeofMember].m_nSex = nSex;
#endif	// __SYS_PLAYER_DATA
		m_aMember[m_nSizeofMember].m_bRemove	= FALSE;
#if __VER < 11 // __SYS_PLAYER_DATA
		strcpy( m_aMember[m_nSizeofMember].m_szName, szName );
#endif	// __SYS_PLAYER_DATA
		m_nSizeofMember++;
		return TRUE;
	}
	return FALSE;
}
Exemple #4
0
BOOL CNBLogicalDevice::UnitDeviceAdd(CNBUnitDevice *pUnitDevice)
{
	UINT32 iSequence;

	if(pUnitDevice->IsGroup())
	{
		if(m_mapUnitDevices.size() && !IsMember(pUnitDevice))
		{
			ATLASSERT(FALSE);
			return FALSE;
		}

		iSequence = pUnitDevice->m_DIB.iSequence;

	}
	else
	{
		iSequence = 0;
	}

	m_mapUnitDevices[iSequence] = pUnitDevice;
	ATLTRACE(_T("CNBLogicalDevice(%p).m_mapUnitDevices[%d] = (%p) : %s\n"),
		this, iSequence, pUnitDevice, pUnitDevice->GetName());

	pUnitDevice->m_pLogicalDevice = this;

	return TRUE;
}
void PHPEntityVariable::PrintStdout(int indent) const
{
    wxString indentString(' ', indent);
    wxPrintf("%s%s: %s", indentString, IsMember() ? "Member" : "Variable", GetShortName());
    if(!GetTypeHint().IsEmpty()) {
        wxPrintf(", TypeHint: %s", GetTypeHint());
    }
    if(!GetExpressionHint().IsEmpty()) {
        wxPrintf(", ExpressionHint: %s", GetExpressionHint());
    }
    if(IsReference()) {
        wxPrintf(", Reference");
    }
    if(!GetDefaultValue().IsEmpty()) {
        wxPrintf(", Default: %s", GetDefaultValue());
    }

    wxPrintf(", Ln. %d", GetLine());
    wxPrintf("\n");

    PHPEntityBase::List_t::const_iterator iter = m_children.begin();
    for(; iter != m_children.end(); ++iter) {
        (*iter)->PrintStdout(indent + 4);
    }
}
Exemple #6
0
/*
 * safelist_one_channel()
 *
 * inputs       - client pointer and channel pointer
 * outputs      - none
 * side effects - a channel is listed if it meets the
 *                requirements
 */
static void safelist_one_channel(struct Client *source_p, struct Channel *chptr)
{
	struct ListClient *safelist_data = source_p->localClient->safelist_data;
	int visible;

	visible = !SecretChannel(chptr) || IsMember(source_p, chptr);
	if (!visible && !safelist_data->operspy)
		return;

	if ((unsigned int)chptr->members.length < safelist_data->users_min
	    || (unsigned int)chptr->members.length > safelist_data->users_max)
		return;

	if (safelist_data->topic_min && chptr->topic_time < safelist_data->topic_min)
		return;

	/* If a topic TS is provided, don't show channels without a topic set. */
	if (safelist_data->topic_max && (chptr->topic_time > safelist_data->topic_max
		|| chptr->topic_time == 0))
		return;

	if (safelist_data->created_min && chptr->channelts < safelist_data->created_min)
		return;

	if (safelist_data->created_max && chptr->channelts > safelist_data->created_max)
		return;

	list_one_channel(source_p, chptr, visible);
}
Exemple #7
0
/*
 * safelist_channel_named()
 *
 * inputs       - client pointer, channel name, operspy
 * outputs      - none
 * side effects - a named channel is listed
 */
static void safelist_channel_named(struct Client *source_p, const char *name, int operspy)
{
	struct Channel *chptr;
	char *p;
	int visible;

	sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name);

	if ((p = strchr(name, ',')))
		*p = '\0';

	if (*name == '\0')
	{
		sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), name);
		sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);
		return;
	}

	chptr = find_channel(name);

	if (chptr == NULL)
	{
		sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), name);
		sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);
		return;
	}

	visible = !SecretChannel(chptr) || IsMember(source_p, chptr);
	if (visible || operspy)
		list_one_channel(source_p, chptr, visible);

	sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);
	return;
}
Exemple #8
0
/* PState: parse state and add all matches in models to ilist */
static void PState(ILink models, ILink *ilist, char *type, HMMSet *hset)
{
   IntSet states;
   int j;
   HMMDef *hmm;
   ILink h;

   states = CreateSet(maxStates);
   PIndex(states);
   SkipSpaces();
   if (ch == '.') {
      ReadCh();
      PStatecomp(models,ilist,type,states,hset);
   } else {
      ChkType('s',type);
      for (h=models; h!=NULL; h=h->next) {
         hmm = h->owner;
         for (j=2; j<hmm->numStates; j++)
            if (IsMember(states,j)) {  /* tie ->info */
               if (trace & T_ITM)
                  printf(" %12s.state[%d]\n",
                         HMMPhysName(hset,hmm),j);
               AddItem(hmm,hmm->svec+j,ilist);
            }
      }
   }
   FreeSet(states);
}
Exemple #9
0
static char *first_visible_channel(aClient *sptr, aClient *acptr, int *flg)
{
	Membership *lp;

	*flg = 0;

	for (lp = acptr->user->channel; lp; lp = lp->next)
	{
	aChannel *chptr = lp->chptr;
	int cansee = ShowChannel(sptr, chptr);

		if (cansee && (acptr->umodes & UMODE_HIDEWHOIS) && !IsMember(sptr, chptr))
			cansee = 0;
		if (!cansee)
		{
			if (OPCanSeeSecret(sptr))
				*flg |= FVC_HIDDEN;
			else
				continue;
		}
		return chptr->chname;
	}

	/* no channels that they can see */
	return "*";
}
void SimulationOutput::DoRecord(const ComponentFrame* frame, const Bunch* bunch)
{
	if(frame->IsComponent())
	{
		string id = (*frame).GetComponent().GetQualifiedName();

		if(output_all || IsMember(id))
		{
			Record(frame,bunch);
		}
	}
}
wxString PHPEntityVariable::GetScope() const
{
    PHPEntityBase* parent = Parent();
    if(parent && parent->Is(kEntityTypeFunction) && IsFunctionArg()) {
        return parent->Cast<PHPEntityFunction>()->GetScope();

    } else if(parent && parent->Is(kEntityTypeClass) && IsMember()) {
        return parent->GetFullName();

    } else {
        return "";
    }
}
Exemple #12
0
int WordSet::operator==(const WordSet &rhs) const
{
  //-----------------------------------------
  // false if sets have different cardinality
  //-----------------------------------------
  if (rhs.NumberOfEntries() != NumberOfEntries()) return 0;

  //-----------------------------------------
  // false if some word in rhs is not in lhs
  //-----------------------------------------
  WordSetIterator words(&rhs);
  unsigned long *word;
  for (; (word = words.Current()); words++) if (IsMember(*word) == 0) return 0;

  return 1; // equal otherwise
}
static int eb_channel(const char *data, struct Client *client_p,
		struct Channel *chptr, long mode_type)
{
	struct Channel *chptr2;

	(void)chptr;
	(void)mode_type;
	if (data == NULL)
		return EXTBAN_INVALID;
	chptr2 = find_channel(data);
	if (chptr2 == NULL)
		return EXTBAN_INVALID;
	/* privacy! don't allow +s/+p channels to influence another channel */
	if (!PubChannel(chptr2))
		return EXTBAN_INVALID;
	return IsMember(client_p, chptr2) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}
Exemple #14
0
static int eb_channel(const char *data, struct Client *client_p,
		struct Channel *chptr, long mode_type)
{
	struct Channel *chptr2;

	(void)chptr;
	(void)mode_type;
	if (data == NULL)
		return EXTBAN_INVALID;
	chptr2 = find_channel(data);
	if (chptr2 == NULL)
		return EXTBAN_INVALID;
	/* require consistent target */
	if (chptr->chname[0] == '#' && data[0] == '&')
		return EXTBAN_INVALID;
	return IsMember(client_p, chptr2) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}
Exemple #15
0
/*
 * list_all_channels
 * inputs	- pointer to client requesting list
 * output	- 0/1
 * side effects	- list all channels to source_p
 */
static int list_all_channels(struct Client *source_p)
{
  struct Channel *chptr;

  sendto_one(source_p, form_str(source_p,RPL_LISTSTART), me.name, source_p->name);

  for ( chptr = GlobalChannelList; chptr; chptr = chptr->nextch )
    {
      if ( !source_p->user ||
	   (SecretChannel(chptr) && !IsMember(source_p, chptr)))
	continue;
      list_one_channel(source_p,chptr);
    }

  sendto_one(source_p, form_str(source_p,RPL_LISTEND), me.name, source_p->name);
  return 0;
}   
Exemple #16
0
void Group::UpdatePlayerOnlineStatus(Player* player, bool online /*= true*/)
{
    if (!player)
        return;
    const ObjectGuid guid = player->GetObjectGuid();
    if (!IsMember(guid))
        return;

    SendUpdate();
    if (online)
    {
        player->SetGroupUpdateFlag(GROUP_UPDATE_FULL);
        UpdatePlayerOutOfRange(player);
    }
    else if (IsLeader(guid))
        m_leaderLastOnline = time(nullptr);
}
Exemple #17
0
void CBotSquad::AddMember ( edict_t *pEdict )
{
	if ( !IsMember(pEdict) )
	{
		MyEHandle newh;
		//CBot *pBot;

		newh = pEdict;

		m_theSquad.Push(newh);

		/*if ( (pBot=CBots::getBotPointer(pEdict))!=NULL )
		{
			pBot->clearSquad();
			pBot->setSquad(this);
		}*/
	}
}
Exemple #18
0
static void do_channel_who(aClient *sptr, aChannel *channel, char *mask)
{
	Member *cm = channel->members;
	if (IsMember(sptr, channel) || IsNetAdmin(sptr))
		who_flags |= WF_ONCHANNEL;

	for (cm = channel->members; cm; cm = cm->next)
	{
		aClient *acptr = cm->cptr;
		char status[20];
		int cansee;
		if ((cansee = can_see(sptr, acptr, channel)) & WHO_CANTSEE)
			continue;

		make_who_status(sptr, acptr, channel, cm, status, cansee);
		send_who_reply(sptr, acptr, channel->chname, status, "");
    }
}
Exemple #19
0
ResultType WinGroup::CloseAndGoToNext(bool aStartWithMostRecent)
// If the foreground window is a member of this group, close it and activate
// the next member.
{
	if (IsEmpty())
		return OK;  // OK since this is the expected behavior in this case.
	// Otherwise:
	// Don't call Update(), let (De)Activate() do that.

	HWND fore_win = GetForegroundWindow();
	// Even if it's NULL, don't return since the legacy behavior is to continue on to the final part below.

	WindowSpec *win_spec = IsMember(fore_win, *g);
	if (   (mIsModeActivate && win_spec) || (!mIsModeActivate && !win_spec)   )
	{
		// If the user is using a GroupActivate hotkey, we don't want to close
		// the foreground window if it's not a member of the group.  Conversely,
		// if the user is using GroupDeactivate, we don't want to close a
		// member of the group.  This precaution helps prevent accidental closing
		// of windows that suddenly pop up to the foreground just as you've
		// realized (too late) that you pressed the "close" hotkey.
		// MS Visual Studio/C++ gets messed up when it is directly sent a WM_CLOSE,
		// probably because the wrong window (it has two mains) is being sent the close.
		// But since that's the only app I've ever found that doesn't work right,
		// it seems best not to change our close method just for it because sending
		// keys is a fairly high overhead operation, and not without some risk due to
		// not knowing exactly what keys the user may have physically held down.
		// Also, we'd have to make this module dependent on the keyboard module,
		// which would be another drawback.
		// Try to wait for it to close, otherwise the same window may be activated
		// again before it has been destroyed, defeating the purpose of the
		// "ActivateNext" part of this function's job:
		// SendKeys("!{F4}");
		if (fore_win)
		{
			WinClose(fore_win, 500);
			DoWinDelay;
		}
	}
	//else do the activation below anyway, even though no close was done.
	return mIsModeActivate ? Activate(aStartWithMostRecent, win_spec) : Deactivate(aStartWithMostRecent);
}
Exemple #20
0
static int eb_channel(const char *data, struct Client *client_p,
		struct Channel *chptr, long mode_type)
{
	struct Channel *chptr2;

	(void)chptr;
	(void)mode_type;
	if (data == NULL)
		return EXTBAN_INVALID;
	chptr2 = find_channel(data);
	if (chptr2 == NULL)
		return EXTBAN_INVALID;
	/* require consistent target */
	if (chptr->chname[0] == '#' && data[0] == '&')
		return EXTBAN_INVALID;
	/* privacy! don't allow +s/+p channels to influence another channel */
	if (!PubChannel(chptr2) && chptr2 != chptr)
		return EXTBAN_INVALID;
	return IsMember(client_p, chptr2) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}
Exemple #21
0
static int has_common_channels(aClient *c1, aClient *c2)
{
	Membership *lp;

	for (lp = c1->user->channel; lp; lp = lp->next)
	{
		if (IsMember(c2, lp->chptr))
		{
			if (c1 == c2)
				return 1;
			/* We must ensure that c1 is allowed to "see" c2 */
                        if ((lp->chptr->mode.mode & MODE_AUDITORIUM) &&
                            !is_chan_op(c2, lp->chptr) && !is_chan_op(c1, lp->chptr))
                                break;

			return 1;
		}
	}
	return 0;
}
Exemple #22
0
ResultType WinGroup::Activate(bool aStartWithMostRecent, WindowSpec *aWinSpec, Label **aJumpToLabel)
{
	if (aJumpToLabel) // Initialize early in case of early return.
		*aJumpToLabel = NULL;
	if (IsEmpty())
		return OK;  // OK since this is the expected behavior in this case.
	// Otherwise:
	if (!Update(true)) // Update our private member vars.
		return FAIL;  // It already displayed the error for us.
	WindowSpec *win, *win_to_activate_next = aWinSpec;
	bool group_is_active = false; // Set default.
	HWND activate_win, active_window = GetForegroundWindow(); // This value is used in more than one place.
	if (win_to_activate_next)
	{
		// The caller told us which WindowSpec to start off trying to activate.
		// If the foreground window matches that WindowSpec, do nothing except
		// marking it as visited, because we want to stay on this window under
		// the assumption that it was newly revealed due to a window on top
		// of it having just been closed:
		if (win_to_activate_next == IsMember(active_window, *g))
		{
			group_is_active = true;
			MarkAsVisited(active_window);
			return OK;
		}
		// else don't mark as visited even if it's a member of the group because
		// we're about to attempt to activate a different window: the next
		// unvisited member of this same WindowSpec.  If the below doesn't
		// find any of those, it continue on through the list normally.
	}
	else // Caller didn't tell us which, so determine it.
	{
		if (win_to_activate_next = IsMember(active_window, *g)) // Foreground window is a member of this group.
		{
			// Set it to activate this same WindowSpec again in case there's
			// more than one that matches (e.g. multiple notepads).  But first,
			// mark the current window as having been visited if it hasn't
			// already by marked by a prior iteration.  Update: This method
			// doesn't work because if a unvisted matching window became the
			// foreground window by means other than using GroupActivate
			// (e.g. launching a new instance of the app: now there's another
			// matching window in the foreground).  So just call it straight
			// out.  It has built-in dupe-checking which should prevent the
			// list from filling up with dupes if there are any special
			// situations in which that might otherwise happen:
			//if (!sAlreadyVisitedCount)
			group_is_active = true;
			MarkAsVisited(active_window);
		}
		else // It's not a member.
		{
			win_to_activate_next = mFirstWindow;  // We're starting fresh, so start at the first window.
			// Reset the list of visited windows:
			sAlreadyVisitedCount = 0;
		}
	}

	// Activate any unvisited window that matches the win_to_activate_next spec.
	// If none, activate the next window spec in the series that does have an
	// existing window:
	// If the spec we're starting at already has some windows marked as visited,
	// set this variable so that we know to retry the first spec again in case
	// a full circuit is made through the window specs without finding a window
	// to activate.  Note: Using >1 vs. >0 might protect against any infinite-loop
	// conditions that may be lurking:
	bool retry_starting_win_spec = (sAlreadyVisitedCount > 1);
	bool retry_is_in_effect = false;
	for (win = win_to_activate_next;;)
	{
		// Call this in the mode to find the last match, which  makes things nicer
		// because when the sequence wraps around to the beginning, the windows will
		// occur in the same order that they did the first time, rather than going
		// backwards through the sequence (which is counterintuitive for the user):
		if (   activate_win = WinActivate(*g, win->mTitle, win->mText, win->mExcludeTitle, win->mExcludeText
			// This next line is whether to find last or first match.  We always find the oldest
			// (bottommost) match except when the user has specifically asked to start with the
			// most recent.  But it only makes sense to start with the most recent if the
			// group isn't currently active (i.e. we're starting fresh), because otherwise
			// windows would be activated in an order different from what was already shown
			// the first time through the enumeration, which doesn't seem to be ever desirable:
			, !aStartWithMostRecent || group_is_active
			, sAlreadyVisited, sAlreadyVisitedCount)   )
		{
			// We found a window to activate, so we're done.
			// Probably best to do this before WinDelay in case another hotkey fires during the delay:
			MarkAsVisited(activate_win);
			DoWinDelay;
			//MsgBox(win->mText, 0, win->mTitle);
			break;
		}
		// Otherwise, no window was found to activate.
		if (retry_is_in_effect)
			// This was the final attempt because we've already gone all the
			// way around the circular linked list of WindowSpecs.  This check
			// must be done, otherwise an infinite loop might result if the windows
			// that formed the basis for determining the value of
			// retry_starting_win_spec have since been destroyed:
			break;
		// Otherwise, go onto the next one in the group:
		win = win->mNextWindow;
        // Even if the above didn't change the value of <win> (because there's only
		// one WinSpec in the list), it's still correct to reset this count because
		// we want to start the fresh again after all the windows have been
		// visited.  Note: The only purpose of sAlreadyVisitedCount as used by
		// this function is to indicate which windows in a given WindowSpec have
		// been visited, not which windows altogether (i.e. it's not necessary to
		// remember which windows have been visited once we move on to a new
		// WindowSpec).
		sAlreadyVisitedCount = 0;
		if (win == win_to_activate_next)
		{
			// We've made one full circuit of the circular linked list without
			// finding an existing window to activate. At this point, the user
			// has pressed a hotkey to do a GroupActivate, but nothing has happened
			// yet.  We always want something to happen unless there's absolutely
			// no existing windows to activate, or there's only a single window in
			// the system that matches the group and it's already active.
			if (retry_starting_win_spec)
			{
				// Mark the foreground window as visited so that it won't be
				// mistakenly activated again by the next iteration:
				MarkAsVisited(active_window);
				retry_is_in_effect = true;
				// Now continue with the next iteration of the loop so that it
				// will activate a different instance of this WindowSpec rather
				// than getting stuck on this one.
			}
			else 
			{
				if (aJumpToLabel && mJumpToLabel)
				{
					// Caller asked us to return in this case, so that it can
					// use this value to execute a user-specified Gosub:
					*aJumpToLabel = mJumpToLabel;  // Set output param for the caller.
				}
				return FAIL; // Let GroupActivate set ErrorLevel to indicate what happened.
			}
		}
	}
	return OK;
}
Exemple #23
0
/* mo_ojoin()
 *      parv[0] = sender prefix
 *      parv[1] = channels separated by commas (#ifdef OJOIN_MULTIJOIN)
 */
static void
mo_ojoin(struct Client *client_p, struct Client *source_p,
         int parc, char *parv[])
{
    struct Channel *chptr;
    char *name = parv[1], modeletter;
#ifdef OJOIN_MULTIJOIN
    char *t;
#endif
    short move_me = 1;
    unsigned int tmp_flags;

    /* admins only */
    if (!IsAdmin(source_p))
    {
        sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
                   me.name, source_p->name);
        return;
    }

#ifdef OJOIN_MULTIJOIN
    for (name = strtoken (&t, name, ","); name;
            name = strtoken (&t, NULL, ","))
    {
#endif

        move_me = 1;

        switch (*name)
        {
#ifndef DISABLE_CHAN_OWNER
        case '!':
            tmp_flags = CHFL_CHANOWNER;
            modeletter = 'u';
            name++;
            break;
#endif
        case '@':
            tmp_flags = CHFL_CHANOP;
            modeletter = 'o';
            name++;
            break;
        case '+':
            tmp_flags = CHFL_VOICE;
            modeletter = 'v';
            name++;
            break;
        case '%':
            tmp_flags = CHFL_HALFOP;
            modeletter = 'h';
            name++;
            break;
        case '#':
        case '&':
            tmp_flags = 0;
            modeletter = '\0';
            break;

        /* We're not joining a channel, or we don't know the mode,
        * what ARE we joining? */
        default:
            sendto_one (source_p, form_str(ERR_NOSUCHCHANNEL),
                        me.name, source_p->name, name);

#ifdef OJOIN_MULTIJOIN
            continue;
#else
            return;
#endif
        }

        /* Error checking here */

        if ((chptr = hash_find_channel(name)) == NULL)
        {
            sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL),
                       me.name, source_p->name, name);
        }

        else if (IsMember(source_p, chptr))
        {
            sendto_one(source_p, ":%s NOTICE %s :Please part %s before using OJOIN",
                       me.name, source_p->name, name);
        }

        else
        {
            if (move_me == 1)
                name--;

            add_user_to_channel(chptr, source_p, tmp_flags);

            if (chptr->chname[0] == '#')
            {
                sendto_server(client_p, CAP_TS6, NOCAPS,
                              ":%s SJOIN %lu %s + :%c%s",
                              me.id, (unsigned long)chptr->channelts, chptr->chname,
                              (modeletter != '\0') ? *name : ' ',
                              source_p->id);
                sendto_server(client_p, NOCAPS, CAP_TS6,
                              ":%s SJOIN %lu %s + :%c%s", me.name,
                              (unsigned long)chptr->channelts,
                              chptr->chname, (modeletter != '\0') ? *name : ' ',
                              source_p->name);
            }

            sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
                                 source_p->name,
                                 source_p->username,
                                 GET_CLIENT_HOST(source_p),
                                 chptr->chname);

            if (modeletter != '\0')
            {
                sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +%c %s",
                                     me.name, chptr->chname, modeletter, source_p->name);
            }

            /* send the topic... */
            if (chptr->topic != NULL)
            {
                sendto_one(source_p, form_str(RPL_TOPIC),
                           me.name, source_p->name, chptr->chname,
                           chptr->topic);
                sendto_one(source_p, form_str(RPL_TOPICWHOTIME),
                           me.name, source_p->name, chptr->chname,
                           chptr->topic_info, chptr->topic_time);
            }

            source_p->localClient->last_join_time = CurrentTime;
            channel_member_names(source_p, chptr, 1);
        }
#ifdef OJOIN_MULTIJOIN
    }
#endif
}
Exemple #24
0
/* PStatecomp: parse a statecomp */
static void PStatecomp(ILink models, ILink *ilist, char *type,
                       IntSet states, HMMSet *hset)
{
   HMMDef *hmm;
   ILink h;
   int s,j;
   IntSet streams;
   Keyword kw;

   switch(kw=GetKey()) {
   case MIX_KEY:
   case STREAM_KEY:
      if (hset->hsKind==TIEDHS || hset->hsKind==DISCRETEHS)
         HError(7231,"PStatecomp: Cannot specify streams or mixes unless continuous");
      streams = CreateSet(SMAX);
      if(kw==STREAM_KEY) {
         PIndex(streams);
         SkipSpaces();
         if (ch != '.')
            EdError(". expected after stream spec");
         ReadCh();
         if (GetKey() != MIX_KEY)
            EdError("Mix expected after Stream index");
      } else
         AddMember(streams,1);
      SkipSpaces();
      if (ch=='[')
         PMix(models,ilist,type,states,streams,hset);
      else {
         ChkType('p',type);
         for (h=models; h!=NULL; h=h->next) {
            hmm = h->owner;
            for (j=2; j<hmm->numStates; j++)
               if (IsMember(states,j))
                  for (s=1; s<=hset->swidth[0];s++)
                     if (IsMember(streams,s)) { /* tie -> spdf */
                        if (trace & T_ITM)
                           printf(" %12s.state[%d].stream[%d]\n",
                                  HMMPhysName(hset,hmm),j,s);
                        AddItem(hmm,hmm->svec[j].info->pdf+s,ilist);
                     }
         }
      }
      FreeSet(streams);
      break;
   case DUR_KEY:
      ChkType('d',type);
      for (h=models; h!=NULL; h=h->next) {
         hmm = h->owner;
         for (j=2; j<hmm->numStates; j++)
            if (IsMember(states,j)) {  /* tie ->dur */
               if (trace & T_ITM)
                  printf(" %12s.state[%d].dur\n",
                         HMMPhysName(hset,hmm),j);
               AddItem(hmm,hmm->svec[j].info,ilist);
            }
      }
      break;
   case WEIGHTS_KEY:
      ChkType('w',type);
      for (h=models; h!=NULL; h=h->next) {
         hmm = h->owner;
         for (j=2; j<hmm->numStates; j++)
            if (IsMember(states,j)) { /* tie ->stream weights */
               if (trace & T_ITM)
                  printf(" %12s.state[%d].weights\n",
                         HMMPhysName(hset,hmm),j);
               AddItem(hmm,hmm->svec[j].info,ilist);
            }
      }
      break;
   default:
      EdError("dur, weight, stream or mix expected");
   }
}
Exemple #25
0
/* PMix: parse a mixture spec */
static void PMix(ILink models, ILink *ilist, char *type,
                 IntSet states, IntSet streams,HMMSet *hset)
{
   IntSet mixes;
   HMMDef *hmm;
   ILink h;
   int s,j,m;
   MixtureElem *me;
   StreamElem *ste;
   enum {TMIX, TMEAN, TCOV} what;

   mixes = CreateSet(maxMixes);
   PIndex(mixes);
   SkipSpaces();
   what = TMIX;
   if (ch == '.') {
      ReadCh();
      switch(GetKey()) {
      case MEAN_KEY:
         what = TMEAN; ChkType('u',type); break;
      case COV_KEY:
         what = TCOV;
         ChkType('a',type);
         break;
      default:
         EdError("Mean or Cov expected");
      }
   } else
      ChkType('m',type);
   for (h=models; h!=NULL; h=h->next) {
      hmm = h->owner;
      for (j=2; j<hmm->numStates; j++)
         if (IsMember(states,j)) {
            ste = hmm->svec[j].info->pdf+1;
            for (s=1; s<=hset->swidth[0]; s++,ste++)
               if (IsMember(streams,s)) {
                  me = ste->spdf.cpdf+1;
                  for (m=1; m<=ste->nMix; m++,me++)
                     if (me->weight>MINMIX && IsMember(mixes,m)) {
                        switch (what) {
                        case TMIX: /* tie ->mpdf */
                           if (trace & T_ITM)
                              printf(" %12s.state[%d].stream[%d].mix[%d]\n",
                                     HMMPhysName(hset,hmm),j,s,m);
                           AddItem(hmm,me,ilist);
                           break;
                        case TMEAN: /* tie ->mean */
                           ChkType('u',type);
                           if (trace & T_ITM)
                              printf(" %12s.state[%d].stream[%d].mix[%d].mean\n",
                                     HMMPhysName(hset,hmm),j,s,m);
                           AddItem(hmm,me->mpdf,ilist); break;
                        case TCOV: /* tie ->cov  */
                           switch (me->mpdf->ckind) {
                           case INVDIAGC:
                           case DIAGC:
                              ChkType('v',type); break;
                           case FULLC:
                              ChkType('i',type); break;
                           case LLTC:
                              ChkType('c',type); break;
                           case XFORMC:
                              ChkType('x',type); break;
                           }
                           if (trace & T_ITM)
                              printf(" %12s.state[%d].stream[%d].mix[%d].%c\n",
                                     HMMPhysName(hset,hmm),j,s,m,*type);
                           AddItem(hmm,me->mpdf,ilist);
                           break;
                        }
                     }
               }
         }
   }
   FreeSet(mixes);
}
Exemple #26
0
/*
 * m_lljoin
 *      parv[0] = sender prefix
 *      parv[1] = channel
 *      parv[2] = nick ("!nick" == cjoin)
 *      parv[3] = vchan/key (optional)
 *      parv[4] = key (optional)
 *
 * If a lljoin is received, from our uplink, join
 * the requested client to the given channel, or ignore it
 * if there is an error.
 *
 *   Ok, the way this works. Leaf client tries to join a channel, 
 * it doesn't exist so the join does a cburst request on behalf of the
 * client, and aborts that join. The cburst sjoin's the channel if it
 * exists on the hub, and sends back an LLJOIN to the leaf. Thats where
 * this is now..
 *
 */
static void ms_lljoin(struct Client *client_p,
                     struct Client *source_p,
                     int parc,
                     char *parv[])
{
  char *chname = NULL;
  char *nick = NULL;
  char *key = NULL;
  char *vkey = NULL;
  int  flags;
  int  i;
  struct Client *target_p;
  struct Channel *chptr, *vchan_chptr, *root_vchan;
#ifdef VCHANS
  int cjoin = 0;
  int  vc_ts;
  char *pvc = NULL;
#endif

  if(uplink && !IsCapable(uplink,CAP_LL))
    {
      sendto_realops_flags(FLAGS_ALL, L_ALL,
			   "*** LLJOIN requested from non LL server %s",
			   client_p->name);
      return;
    }

  chname = parv[1];
  if(chname == NULL)
    return;

  nick = parv[2];
  if(nick == NULL)
    return;

#ifdef VCHANS
  if (nick[0] == '!')
  {
    cjoin = 1;
    nick++;
  }
 
  if(parc > 4)
  {
    key = parv[4];
    vkey = parv[3];
  }
#endif
  else if(parc >3)
  {
    key = vkey = parv[3];
  }

  flags = 0;

  target_p = find_client(nick);

  if( !target_p || !target_p->user )
    return;

  if( !MyClient(target_p) )
    return;

  chptr = hash_find_channel(chname);

#ifdef VCHANS
  if (cjoin)
  {
    if(!chptr) /* Uhm, bad! */
    {
      sendto_realops_flags(FLAGS_ALL, L_ALL,
        "LLJOIN %s %s called by %s, but root chan doesn't exist!",
        chname, nick, client_p->name);
      return;
    }
    flags = CHFL_CHANOP;

    if(! (vchan_chptr = cjoin_channel(chptr, target_p, chname)))
      return;

    root_vchan = chptr;
    chptr = vchan_chptr;
  }
  else
#endif
  {
#ifdef VCHANS
    if (chptr)
    {
      vchan_chptr = select_vchan(chptr, target_p, vkey, chname);
    }
    else
#endif
    {
      chptr = vchan_chptr = get_or_create_channel(target_p, chname, NULL);
      flags = CHFL_CHANOP;
    }
   
#ifdef VCHANS
    if (vchan_chptr != chptr)
    {
      root_vchan = chptr;
      chptr = vchan_chptr;
    }
    else
#endif
      root_vchan = chptr;

    if(!chptr || !root_vchan)
      return;

    if (chptr->users == 0)
      flags = CHFL_CHANOP;
    else
      flags = 0;

    /* XXX in m_join.c :( */
    /* check_spambot_warning(target_p, chname); */

    /* They _could_ join a channel twice due to lag */
    if(chptr)
    {
      if (IsMember(target_p, chptr))    /* already a member, ignore this */
        return;
    }
    else
    {
      sendto_one(target_p, form_str(ERR_UNAVAILRESOURCE),
                 me.name, nick, root_vchan->chname);
      return;
    }

    if( (i = can_join(target_p, chptr, key)) )
    {
      sendto_one(target_p,
                 form_str(i), me.name, nick, root_vchan->chname);
      return;
    }
  }

  if ((target_p->user->joined >= ConfigChannel.max_chans_per_user) &&
      (!IsOper(target_p) || (target_p->user->joined >= 
                             ConfigChannel.max_chans_per_user*3)))
    {
      sendto_one(target_p, form_str(ERR_TOOMANYCHANNELS),
		 me.name, nick, root_vchan->chname );
      return; 
    }
  
  if(flags == CHFL_CHANOP)
    {
      chptr->channelts = CurrentTime;
      /*
       * XXX - this is a rather ugly hack.
       *
       * Unfortunately, there's no way to pass
       * the fact that it is a vchan through SJOIN...
       */
      /* Prevent users creating a fake vchan */
#ifdef VCHANS
      if (chname[0] == '#' && chname[1] == '#')
        {
          if ((pvc = strrchr(chname+3, '_')))
          {
            /*
             * OK, name matches possible vchan:
             * ##channel_blah
             */
            pvc++; /*  point pvc after last _ */
            vc_ts = atol(pvc);
            /*
             * if blah is the same as the TS, up the TS
             * by one, to prevent this channel being
             * seen as a vchan
             */
            if (vc_ts == CurrentTime)
              chptr->channelts++;
          }
        }
#endif

      sendto_one(uplink,
		 ":%s SJOIN %lu %s + :@%s",
		 me.name,
		 (unsigned long) chptr->channelts,
		 chptr->chname,
		 nick);
    }

  /* a user can create a channel with halfops..? */
#if 0
  else if ((flags == CHFL_HALFOP) && (IsCapable(uplink, CAP_HOPS)))
    {
      sendto_one(uplink,
		 ":%s SJOIN %lu %s + :%%%s",
		 me.name,
		 (unsigned long) chptr->channelts,
		 chptr->chname,
		 nick);
    }
#endif
  else
    {
      sendto_one(uplink,
		 ":%s SJOIN %lu %s + :%s",
		 me.name,
		 (unsigned long) chptr->channelts,
		 chptr->chname,
		 nick);
    }

  add_user_to_channel(chptr, target_p, flags);

#ifdef VCHANS
  if ( chptr != root_vchan )
    add_vchan_to_client_cache(target_p,root_vchan,chptr);
#endif
 
  sendto_channel_local(ALL_MEMBERS, chptr,
		       ":%s!%s@%s JOIN :%s",
		       target_p->name,
		       target_p->username,
		       target_p->host,
		       root_vchan->chname);
  
  if( flags & CHFL_CHANOP )
  {
    chptr->mode.mode |= MODE_TOPICLIMIT;
    chptr->mode.mode |= MODE_NOPRIVMSGS;
      
    sendto_channel_local(ALL_MEMBERS,chptr,
                         ":%s MODE %s +nt",
                         me.name, root_vchan->chname);
    sendto_one(uplink, 
               ":%s MODE %s +nt",
               me.name, chptr->chname);
  }

  channel_member_names(target_p, chptr, chname, 1);
}
// apply a team buff for the main and affected zones
void OutdoorPvP::BuffTeam(Team team, uint32 spellId, bool remove /*= false*/, bool onlyMembers /*= true*/, uint32 area /*= 0*/)
{
    for (GuidZoneMap::iterator itr = m_zonePlayers.begin(); itr != m_zonePlayers.end(); ++itr)
    {
        Player* player = sObjectMgr.GetPlayer(itr->first);
        if (!player)
            continue;

        if (player && (team == TEAM_NONE || player->GetTeam() == team) && (!onlyMembers || IsMember(player->GetObjectGuid())))
        {
            if (!area || area == player->GetAreaId())
            {
                if (remove)
                    player->RemoveAurasDueToSpell(spellId);
                else
                    player->CastSpell(player, spellId, true);
            }
        }
    }
}
Exemple #28
0
ResultType WinGroup::Deactivate(bool aStartWithMostRecent)
{
	if (IsEmpty())
		return OK;  // OK since this is the expected behavior in this case.
	// Otherwise:
	if (!Update(false)) // Update our private member vars.
		return FAIL;  // It already displayed the error for us.

	HWND active_window = GetForegroundWindow();
	if (IsMember(active_window, *g))
		sAlreadyVisitedCount = 0;

	// Activate the next unvisited non-member:
	WindowSearch ws;
	ws.mFindLastMatch = !aStartWithMostRecent || sAlreadyVisitedCount;
	ws.mAlreadyVisited = sAlreadyVisited;
	ws.mAlreadyVisitedCount = sAlreadyVisitedCount;
	ws.mFirstWinSpec = mFirstWindow;

	EnumWindows(EnumParentFindAnyExcept, (LPARAM)&ws);

	if (ws.mFoundParent)
	{
		// If the window we're about to activate owns other visble parent windows, it can
		// never truly be activated because it must always be below them in the z-order.
		// Thus, instead of activating it, activate the first (and usually the only?)
		// visible window that it owns.  Doing this makes things nicer for some apps that
		// have a pair of main windows, such as MS Visual Studio (and probably many more),
		// because it avoids activating such apps twice in a row as the user progresses
		// through the sequence:
		HWND first_visible_owned = WindowOwnsOthers(ws.mFoundParent);
		if (first_visible_owned)
		{
			MarkAsVisited(ws.mFoundParent);  // Must mark owner as well as the owned window.
			// Activate the owned window instead of the owner because it usually
			// (probably always, given the comments above) is the real main window:
			ws.mFoundParent = first_visible_owned;
		}
		SetForegroundWindowEx(ws.mFoundParent);
		// Probably best to do this before WinDelay in case another hotkey fires during the delay:
		MarkAsVisited(ws.mFoundParent);
		DoWinDelay;
	}
	else // No window was found to activate (they have all been visited).
	{
		if (sAlreadyVisitedCount)
		{
			bool wrap_around = (sAlreadyVisitedCount > 1);
			sAlreadyVisitedCount = 0;
			if (wrap_around)
			{
				// The user pressed a hotkey to do something, yet nothing has happened yet.
				// We want something to happen every time if there's a qualifying
				// "something" that we can do.  And in this case there is: we can start
				// over again through the list, excluding the foreground window (which
				// the user has already had a chance to review):
				MarkAsVisited(active_window);
				// Make a recursive call to self.  This can't result in an infinite
				// recursion (stack fault) because the called layer will only
				// recurse a second time if sAlreadyVisitedCount > 1, which is
				// impossible with the current logic:
				Deactivate(false); // Seems best to ignore aStartWithMostRecent in this case?
			}
		}
	}
	// Even if a window wasn't found, we've done our job so return OK:
	return OK;
}
/*
 * m_topic
 *      parv[0] = sender prefix
 *      parv[1] = channel name
 *	parv[2] = new topic, if setting topic
 */
static int
m_topic(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	struct Channel *chptr = NULL;
	struct membership *msptr;
	char *p = NULL;

	if((p = strchr(parv[1], ',')))
		*p = '\0';

	if(MyClient(source_p) && !IsFloodDone(source_p))
		flood_endgrace(source_p);

	if(!IsChannelName(parv[1]))
	{
		sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
				   form_str(ERR_NOSUCHCHANNEL), parv[1]);
		return 0;
	}

	chptr = find_channel(parv[1]);

	if(chptr == NULL)
	{
		sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
				form_str(ERR_NOSUCHCHANNEL), parv[1]);
		return 0;
	}

	/* setting topic */
	if(parc > 2)
	{
		msptr = find_channel_membership(chptr, source_p);

		if(msptr == NULL)
		{
			sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
					form_str(ERR_NOTONCHANNEL), parv[1]);
			return 0;
		}

		if((chptr->mode.mode & MODE_TOPICLIMIT) == 0 || is_chanop(msptr) || !MyClient(source_p))
		{
			char topic_info[USERHOST_REPLYLEN];
			ircsprintf(topic_info, "%s!%s@%s",
					source_p->name, source_p->username, source_p->host);
			set_channel_topic(chptr, parv[2], topic_info, CurrentTime);

			sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
					":%s TOPIC %s :%s",
					use_id(source_p), chptr->chname,
					chptr->topic == NULL ? "" : chptr->topic);
			sendto_server(client_p, chptr, NOCAPS, CAP_TS6,
					":%s TOPIC %s :%s",
					source_p->name, chptr->chname,
					chptr->topic == NULL ? "" : chptr->topic);
			sendto_channel_local(ALL_MEMBERS,
					chptr, ":%s!%s@%s TOPIC %s :%s",
					source_p->name, source_p->username,
					source_p->host, chptr->chname,
					chptr->topic == NULL ? "" : chptr->topic);
		}
		else
			sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
					me.name, source_p->name, parv[1]);
	}
	else if(MyClient(source_p))
	{
		if(!IsMember(source_p, chptr) && SecretChannel(chptr))
		{
			sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
					form_str(ERR_NOTONCHANNEL), parv[1]);
			return 0;
		}
		if(chptr->topic == NULL)
			sendto_one(source_p, form_str(RPL_NOTOPIC),
					me.name, source_p->name, parv[1]);
		else
		{
			sendto_one(source_p, form_str(RPL_TOPIC),
					me.name, source_p->name, chptr->chname, chptr->topic);

			sendto_one(source_p, form_str(RPL_TOPICWHOTIME),
					me.name, source_p->name, chptr->chname,
					chptr->topic_info, chptr->topic_time);
		}
	}

	return 0;
}
/*
** m_list
**      parv[0] = sender prefix
**      parv[1] = channel
*/
int     m_list(struct Client *cptr,
               struct Client *sptr,
               int parc,
               char *parv[])
{
  struct Channel *chptr;
  char  *name, *p = NULL;
  /* anti flooding code,
   * I did have this in parse.c with a table lookup
   * but I think this will be less inefficient doing it in each
   * function that absolutely needs it
   *
   * -Dianora
   */
  static time_t last_used=0L;
  int i,j,minusers;
  minusers = HasUmode(sptr,UMODE_USER_AUSPEX) ? 0 : MIN_USERS_FOR_LIST;

  /* throw away non local list requests that do get here -Dianora */
  if(!MyConnect(sptr))
    return 0;

  if(!NoFloodProtection(sptr))
    {
      if(IsHoneypot(sptr) || (((last_used + PACE_WAIT) > CurrentTime) && (!IsDoingList(sptr))))
        {
          sendto_one(sptr,form_str(RPL_LOAD2HI),me.name,parv[0],"LIST");
	  sendto_one(sptr,form_str(RPL_LISTEND),me.name,parv[0]);
          return 0;
        }
      else
        last_used = CurrentTime;
    }

  /* right.. if we are already involved in a "blocked" /list, we will simply
     continue where we left off */
  if (IsDoingList(sptr)) {
    if (sptr->listprogress != -1) {
      for (i=sptr->listprogress; i<CH_MAX; i++) {
        int progress2 = sptr->listprogress2;
        for (j=0, chptr=(struct Channel*)(hash_get_channel_block(i).list);
             (chptr) && (j<hash_get_channel_block(i).links); chptr=chptr->hnextch, j++) {
          if (j<progress2) continue;  /* wind up to listprogress2 */

          /* Safety check */
          if (!sptr->user)
            continue;

          /* If it's secret, and none of the overriding conditions are true, don't send it */
          if (SecretChannel(chptr) && !HasUmode(sptr,UMODE_USER_AUSPEX) && !IsMember(sptr, chptr) && !IsLogger(sptr, chptr))
            continue;

          if (chptr->users < minusers)
            continue;
          sendto_one(sptr, form_str(RPL_LIST), me.name, parv[0],
                     chptr->chname, chptr->users, chptr->topic);

          if (IsSendqPopped(sptr))
            {
              sptr->listprogress=i;
              sptr->listprogress2=j;
              return 0;
            }
        }
        sptr->listprogress2 = 0;
      }
    }
    sendto_one(sptr, form_str(RPL_LISTEND), me.name, parv[0]);
    if (IsSendqPopped(sptr)) { /* popped with the RPL_LISTEND code. d0h */
      sptr->listprogress = -1;
      return 0;
    }
    ClearDoingList(sptr);   /* yupo, its over */
    return 0;
    
  }

  /* Grr, mIRC -- jilles */
  if (parc == 2 && !strcmp(parv[1], "<10000"))
  {
#if 0 /* discussed #hyperion 20050807, considered unnecessary and confusing */
    sendto_one(sptr, ":%s NOTICE %s :Your client is buggy, it sends LIST <10000 even though we don't advertise ELIST=U in 005. Please upgrade or contact the developers.", me.name, parv[0]);
#endif
    parc--;
  }
  
  sendto_one(sptr, form_str(RPL_LISTSTART), me.name, parv[0]);

  if (parc < 2 || BadPtr(parv[1]))
    {
      SetDoingList(sptr);     /* only set if its a full list */
      ClearSendqPop(sptr);    /* just to make sure */
      /* we'll do this by looking through each hash table bucket */
      for (i=0; i<CH_MAX; i++) {
        for (j=0, chptr = (struct Channel*)(hash_get_channel_block(i).list);
             (chptr) && (j<hash_get_channel_block(i).links); chptr = chptr->hnextch, j++) {

          /* Safety check */
          if (!sptr->user)
            continue;

          /* If it's secret, and none of the overriding conditions are true, don't send it */
          if (SecretChannel(chptr) && !HasUmode(sptr,UMODE_USER_AUSPEX) && !IsMember(sptr, chptr) && !IsLogger(sptr, chptr))
            continue;

          if (chptr->users < minusers)
            continue;
          sendto_one(sptr, form_str(RPL_LIST), me.name, parv[0],
                     chptr->chname, chptr->users, chptr->topic);

          if (IsSendqPopped(sptr))
            {
              sptr->listprogress=i;
              sptr->listprogress2=j;
              return 0;
            }
        }
      }

      sendto_one(sptr, form_str(RPL_LISTEND), me.name, parv[0]);
      if (IsSendqPopped(sptr)) {
        sptr->listprogress=-1;
        return 0;
      }
      ClearDoingList(sptr);   /* yupo, its over */
      return 0;
    }   

  p = strchr(parv[1],',');
  if(p)
    *p = '\0';
  name = parv[1]; /* strtoken(&p, parv[1], ","); */

  /* while(name) */
  if(name)
    {
      chptr = hash_find_channel(name, NullChn);
      if (chptr && ShowChannel(sptr, chptr) && sptr->user)
        sendto_one(sptr, form_str(RPL_LIST), me.name, parv[0],
                   name, chptr->users, chptr->topic);
      /*      name = strtoken(&p, (char *)NULL, ","); */
    }
  sendto_one(sptr, form_str(RPL_LISTEND), me.name, parv[0]);
  return 0;
}