示例#1
0
Event	*EventAddEx(Module *module, char *name, long every, long howmany,
		  vFP event, void *data)
{
	Event *newevent;
	if (!name || (every < 0) || (howmany < 0) || !event)
	{
		if (module)
			module->errorcode = MODERR_INVALID;
		return NULL;
	}
	newevent = (Event *) MyMallocEx(sizeof(Event));
	newevent->name = strdup(name);
	newevent->howmany = howmany;
	newevent->every = every;
	newevent->event = event;
	newevent->data = data;
	/* We don't want a quick execution */
	newevent->last = TStime();
	newevent->owner = module;
	AddListItem(newevent,events);
	if (module) {
		ModuleObject *eventobj = (ModuleObject *)MyMallocEx(sizeof(ModuleObject));
		eventobj->object.event = newevent;
		eventobj->type = MOBJ_EVENT;
		AddListItem(eventobj, module->objects);
		module->errorcode = MODERR_NOERROR;
	}
	return newevent;
	
}
void FriendListItemManager::OnUserInfoChange(const std::list<nim::UserNameCard> &uinfos)
{
	for (auto info : uinfos)
	{
		std::string accid = info.GetAccId();
		if (UserService::GetInstance()->GetUserType(accid) == nim::kNIMFriendFlagNormal)
		{
			FriendItem* item = dynamic_cast<FriendItem*>(friend_list_->FindSubControl(nbase::UTF8ToUTF16(accid)));
			if (item != NULL)
			{
				if (info.ExistValue(nim::kUserNameCardKeyName))
				{
					//nim::UserNameCard all_info;
					//UserService::GetInstance()->GetUserInfo(info.GetAccId(), all_info);
					DeleteListItem(accid);
					AddListItem(accid);
				}
				else
					item->Init(false, accid);
			}
			else if(accid != LoginManager::GetInstance()->GetAccount()
				&& !MuteBlackService::GetInstance()->IsInBlackList(accid))
				AddListItem(accid);
		}
	}
}
示例#3
0
static void AddListFGroup(t_x11 *x11, t_dlgitemlist **grid,
			  t_fgroup *fgroup, t_id *ID,bool bUseMon)
{
  int i;
  t_id GroupID,*ids;
  t_dlgitemlist *item;
  int x,y,w;
  
  GroupID=(*ID)++;
  item=&(grid[fgroup->x][fgroup->y]);
  AddListItem(item,CreateGroupBox(x11,fgroup->name,GroupID,
				  0,NULL,0,0,0,0,0));
  x=2*OFFS_X;
  y=item->list[0]->win.y+item->list[0]->win.height;
  w=0;
  for(i=0; (i<fgroup->nfitem); i++)
    AddListFItem(x11,item,fgroup->fitem[i],GroupID,ID,x,&y,&w,bUseMon);
  
  w=max(w,item->list[0]->win.width+4*OFFS_X);
  sfree(item->list[0]->u.groupbox.item);
  sfree(item->list[0]->win.text);
  snew(ids,item->nitem);
  for(i=0; (i<item->nitem-1); i++)
    ids[i]=GroupID+i+1;
  item->list[0]=
    CreateGroupBox(x11,fgroup->name,GroupID,item->nitem-1,ids,
		   2*OFFS_X,2*OFFS_Y,w+2*OFFS_X,y,0);
  sfree(ids);
  item->w=fgroup->w;
  item->h=fgroup->h;
}
示例#4
0
int CDropListBox::InsertListItem(int nIndex, PLIST_ITEM pItem)
{
//	AfxTrace(_T("InsertListItem: %d\n"), nIndex);
	ASSERT(pItem != NULL);

	if(nIndex < 0 || nIndex >= GetCount())
	{
		return AddListItem(pItem);
	}

	//add children firstly
	if( !(pItem->state & ACBIS_COLLAPSED) && (pItem->GetChildCount() > 0) )
	{
		PLIST_ITEM pChild;
		for(int i = pItem->GetChildCount() - 1; i >= 0; i--)
		{
			pChild = pItem->GetChildAt(i);
			AtomicInsertListItem(nIndex, pChild);
		}
	}

	//insert parent at last
	int nPos = AtomicInsertListItem(nIndex, pItem);
	return nPos;
}
示例#5
0
bool CSVQueryString::Parser(const char * pQueryString)
{
    if(pQueryString == NULL || strlen(pQueryString) == 0)
        return false;
    char * token = NULL;
    // duplicate string
    char * cp = strdup(pQueryString);
    if (cp)
    {
        char * pTmp = cp;
        if (pSVSeps) // using separators
            token = strtok( pTmp , pSVSeps);
        else // using separators
            token = strtok( pTmp, chDefSeps);
        // every field
        while( token != NULL )
        {
            triml(token);
            AddListItem(token);
            // next field
            if (pSVSeps)
                token = strtok( NULL , pSVSeps);
            else
                token = strtok( NULL, chDefSeps);
        }
        // free memory
        free(cp);
    }
    return true;
}
void FriendListItemManager::OnBlackListChange(const std::string& id, bool is_black)
{
	if (is_black)
		DeleteListItem(id);
	else if (UserService::GetInstance()->GetUserType(id) == nim::kNIMFriendFlagNormal)
		AddListItem(id);
}
示例#7
0
void udfPaymentHistory::OnAdd( wxCommandEvent& event )
{
    do
    {
        CPaymentHistoryTable::tDATA data = {0};
        int nPos = m_listPayments->GetItemCount();

        udfPayment	dlg(this);
        if(dlg.ShowModal() == wxID_OK)
        {
            data.id = -nPos;
            data.personId = m_nPersonId;
            data.type = m_cType;
            data.payDate = dlg.GetPayDate().GetTicks();
            data.expDate = dlg.GetExpDate().GetTicks();
            if(dlg.GetFreeCheck())
                data.sum = -1.0;
            else
                data.sum = dlg.GetSum();

            if(UDF_OK != CPaymentHistoryTable(m_pCon).AddRow(data))
                break;

            CPaymentHistoryTable::tTableIt it = m_payments.insert(make_pair(data.id, data)).first;

            AddListItem(it);
        }
    } while(0);
}
示例#8
0
void ACheatInfoDlg::ShowCheatInfo(ACheatFile* file,ACheatEntry* pEntry)
{

	m_pFile = file;
	m_pEntry = pEntry;
	
	//当pEntry=0时...比如删除了某个金手指后置0
	if(pEntry == NULL){
		m_editName->SetWindowText("<<请打开一个金手指>>");
		m_CheatsList->DeleteAllItems();
		this->EnableWindow(FALSE);
		return;
	}else{
		this->EnableWindow(TRUE);
	}

	assert(pEntry->type == ACheatEntry::TYPE_CHEAT);
	if(pEntry->type != ACheatEntry::TYPE_CHEAT){
		MessageBox("app error",0,MB_ICONERROR);
		return;
	}
	m_CheatsList->DeleteAllItems();

	//更新Name和描述
	m_editName->SetWindowText(pEntry->item.name.c_str());
	
	//lists to lv
	auto& v = m_pEntry->item.values;
	auto s = v.begin();
	auto e = v.end();
	for(; s!=e; ++s){
		AddListItem((*s)->name.c_str(),0);
	}
}
示例#9
0
/*
 * Adds a "remove channelmode set by +f" timer.
 * chptr	Channel
 * mflag	Mode flag, eg 'C'
 * mbit		Mode bitflag, eg MODE_NOCTCP
 * when		when it should be removed
 * NOTES:
 * - This function takes care of overwriting of any previous timer
 *   for the same modechar.
 * - The function takes care of chptr->mode.floodprot->timer_flags,
 *   do not modify it yourself.
 * - chptr->mode.floodprot is asumed to be non-NULL.
 */
