Beispiel #1
0
void CChan::Clone(CChan& chan) {
	// We assume that m_sName and m_pNetwork are equal
	SetBufferCount(chan.GetBufferCount(), true);
	SetKeepBuffer(chan.KeepBuffer());
	SetKey(chan.GetKey());
	SetDefaultModes(chan.GetDefaultModes());

	if (IsDetached() != chan.IsDetached()) {
		// Only send something if it makes sense
		// (= Only detach if client is on the channel
		//    and only attach if we are on the channel)
		if (IsOn()) {
			if (IsDetached()) {
				JoinUser(false, "");
			} else {
				DetachUser();
			}
		}
		SetDetached(chan.IsDetached());
	}
}
Beispiel #2
0
	void GetChan(const CString& sLine) {
		const CString var  = sLine.Token(1).AsLower();
		CString username   = sLine.Token(2);
		CString chan = sLine.Token(3, true);

		if (var.empty()) {
			PutModule("Usage: getchan <variable> [username] <chan>");
			return;
		}
		if (chan.empty()) {
			chan = username;
			username = "";
		}
		if (username.empty()) {
			username = m_pUser->GetUserName();
		}

		CUser* user = GetUser(username);
		if (!user)
			return;

		CChan* pChan = user->FindChan(chan);
		if (!pChan) {
			PutModule("Error: Channel not found: " + chan);
			return;
		}

		if (var == "defmodes")
			PutModule("DefModes = " + pChan->GetDefaultModes());
		else if (var == "buffer")
			PutModule("Buffer = " + CString(pChan->GetBufferCount()));
		else if (var == "inconfig")
			PutModule("InConfig = " + pChan->InConfig());
		else if (var == "keepbuffer")
			PutModule("KeepBuffer = " + pChan->KeepBuffer());
		else if (var == "detached")
			PutModule("Detached = " + pChan->IsDetached());
		else
			PutModule("Error: Unknown variable");
	}