void chanfloodtimer_add(aChannel *chptr, char mflag, long mbit, time_t when)
{
RemoveFld *e = NULL;
unsigned char add=1;

	if (chptr->mode.floodprot->timer_flags & mbit)
	{
		/* Already exists... */
		e = chanfloodtimer_find(chptr, mflag);
		if (e)
			add = 0;
	}

	if (add)
		e = MyMallocEx(sizeof(RemoveFld));

	e->chptr = chptr;
	e->m = mflag;
	e->when = when;

	if (add)
		AddListItem(e, removefld_list);

	chptr->mode.floodprot->timer_flags |= mbit;
}
void CDlgInterfaceEdtor::FillListItem()
{
	m_lvMethodList.DeleteAllItems();
	for(UINT i=0;i<m_InterfaceInfo.MethodList.size();i++)
	{
		AddListItem(m_InterfaceInfo.MethodList[i],i);
	}
}
示例#11
0
Snomask *SnomaskAdd(Module *module, char ch, int (*allowed)(aClient *sptr, int what), long *mode)
{
	short	 i = 0;
	short	 j = 0;
	short 	 save = -1;
	while (i < UMODETABLESZ)
	{
		if (!Snomask_Table[i].flag && save == -1)
			save = i;
		else if (Snomask_Table[i].flag == ch)
		{
			if (Snomask_Table[i].unloaded)
			{
				save = i;
				Snomask_Table[i].unloaded = 0;
				break;
			}
			else
			{
				if (module)
					module->errorcode = MODERR_EXISTS;
				return NULL;
			}
		}
		i++;
	}
	i = save;
	if (i != UMODETABLESZ)
	{
		Snomask_Table[i].flag = ch;
		Snomask_Table[i].allowed = allowed;
		/* Update usermode table highest */
		for (j = 0; j < UMODETABLESZ; j++)
			if (Snomask_Table[i].flag)
				if (i > Snomask_highest)
					Snomask_highest = i;
		*mode = Snomask_Table[i].mode;
		Snomask_Table[i].owner = module;
		if (module)
		{
			ModuleObject *snoobj = MyMallocEx(sizeof(ModuleObject));
			snoobj->object.snomask = &(Snomask_Table[i]);
			snoobj->type = MOBJ_SNOMASK;
			AddListItem(snoobj, module->objects);
			module->errorcode = MODERR_NOERROR;
		}
		return &(Snomask_Table[i]);
	}
	else
	{
		Debug((DEBUG_DEBUG, "SnomaskAdd failed, no space"));
		*mode = 0;
		if (module)
			module->errorcode = MODERR_NOSPACE;
		return NULL;
	}
}
示例#12
0
void	DCCdeny_add(char *filename, char *reason, int type, int type2)
{
	ConfigItem_deny_dcc *deny = NULL;
	
	deny = (ConfigItem_deny_dcc *) MyMallocEx(sizeof(ConfigItem_deny_dcc));
	deny->filename = strdup(filename);
	deny->reason = strdup(reason);
	deny->flag.type = type;
	deny->flag.type2 = type2;
	AddListItem(deny, conf_deny_dcc);
}
void FriendListItemManager::OnGetFriendList(const std::list<nim::UserNameCard> &user)
{
	UTF8String current_user_id = LoginManager::GetInstance()->GetAccount();
	for (auto it = user.begin(); it != user.end(); it++) {
		if (it->GetAccId() != current_user_id
			&& UserService::GetInstance()->GetUserType(it->GetAccId()) == nim::kNIMFriendFlagNormal
			&& !MuteBlackService::GetInstance()->IsInBlackList(it->GetAccId()))
		{
			AddListItem(it->GetAccId());
		}
	}
}
示例#14
0
void FillList( PSI_CONTROL list,PMACRO_BUTTON button )
{
	if( list )
	{
		PMACRO_ELEMENT pme = button->elements;
		ResetList( list );
		while( pme )
		{
			SetItemData( AddListItem( list, (pme->button->text&&pme->button->text[0])?pme->button->text:pme->button->pTypeName ), (uintptr_t)pme );
			//SetItemText( pli, (pme->button->text&&pme->button->text[0])?pme->button->text:pme->button->pTypeName );
			pme = NextThing( pme );
		}
	}
}
void CDlgInterfaceEdtor::OnBnClickedButtonAddMethod()
{
	// TODO: 在此添加控件通知处理程序代码
	CDlgMethodEditor Dlg;

	Dlg.SetID(m_InterfaceInfo.IDSeed);
	if(Dlg.DoModal()==IDOK)
	{
		m_InterfaceInfo.IDSeed++;
		INTERFACE_METHOD MethodInfo;
		Dlg.GetData(MethodInfo);
		m_InterfaceInfo.MethodList.push_back(MethodInfo);
		AddListItem(MethodInfo,m_InterfaceInfo.MethodList.size()-1);
	}
}
void FriendListItemManager::OnFriendListChange(FriendChangeType change_type, const std::string& accid)
{
	if (change_type == kChangeTypeAdd)
	{
		if (accid != LoginManager::GetInstance()->GetAccount()
			&& UserService::GetInstance()->GetUserType(accid) == nim::kNIMFriendFlagNormal
			&& !MuteBlackService::GetInstance()->IsInBlackList(accid))
		{
			AddListItem(accid);
		}
	}
	else if (change_type == kChangeTypeDelete)
	{
		DeleteListItem(accid);
	}
}
示例#17
0
void CProjectInfoPage::FetchProjects(tstring& strStartDataTime,const tstring& strSearch)
{
	//1:Remove all first.
	RemoveAllListItems();


	m_pBtnFirstpage->SetVisible(false);
	m_pBtnPrevPage->SetVisible(false);
	m_pBtnNextPage->SetVisible(false);
	m_pBtnEndPage->SetVisible(false);
	//Hide all page button
	for (int i=1; i<=const_total_page_btn_count; i++)
	{
		char buf[100]={0};
		sprintf_s(buf, sizeof(buf), _T("btn_page_%d"), i);
		CControlUI* pControlPagebtn= (CControlUI*)static_cast<CControlUI*>(m_PaintManager->FindControl(buf));
		if (NULL != pControlPagebtn)
		{
			pControlPagebtn->SetVisible(false);
		}
	}

	//2:Get new project items;
	if (NULL != m_pProjProcessor)
	{
		if(m_pProjProcessor->GetProject(strStartDataTime, m_vecProjects,strSearch))
		{
			int nShowCount = 0;
			if (m_vecProjects.size()>const_max_items_in_page)
			{
				nShowCount = const_max_items_in_page;
			}
			else
			{
				nShowCount = m_vecProjects.size();
			}

			AddListItem(0, nShowCount);

			UpdateParas(m_vecProjects.size());

			UpdatePageButton();
		}
	}
}
示例#18
0
Extban *ExtbanAdd(Module *module, ExtbanInfo req)
{
int slot;
char tmpbuf[512];

	if (findmod_by_bantype(req.flag))
	{
		if (module)
			module->errorcode = MODERR_EXISTS;
		return NULL; 
	}

	/* TODO: perhaps some sanity checking on a-zA-Z0-9? */
	for (slot = 0; slot < EXTBANTABLESZ; slot++)
		if (ExtBan_Table[slot].flag == '\0')
			break;
	if (slot == EXTBANTABLESZ - 1)
	{
		if (module)
			module->errorcode = MODERR_NOSPACE;
		return NULL;
	}
	ExtBan_Table[slot].flag = req.flag;
	ExtBan_Table[slot].is_ok = req.is_ok;
	ExtBan_Table[slot].conv_param = req.conv_param;
	ExtBan_Table[slot].is_banned = req.is_banned;
	ExtBan_Table[slot].owner = module;
	ExtBan_Table[slot].options = req.options;
	if (module)
	{
		ModuleObject *banobj = MyMallocEx(sizeof(ModuleObject));
		banobj->object.extban = &ExtBan_Table[slot];
		banobj->type = MOBJ_EXTBAN;
		AddListItem(banobj, module->objects);
		module->errorcode = MODERR_NOERROR;
	}
	ExtBan_highest = slot;
	if (loop.ircd_booted)
	{
		make_extbanstr();
		ircsprintf(tmpbuf, "~,%s", extbanstr);
		IsupportSetValue(IsupportFind("EXTBAN"), tmpbuf);
	}
	return &ExtBan_Table[slot];
}
bool CWebBrowserDownloadHandler::OnInit()
{
  ClearList();
  m_items.clear();

  for (const auto& file : GetActiveDownloads())
    m_items.push_back(file.second);
  for (const auto& file : GetFinishedDownloads())
  {
    if (file.second->GetName().empty())
      continue;
    m_items.push_back(file.second);
  }

  for (const auto& file : m_items)
  {
    kodi::gui::ListItemPtr item(new kodi::gui::CListItem(file->GetName()));

    std::string info;
    if (file->IsComplete())
    {
      info = kodi::GetLocalizedString(30015);

      std::time_t time = file->GetDownloadTime();
      auto tm = *std::localtime(&time);

      std::string format = kodi::GetRegion("datelong") + " - " + kodi::GetRegion("time");
      std::ostringstream oss;
      oss << std::put_time(&tm, format.c_str());
      item->SetProperty("downloadtime", oss.str());
    }
    else if (file->IsCanceled())
      info = kodi::GetLocalizedString(30096);
    else if (file->IsPaused())
      info = StringUtils::Format(kodi::GetLocalizedString(30095).c_str(), file->GetProcessText().c_str());
    else
      info = file->GetProcessText();

    item->SetLabel2(info);
    item->SetPath(file->GetPath());
    AddListItem(item);
  }

  return true;
}
示例#20
0
static void ConfigureMacroButton( PMACRO_BUTTON button, PSI_CONTROL parent )
{
	PSI_CONTROL frame = LoadXMLFrameOver( parent, WIDE( "ConfigureMacroButton.isFrame" ) );
	if( frame )
	{
		int okay = 0;
		int done = 0;
		l.configuration_parent = parent;
		SetCommonButtons( frame, &done, &okay );
		{
			PSI_CONTROL list;
			SetListboxIsTree( list = GetControl( frame, LIST_CONTROL_TYPES ), 1 );
			ResetList( list );
			FillControlsList( list, 1, TASK_PREFIX WIDE( "/control" ), NULL );
			SetCommonButtonControls( frame );
			SetButtonPushMethod( GetControl( frame, BUTTON_ADD_CONTROL ), AddButtonType, (uintptr_t)button );
			//SetButtonPushMethod( GetControl( frame, BUTTON_EDIT_CONTROL ), AddButtonType, (uintptr_t)button );
			{
				PSI_CONTROL list = GetControl( frame, LIST_MACRO_ELEMENTS );
				if( list )
				{
					PMACRO_ELEMENT pme = button->elements;
					while( pme )
					{
						SetItemData( AddListItem( list, (pme->button->text&&pme->button->text[0])?pme->button->text:pme->button->pTypeName ), (uintptr_t)pme );
						pme = NextThing( pme );
					}
				}
			}
			SetButtonPushMethod( GetControl( frame, BUTTON_ELEMENT_UP ), MoveElementUp, (uintptr_t)button );
			SetButtonPushMethod( GetControl( frame, BUTTON_ELEMENT_CLONE ), MoveElementClone, (uintptr_t)button );
			SetButtonPushMethod( GetControl( frame, BUTTON_ELEMENT_CLONE_ELEMENT ), CloneElement, (uintptr_t)button );
			SetButtonPushMethod( GetControl( frame, BUTTON_ELEMENT_DOWN ), MoveElementDown, (uintptr_t)button );
			SetButtonPushMethod( GetControl( frame, BUTTON_ELEMENT_CONFIGURE ), ConfigureElement, (uintptr_t)button );
			SetButtonPushMethod( GetControl( frame, BUTTON_ELEMENT_REMOVE ), MoveElementRemove, (uintptr_t)button );
		}
		DisplayFrameOver( frame, parent );
		CommonWait( frame );
		if( okay )
		{
			GetCommonButtonControls( frame );
		}
		DestroyFrame( &frame );
	}
}
示例#21
0
void udfPaymentHistory::RefreshList()
{
    m_listPayments->DeleteAllItems();

    CPaymentHistoryTable table(m_pCon);
    CPaymentHistoryTable::tDATA filter = {0};
    filter.personId = m_nPersonId;
    filter.type = m_cType;
    table.AddOrder("pay_date", CPaymentHistoryTable::ST_DESCENDING);
    table.Find(m_payments, filter);

    CPaymentHistoryTable::tTableIt it = m_payments.begin();
    while(it != m_payments.end())
    {
        AddListItem(it);

        it++;
    }
}
示例#22
0
DLLFUNC int nopost_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
{
ConfigEntry *cep, *cep2;
DynList *d;

	if (type != CONFIG_SET)
		return 0;
	
	/* We are only interrested in set::nopost... */
	if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "nopost"))
		return 0;
	
	for (cep = ce->ce_entries; cep; cep = cep->ce_next)
	{
		if (!strcmp(cep->ce_varname, "except-hosts"))
		{
			for (cep2 = cep->ce_entries; cep2; cep2 = cep2->ce_next)
			{
				d = MyMallocEx(sizeof(DynList));
				d->entry = strdup(cep2->ce_varname);
				AddListItem(d, cfg.except_hosts);
			}
		} else
		if (!strcmp(cep->ce_varname, "ban-action"))
		{
			cfg.ban_action = banact_stringtoval(cep->ce_vardata);
		} else
		if (!strcmp(cep->ce_varname, "ban-reason"))
		{
			if (cfg.ban_reason)
				MyFree(cfg.ban_reason);
			cfg.ban_reason = strdup(cep->ce_vardata);
		} else
		if (!strcmp(cep->ce_varname, "ban-time"))
		{
			cfg.ban_time = config_checkval(cep->ce_vardata, CFG_TIME);
		}
	}
	return 1;
}
示例#23
0
static DWORD
HandleBlockDNSMessage (const block_dns_message_t *msg, undo_lists_t *lists)
{
  DWORD err = 0;
  HANDLE engine = NULL;
  LPCWSTR exe_path;

#ifdef UNICODE
  exe_path = settings.exe_path;
#else
  WCHAR wide_path[MAX_PATH];
  MultiByteToWideChar (CP_UTF8, 0, settings.exe_path, MAX_PATH, wide_path, MAX_PATH);
  exe_path = wide_path;
#endif

  if (msg->header.type == msg_add_block_dns)
    {
      err = add_block_dns_filters (&engine, msg->iface.index, exe_path, BlockDNSErrHandler);
      if (!err)
        err = AddListItem (&(*lists)[block_dns], engine);
    }
  else
    {
      engine = RemoveListItem (&(*lists)[block_dns], CmpEngine, NULL);
      if (engine)
        {
          err = delete_block_dns_filters (engine);
          engine = NULL;
        }
      else
        MsgToEventLog (M_ERR, TEXT("No previous block DNS filters to delete"));
    }

  if (err && engine)
    {
      delete_block_dns_filters (engine);
    }

  return err;
}
示例#24
0
void CProjectInfoPage::GotoPage(int nPageIndex)
{
	if (nPageIndex>0 && nPageIndex<= m_nEndPageIndex)
	{
		//先清空当前的list
		RemoveAllListItems();

		int nStartIndexInCache = (nPageIndex-1)*const_max_items_in_page;
		int nShowCount = const_max_items_in_page;
		if (nPageIndex == m_nEndPageIndex)//如果是最后一页:减去前n-1页就是剩下的的:1-8个
		{
			nShowCount = m_vecProjects.size() - (nPageIndex-1)*const_max_items_in_page;
		}

		AddListItem(nStartIndexInCache, nShowCount);

		m_nCurrentPageIndex = nPageIndex;

		//将当前页的字体设为高亮
		UpdatePageButton();
	}
}
示例#25
0
int CDropListBox::AddListItem( PLIST_ITEM pItem )
{
//	AfxTrace(_T("AddListItem: %d\n"), GetCount());
	ASSERT(pItem != NULL);

	int nPos = AtomicAddListItem(pItem);

	if(nPos >= 0)
	{
		//add children if needed
		if( !(pItem->state & ACBIS_COLLAPSED) && (pItem->GetChildCount() > 0) )
		{
			int i, nCount = pItem->GetChildCount();
			for(i = 0; i < nCount; i++)
			{
				PLIST_ITEM pChild = pItem->GetChildAt(i);
				AddListItem(pChild);
			}
		}
	}

	return nPos;
}
示例#26
0
// CAddPackDlg 消息处理程序
BOOL CAddPackRuleDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  在此添加额外的初始化

	if(!AddListItem())	return FALSE;
	int nRow = 0;
	map<string,PACKRULEFILE>::iterator pPackInfo = CGlobalData::m_mapPackRuleFileInfo.begin();
	for(;pPackInfo != CGlobalData::m_mapPackRuleFileInfo.end(); ++pPackInfo)
	{
		AddListInfo(&(pPackInfo->second),nRow);
		nRow++;
	}
// 	m_ComboxBox.AddString(_T("UTF8"));
// 	m_ComboxBox.AddString(_T("URL GB2312"));
// 	m_ComboxBox.AddString(_T("URL UTF8"));
// 	m_ComboxBox.AddString(_T("%25 UTF8"));
	m_ComboxBox.AddString(_T("U-"));
	m_ComboxBox.AddString(_T("U-G"));
	m_ComboxBox.AddString(_T("U-U"));
	m_ComboxBox.AddString(_T("U-G-U"));
	return TRUE;  // return TRUE unless you set the focus to a control
}
示例#27
0
文件: main.cpp 项目: cdaze/akt
bool Initialize(HWND hwndDlg)
{
    HANDLE hFile=CreateFileA(dll_dump, GENERIC_ALL, 0, 0, OPEN_EXISTING, 0, 0);
    if(hFile==INVALID_HANDLE_VALUE)
        return false;

    DWORD high=0;
    security_code_size=GetFileSize(hFile, &high);
    security_code_mem=(BYTE*)malloc(security_code_size);
    if(!ReadFile(hFile, security_code_mem, security_code_size, &high, 0))
    {
        CloseHandle(hFile);
        free(security_code_mem);
        return false;
    }
    CloseHandle(hFile);
    md5_replace_addr=FindMd5ReplaceAddr(security_code_mem, security_code_size);
    cert_function_addr=FindCertificateFunction(security_code_mem, security_code_size);
    if(!cert_function_addr)
        return false;
    AddListItem(hwndDlg, "Drag&Drop a .akt file to get started...");
    SendDlgItemMessageA(hwndDlg, IDC_LIST_CERTS, CB_SETCURSEL, 0, 0);
    return true;
}
示例#28
0
void add_pending_net(aClient *sptr, char *str)
{
aPendingNet *e = NULL;
int num = 1;
char *p, *name;

	if (BadPtr(str) || !sptr)
		return;

	/* First, count them */
	for (p = str; *p; p++)
		if (*p == ',')
			num++;
	
	/* Allocate */
	e = MyMallocEx(sizeof(aPendingNet) + (sizeof(int) * num));
	
	e->numservers = num;
	e->sptr = sptr;

	/* Fill in */
	num = 0;
	for (name = strtoken(&p, str, ","); name; name = strtoken(&p, NULL, ","))
	{
		if (!*name)
			continue;

		/* skip any non-digit prefixes, if necessary. Possibly needed in the future. */
		while (*name && !isdigit(*name))
			name++; 

		e->servers[num++] = atoi(name);
	}
	
	AddListItem(e, pendingnet);
}
示例#29
0
/* Routine that actually makes a user join the channel
 * this does no actual checking (banned, etc.) it just adds the user
 */
DLLFUNC void _join_channel(aChannel *chptr, aClient *cptr, aClient *sptr, int flags)
{
    char *parv[] = { 0, 0 };
    /*
       **  Complete user entry to the new channel (if any)
     */
    add_user_to_channel(chptr, sptr, flags);
    /*
       ** notify all other users on the new channel
     */
    if (chptr->mode.mode & MODE_AUDITORIUM)
    {
        if (MyClient(sptr))
            sendto_one(sptr, ":%s!%s@%s JOIN :%s",
                       sptr->name, sptr->user->username,
                       GetHost(sptr), chptr->chname);
        sendto_chanops_butone(NULL, chptr, ":%s!%s@%s JOIN :%s",
                              sptr->name, sptr->user->username,
                              GetHost(sptr), chptr->chname);
    }
    else
        sendto_channel_butserv(chptr, sptr,
                               ":%s JOIN :%s", sptr->name, chptr->chname);

    sendto_serv_butone_token_opt(cptr, OPT_NOT_SJ3, sptr->name, MSG_JOIN,
                                 TOK_JOIN, "%s", chptr->chname);

#ifdef JOIN_INSTEAD_OF_SJOIN_ON_REMOTEJOIN
    if ((MyClient(sptr) && !(flags & CHFL_CHANOP)) || !MyClient(sptr))
        sendto_serv_butone_token_opt(cptr, OPT_SJ3, sptr->name, MSG_JOIN,
                                     TOK_JOIN, "%s", chptr->chname);
    if (flags && !(flags & CHFL_DEOPPED))
    {
#endif
        /* I _know_ that the "@%s " look a bit wierd
           with the space and all .. but its to get around
           a SJOIN bug --stskeeps */
        sendto_serv_butone_token_opt(cptr, OPT_SJ3|OPT_SJB64,
                                     me.name, MSG_SJOIN, TOK_SJOIN,
                                     "%B %s :%s%s ", (long)chptr->creationtime,
                                     chptr->chname, chfl_to_sjoin_symbol(flags), sptr->name);
        sendto_serv_butone_token_opt(cptr, OPT_SJ3|OPT_NOT_SJB64,
                                     me.name, MSG_SJOIN, TOK_SJOIN,
                                     "%li %s :%s%s ", chptr->creationtime,
                                     chptr->chname, chfl_to_sjoin_symbol(flags), sptr->name);
#ifdef JOIN_INSTEAD_OF_SJOIN_ON_REMOTEJOIN
    }
#endif

    if (MyClient(sptr))
    {
        /*
           ** Make a (temporal) creationtime, if someone joins
           ** during a net.reconnect : between remote join and
           ** the mode with TS. --Run
         */
        if (chptr->creationtime == 0)
        {
            chptr->creationtime = TStime();
            sendto_serv_butone_token(cptr, me.name,
                                     MSG_MODE, TOK_MODE, "%s + %lu",
                                     chptr->chname, chptr->creationtime);
        }
        del_invite(sptr, chptr);
        if (flags && !(flags & CHFL_DEOPPED))
        {
#ifndef PREFIX_AQ
            if ((flags & CHFL_CHANOWNER) || (flags & CHFL_CHANPROT))
            {
                /* +ao / +qo for when PREFIX_AQ is off */
                sendto_serv_butone_token_opt(cptr, OPT_NOT_SJ3,
                                             me.name,
                                             MSG_MODE, TOK_MODE, "%s +o%c %s %s %lu",
                                             chptr->chname, chfl_to_chanmode(flags), sptr->name, sptr->name,
                                             chptr->creationtime);
            } else {
#endif
                /* +v/+h/+o (and +a/+q if PREFIX_AQ is on) */
                sendto_serv_butone_token_opt(cptr, OPT_NOT_SJ3,
                                             me.name,
                                             MSG_MODE, TOK_MODE, "%s +%c %s %lu",
                                             chptr->chname, chfl_to_chanmode(flags), sptr->name,
                                             chptr->creationtime);
#ifndef PREFIX_AQ
            }
#endif
        }
        if (chptr->topic)
        {
            sendto_one(sptr, rpl_str(RPL_TOPIC),
                       me.name, sptr->name, chptr->chname, chptr->topic);
            sendto_one(sptr,
                       rpl_str(RPL_TOPICWHOTIME), me.name,
                       sptr->name, chptr->chname, chptr->topic_nick,
                       chptr->topic_time);
        }
        if (chptr->users == 1 && (MODES_ON_JOIN
#ifdef EXTCMODE
                                  || iConf.modes_on_join.extmodes)
#endif
           )
        {
#ifdef EXTCMODE
            int i;
            chptr->mode.extmode =  iConf.modes_on_join.extmodes;
            /* Param fun */
            for (i = 0; i <= Channelmode_highest; i++)
            {
                if (!Channelmode_Table[i].flag || !Channelmode_Table[i].paracount)
                    continue;
                if (chptr->mode.extmode & Channelmode_Table[i].mode)
                {
                    CmodeParam *p;
                    p = Channelmode_Table[i].put_param(NULL, iConf.modes_on_join.extparams[i]);
                    AddListItem(p, chptr->mode.extmodeparam);
                }
            }
#endif
            chptr->mode.mode = MODES_ON_JOIN;
#ifdef NEWCHFLOODPROT
            if (iConf.modes_on_join.floodprot.per)
            {
                chptr->mode.floodprot = MyMalloc(sizeof(ChanFloodProt));
                memcpy(chptr->mode.floodprot, &iConf.modes_on_join.floodprot, sizeof(ChanFloodProt));
            }
#else
            chptr->mode.kmode = iConf.modes_on_join.kmode;
            chptr->mode.per = iConf.modes_on_join.per;
            chptr->mode.msgs = iConf.modes_on_join.msgs;
#endif
            *modebuf = *parabuf = 0;
            channel_modes(sptr, modebuf, parabuf, chptr);
            /* This should probably be in the SJOIN stuff */
            sendto_serv_butone_token(&me, me.name, MSG_MODE, TOK_MODE,
                                     "%s %s %s %lu", chptr->chname, modebuf, parabuf,
                                     chptr->creationtime);
            sendto_one(sptr, ":%s MODE %s %s %s", me.name, chptr->chname, modebuf, parabuf);
        }
        parv[0] = sptr->name;
        parv[1] = chptr->chname;
        do_cmd(cptr, sptr, "NAMES", 2, parv);
        RunHook4(HOOKTYPE_LOCAL_JOIN, cptr, sptr,chptr,parv);
    } else {
        RunHook4(HOOKTYPE_REMOTE_JOIN, cptr, sptr, chptr, parv); /* (rarely used) */
    }

#ifdef NEWCHFLOODPROT
    /* I'll explain this only once:
     * 1. if channel is +f
     * 2. local client OR synced server
     * 3. then, increase floodcounter
     * 4. if we reached the limit AND only if source was a local client.. do the action (+i).
     * Nr 4 is done because otherwise you would have a noticeflood with 'joinflood detected'
     * from all servers.
     */
    if (chptr->mode.floodprot && (MyClient(sptr) || sptr->srvptr->serv->flags.synced) &&
            !IsULine(sptr) && do_chanflood(chptr->mode.floodprot, FLD_JOIN) && MyClient(sptr))
    {
        do_chanflood_action(chptr, FLD_JOIN, "join");
    }
#endif
}
示例#30
0
/* umode_get:
 * Add a usermode with character 'ch', if global is set to 1 the usermode is global
 * (sent to other servers) otherwise it's a local usermode
 */
Umode *UmodeAdd(Module *module, char ch, int global, int (*allowed)(aClient *sptr, int what), long *mode)
{
	short	 i = 0;
	short	 j = 0;
	short 	 save = -1;
	while (i < UMODETABLESZ)
	{
		if (!Usermode_Table[i].flag && save == -1)
			save = i;
		else if (Usermode_Table[i].flag == ch)
		{
			if (Usermode_Table[i].unloaded)
			{
				save = i;
				Usermode_Table[i].unloaded = 0;
				break;
			}
			else
			{
				if (module)
					module->errorcode = MODERR_EXISTS;
				return NULL;
			}
		}
		i++;
	}
	i = save;
	if (i != UMODETABLESZ)
	{
		Usermode_Table[i].flag = ch;
		Usermode_Table[i].allowed = allowed;
		Debug((DEBUG_DEBUG, "umode_get(%c) returning %04x",
			ch, Usermode_Table[i].mode));
		/* Update usermode table highest */
		for (j = 0; j < UMODETABLESZ; j++)
			if (Usermode_Table[i].flag)
				if (i > Usermode_highest)
					Usermode_highest = i;
		make_umodestr();
		AllUmodes |= Usermode_Table[i].mode;
		if (global)
			SendUmodes |= Usermode_Table[i].mode;
		*mode = Usermode_Table[i].mode;
		Usermode_Table[i].owner = module;
		if (module)
		{
			ModuleObject *umodeobj = MyMallocEx(sizeof(ModuleObject));
			umodeobj->object.umode = &(Usermode_Table[i]);
			umodeobj->type = MOBJ_UMODE;
			AddListItem(umodeobj, module->objects);
			module->errorcode = MODERR_NOERROR;
		}
		return &(Usermode_Table[i]);
	}
	else
	{
		Debug((DEBUG_DEBUG, "UmodeAdd failed, no space"));
		if (module)
			module->errorcode = MODERR_NOSPACE;
		return NULL;
	}
}