Пример #1
0
void CBDCApp::UpdateText(CBirthday *pbd)
{
	struct list_entry_t ple;
	trillianListInitialize(ple);
	// Fill new list item structure
	AssignString(&ple.tooltip, pbd->GetTooltip());
	ple.tooltip = (char *)malloc(strlen(pbd->GetTooltip())+1);
	ASSERT(m_pproc);
	if( m_pproc )
	{
		AssignString(&ple.text, pbd->GetText(m_pproc->GetSuffix(), m_pproc->DrawLeftInfo()));
	}
	else
	{
		AssignString(&ple.text, pbd->GetText(SUFFIX_NONE));
	}

	// Set the text and the tooltip
	if( pbd->m_listid_known >= 0 )
	{
		ple.unique_id = pbd->m_listid_known;
		m_plugin_send(MYGUID, "listUpdateText", (void *)&ple);
		m_plugin_send(MYGUID, "listUpdateTooltip", (void *)&ple);
	}
	if( pbd->m_listid_bd >= 0 )
	{
		ple.unique_id = pbd->m_listid_bd;
		m_plugin_send(MYGUID, "listUpdateText", (void *)&ple);
		m_plugin_send(MYGUID, "listUpdateTooltip", (void *)&ple);
	}
	free( ple.tooltip );
	free( ple.text );
}
Пример #2
0
void FillSound(FRSound * Sound, FILE * ConfigFile)
{
	Sound->cache_size = (uint16_t)AssignInteger("cache_size=",ConfigFile);
	Sound->device = (int16_t)AssignInteger("device=",ConfigFile);
	Sound->initialize = (char)AssignInteger("initialize=",ConfigFile);
	Sound->irq = (int16_t)AssignInteger("irq=",ConfigFile);
	Sound->master_volume = (int16_t)AssignInteger("master_volume=",ConfigFile);
	Sound->music = (char)AssignInteger("music=",ConfigFile);
	Sound->music_path1 = AssignString("music_path1=",ConfigFile);
	Sound->music_path2 = AssignString("music_path2=",ConfigFile);
	Sound->music_volume = (int16_t)AssignInteger("music_volume=",ConfigFile);
	Sound->port = (int16_t)AssignInteger("port=",ConfigFile);
	Sound->sndfx_volume = (int16_t)AssignInteger("sndfx_volume=",ConfigFile);
	Sound->sounds = (char)AssignInteger("sounds=",ConfigFile);
	Sound->speech = (char)AssignInteger("speech=",ConfigFile);
	Sound->speech_volume = (int16_t)AssignInteger("speech_volume=",ConfigFile);
}
Пример #3
0
void FillDebug(FRDebug * Debug, FILE * ConfigFile)
{
	Debug->mode = AssignString("mode=",ConfigFile);
	Debug->output_map_data_info = (char)AssignInteger("output_map_data_info=",ConfigFile);
	Debug->show_load_info = (char)AssignInteger("show_load_info=",ConfigFile);
	Debug->show_script_messages = (char)AssignInteger("show_script_messages=",ConfigFile);
	Debug->show_tile_num = (char)AssignInteger("show_tile_num=",ConfigFile);
}
Пример #4
0
void CBDCApp::AddMenu(int id, char* text, menu_entry_t** pmenu_entry, void* pdata)
{
	menu_entry_t** pentry = pmenu_entry;
	while( *pentry != NULL )
	{
		pentry = &(*pentry)->next_menu;
	}

	*pentry = (struct menu_entry_t *)malloc(sizeof(struct menu_entry_t));
	trillianInitialize((**pentry));

	(*pentry)->menu_id = id;
	(*pentry)->type = MENU_TEXT;
	AssignString(&(*pentry)->text, text);
	(*pentry)->callback = ::menuCallback;
	(*pentry)->data = (void*)pdata;
}
Пример #5
0
bool		 
CommandLineParser::ExecuteOption(__CBS *option,char *buff)
{
	
	if(option==NULL)
		return false;

  	int  len=0;
  	bool retval = false;
  	
	
  	if(buff!=NULL)
  	{
  		 len   = strlen(buff)-option->KeyLen;
  		 buff += option->KeyLen;
  	}
  	
	
  	switch(option->CommandType)
  	{
  	case	CT_NOP              :
  			return true;
  	case	CT_USE_FUNCTION 	:
  	case	CT_USE_FUNCTION_NULL:
  			retval = option->Value.ActionFunc(buff,len);
  			break;
  	case	CT_USE_FLAG 		:
  			retval = AssignFlag(option,buff,len);
  		    break;
  	case	CT_USE_INT			:
  			retval = AssignInt(option,buff,len);
  			break;
  	case	CT_USE_FLOAT		:
  			retval = AssignFloat(option,buff,len);
  			break;
  	case	CT_USE_STRING		:
  			retval = AssignString(option,buff,len);
  			break;
  	default:
  		    return false;
  	}
  	
  	return retval;
}
Пример #6
0
void FillSystem(FRSystem * System, FILE * ConfigFile)
{
	System->art_cache_size = (int16_t)AssignInteger("art_cache_size=",ConfigFile);
	System->color_cycling = (char)AssignInteger("color_cycling=",ConfigFile);
	System->critter_dat = AssignString("critter_dat=",ConfigFile);
	System->critter_patches = AssignString("critter_patches=",ConfigFile);
	System->cycle_speed_factor = (char)AssignInteger("cycle_speed_factor=",ConfigFile);
	System->executable = AssignString("executable=",ConfigFile);
	System->free_space = (uint32_t)AssignInteger("free_space=",ConfigFile);
	System->hashing = (char)AssignInteger("hashing=",ConfigFile);
	System->interrupt_walk = (char)AssignInteger("interrupt_walk=",ConfigFile);
	System->language = AssignString("language=",ConfigFile);
	System->master_dat = AssignString("master_dat=",ConfigFile);
	System->master_patches = AssignString("master_patches=",ConfigFile);
	System->scroll_lock = (char)AssignInteger("scroll_lock=",ConfigFile);
	System->splash = (char)AssignInteger("splash=",ConfigFile);
	System->times_run = (char)AssignInteger("times_run=",ConfigFile);
}
Пример #7
0
int CBDCApp::main(char *event, void *data)
{
	if( !_stricmp(event,"load") )
	{ 
	   struct plugin_info_t *pi = (struct plugin_info_t *)data;

	   if( pi )
	   {
			// Fill in plugin information
			strcpy_s(pi->guid, MYGUID); 
			strcpy_s(pi->name, "Birthday Calendar"); 
			strcpy_s(pi->company, "Totaal Software"); 
			strcpy_s(pi->version, VERSION); 
			strcpy_s(pi->description, "Keep track of your friends' birthdays.");
         
			// Extract what we need and store locally
			m_plugin_send = pi->plugin_send;
			m_homedir = CString( pi->config_directory );
	   }
	}
	else if( !_stricmp(event, "initialLoad"))
	{
		// First time a plugin is loaded
		// Can do install wizardish stuff here
	}
	else if( !_stricmp(event, "start") )
	{
		// Initialize
		if (m_pbmpListentry_vcf == NULL)
			m_pbmpListentry_vcf = LoadBitmap(m_hInstance, MAKEINTRESOURCE(IDB_VCF));
		if (m_pbmpListentry_wab == NULL)
			m_pbmpListentry_wab = LoadBitmap(m_hInstance, MAKEINTRESOURCE(IDB_WAB));
		if (m_pbmpListentry_bd == NULL)
			m_pbmpListentry_bd = LoadBitmap(m_hInstance, MAKEINTRESOURCE(IDB_BALLOONS));
		if (m_pbmpListentry_bd_confirmed == NULL)
			m_pbmpListentry_bd_confirmed = LoadBitmap(m_hInstance, MAKEINTRESOURCE(IDB_BALLOONS_CONFIRMED));
		if (m_pbmpListentry_known == NULL)
			m_pbmpListentry_known = LoadBitmap(m_hInstance, MAKEINTRESOURCE(IDB_BALLOONS_KNOWN));
		if (m_pbmpListentry_today == NULL)
			m_pbmpListentry_today = LoadBitmap(m_hInstance, MAKEINTRESOURCE(IDB_TODAY));
		if (m_pproc == NULL)
			m_pproc = new CProcessor(m_homedir,this);

		struct plugin_prefs_t pp;
		trillianInitialize(pp);
		// Initialize preferences.
		pp.enabled		= 1;
		pp.pref_name	= "Birthday Calendar"; 
		pp.sub_entry	= NULL; 
		m_plugin_send(MYGUID, "prefsInitialize", &pp); 

		// Populate contact list

		// Add the main section.
		{
			struct list_entry_t ple; 
			trillianListInitialize(ple);
			ple.previous_id		= -2;	// This controls placement of new entry, before (-2) or last (-1)
			ple.section			= 1;	// This is a section
			ple.expanded		= 1;	
			ple.tooltip			= "Birthday Calendar";
			ple.text			= "Birthdays";
			ple.real_name		= "birthdays";
			int i=m_plugin_send(MYGUID, "listAddEntry", (void *)&ple); 
				
			// Set our global sectionID for later. Note that we get the
			// sectionID from the structure after it's been populated
			m_sectionID = ple.section_id;
		}

		// Add the 'known' group
		// Flip section/group around
		// Group ID is the RETURN value, not in struct
		{
			struct list_entry_t ple; 
			trillianListInitialize(ple);
			ple.group			= 1;
			ple.section			= 0;
			ple.tooltip			= "Known Birthdays";
			ple.text			= "Known Birthdays"; 
			ple.section_id		= m_sectionID;

			// menu item: "ADD"
			ple.menu_entry = (struct menu_entry_t *)malloc(sizeof(struct menu_entry_t));
			trillianInitialize((*ple.menu_entry));
			
			ple.menu_entry->menu_id = MENU_ADD;
			ple.menu_entry->type = MENU_TEXT;
			AssignString(&ple.menu_entry->text, "&Add...");
			ple.menu_entry->callback = ::menuCallback;

			m_knowngroupID = m_plugin_send(MYGUID, "listAddEntry", (void *)&ple);

			free(ple.menu_entry->text);
			free(ple.menu_entry);
		}

		ASSERT(m_pproc);
		if( m_pproc )
		{
			m_pproc->PopulateKnowns();
			m_pproc->ProcessAction();
		}
	}
	else if( !_stricmp(event,"stop") && m_plugin_send )
	{
		// Remove list items
		ASSERT(m_pproc);
		if( m_pproc )
			m_pproc->DepopulateKnowns();
		// Remove the 'known' group
		{
			struct list_entry_t ple;
			trillianListInitialize(ple);
			ple.unique_id = m_knowngroupID;
			ple.section_id = -1;
			ple.parent_id = -1;
			ple.previous_id = -1;
			m_plugin_send(MYGUID, "listRemoveEntry", (void *)&ple);
		}
		// Remove the section
		{
			struct list_entry_t ple;
			trillianListInitialize(ple);
			ple.unique_id = -1;
			ple.section_id = m_sectionID;
			ple.parent_id = -1;
			ple.previous_id = -1;
			m_plugin_send(MYGUID, "listRemoveEntry", (void *)&ple);
		}
		// Clear up some variables
		if(m_pbmpListentry_vcf)
		{
			DeleteObject(m_pbmpListentry_vcf);
			m_pbmpListentry_vcf = NULL;
		}
		if(m_pbmpListentry_wab)
		{
			DeleteObject(m_pbmpListentry_wab);
			m_pbmpListentry_wab = NULL;
		}
		if(m_pbmpListentry_bd)
		{
			DeleteObject(m_pbmpListentry_bd);
			m_pbmpListentry_bd = NULL;
		}
		if(m_pbmpListentry_bd_confirmed)
		{
			DeleteObject(m_pbmpListentry_bd_confirmed);
			m_pbmpListentry_bd_confirmed = NULL;
		}
		if(m_pbmpListentry_known)
		{
			DeleteObject(m_pbmpListentry_known);
			m_pbmpListentry_known = NULL;
		}
		if(m_pbmpListentry_today)
		{
			DeleteObject(m_pbmpListentry_today);
			m_pbmpListentry_today = NULL;
		}
		if(m_pproc)
		{
			delete m_pproc;
			m_pproc = NULL;
		}
	}
	else if( !_stricmp(event, "unload") )
	{
		m_plugin_send = NULL;
	}
	else if( !_stricmp(event, "prefsShow") )
	{
		struct plugin_prefs_show_t	*pps = (struct plugin_prefs_show_t *)data;

		// Trillian is telling us to show our preferences
		// dialog do so only if we find our name

		if( !strcmp(pps->pref_name, "Birthday Calendar") )
		{
			int prefDialog();

			strcpy_s(pps->prefs_info.name, "Birthday Calendar");
			strcpy_s(pps->prefs_info.description, "Keep track of your friends' birthdays.");
			pps->prefs_info.bitmap = LoadBitmap(m_hInstance, MAKEINTRESOURCE(IDB_PREFSLOGO));

			if( pps->show==1 )
			{
				if( m_prefswnd==NULL )
				{
					struct dialog_entry_t det;
					trillianInitialize(det);						
					det.hwnd = CreateDialog(m_hInstance, MAKEINTRESOURCE(IDD_PREFS_DIALOG), pps->hwnd, (DLGPROC)::prefDialog);
					m_plugin_send(MYGUID, "dialogAdd", &det);   
					m_prefswnd = det.hwnd;

					SetWindowPos(m_prefswnd, 0, pps->x, pps->y, 0, 0, SWP_NOSIZE | SWP_NOZORDER);

					ASSERT(m_pproc);
					if( m_pproc )
						m_pproc->PrefsShow(m_prefswnd);
				}
				ShowWindow(m_prefswnd, SW_SHOW);
			}	else
			if( pps->show==0 )
			{
				if( m_prefswnd!=NULL )
					ShowWindow(m_prefswnd, SW_HIDE);
			}
		}
	}
	else if( !_stricmp(event, "prefsAction") )
	{
		struct plugin_prefs_action_t *ppa
			= (struct plugin_prefs_action_t *)data;

		// Take action:
		// 0 - Cancel
		// 1 - Apply
		// 2 - OK

		if( ppa->type==0 )
		{
			if( m_prefswnd!=NULL )
			{
				struct dialog_entry_t det;
				trillianInitialize( det );
				det.hwnd = m_prefswnd;
				m_plugin_send(MYGUID, "dialogRemove", &det);
				DestroyWindow(m_prefswnd);
				m_prefswnd = NULL;
			}
		}
		if( (ppa->type==1) || (ppa->type==2) )
		{
			ASSERT(m_pproc);
			if( m_prefswnd && m_pproc )
			{
				m_pproc->PrefsAction(m_prefswnd);
			}
		}
		if( ppa->type==2 )
		{
			if( m_prefswnd!=NULL )
			{
				struct dialog_entry_t det;
				trillianInitialize( det );
				det.hwnd = m_prefswnd;
				m_plugin_send(MYGUID, "dialogRemove", &det);
				DestroyWindow(m_prefswnd);
				m_prefswnd = NULL;
			}
		}		
	}

	return 0; 
}
Пример #8
0
void CBDCApp::DrawBirthday(CBirthday *pbd)
{
	struct list_entry_t ple;

	trillianListInitialize(ple);

	ple.previous_id		= -2; 
	ple.section_id		= m_sectionID;
	ple.unique_id		= -1; 
	ple.group			= 0;
	ple.section			= 0; 
	ple.inline_editing	= 0;
	ple.drag_and_drop	= 0; 
	ple.expanded		= 1; 
	ple.callback		= ::listCallback;

	AssignString(&ple.tooltip, pbd->GetTooltip());
	ASSERT(m_pproc);
	if( m_pproc )
	{
		AssignString(&ple.text, pbd->GetText(m_pproc->GetSuffix(), m_pproc->DrawLeftInfo()));
	}
	else
	{
		AssignString(&ple.text, pbd->GetText(SUFFIX_NONE));
	}

	ple.data			= (void*)pbd;

	// icon
	MakeIconLeft( &ple, pbd->m_confirmed?1:0);

	// right icon
	MakeIconRight( &ple, pbd->m_medium);

	if(pbd->m_date.IsDateOfYear())
	{
		ple.font.flags = 0x1;
		ple.font.skin_name = "recent-online";
		ple.font.select_fore = "recent-online-fore";
		ple.font.hover_fore = "recent-online-fore";
		ple.font.normal_fore = "recent-online-fore";
	}

	AddMenu(MENU_EDIT, "&Edit...", &ple.menu_entry, pbd);
	AddMenu(MENU_CONFIRM, "&Confirm...", &ple.menu_entry, pbd);
	AddMenu(MENU_REMOVE, "&Remove...", &ple.menu_entry, pbd);

	if( pbd->m_medium == MEDIUM_ICQ )
	{
		AddMenu(MENU_RELOAD, "&Reload...", &ple.menu_entry, pbd);
	}

	// You'll need the UniqueID for any further manipulation, so store it somewhere nice
	pbd->m_listid_bd = m_plugin_send(MYGUID, "listAddEntry", (void *)&ple);

	// Free what needs to be freed
	FreeMenus(&ple.menu_entry);
	free(ple.text);
	free(ple.tooltip);
	FreeIcons(&ple);
}
Пример #9
0
void CBDCApp::DrawKnown(CBirthday *pbd, bool bSorted/*=true*/)
{
	struct list_entry_t ple;

	trillianListInitialize(ple);

	ple.section_id		= m_sectionID;
	ple.parent_id		= m_knowngroupID;
	ple.unique_id		= -1; 
	ple.group			= 0;
	ple.section			= 0; 
	ple.inline_editing	= 0;
	ple.drag_and_drop	= 0; 
	ple.expanded		= 1; 
	ple.callback		= ::listCallback;

	ASSERT( m_pproc );
	if( bSorted && m_pproc )
		ple.previous_id	= m_pproc->GetPreviousID(pbd);
	else
		ple.previous_id	= -1;

	AssignString(&ple.tooltip, pbd->GetTooltip());
	ASSERT(m_pproc);
	if( m_pproc )
	{
		AssignString(&ple.text, pbd->GetText(m_pproc->GetSuffix(), m_pproc->DrawLeftInfo()));
	}
	else
	{
		AssignString(&ple.text, pbd->GetText(SUFFIX_NONE));
	}

	ple.data			= (void*)pbd;

	// left icon
	ple.left_icons		= (struct list_bmp_t *)malloc(sizeof(struct list_bmp_t));
	trillianInitialize((*ple.left_icons));
	
	ple.left_icons->num_states	= 1;

	ple.left_icons->bitmap		= (HBITMAP *)malloc(sizeof(HBITMAP));
	ple.left_icons->bitmap[0]	= m_pbmpListentry_known;

	ple.left_icons->location	= (RECT *)malloc(sizeof(RECT));
	ple.left_icons->location[0].left	=  0;
	ple.left_icons->location[0].top		=  0;
	ple.left_icons->location[0].bottom	= 18;
	ple.left_icons->location[0].right	= 18;

	ple.num_left_icons = 1;

	// right icon
	MakeIconRight( &ple,
		pbd->m_medium);

	AddMenu(MENU_ADD, "&Add...", &ple.menu_entry);
	AddMenu(MENU_EDIT, "&Edit...", &ple.menu_entry, pbd);
	AddMenu(MENU_REMOVE, "&Remove...", &ple.menu_entry, pbd);

	if( pbd->m_medium == MEDIUM_ICQ )
	{
		AddMenu(MENU_RELOAD, "Re&load...", &ple.menu_entry, pbd);
	}

	// You'll need the UniqueID for any further manipulation, so store it somewhere nice
	pbd->m_listid_known = m_plugin_send(MYGUID, "listAddEntry", (void *)&ple); 

	FreeMenus(&ple.menu_entry);
	free(ple.text);
	free(ple.tooltip);
	FreeIcons(&ple);
}
void    String::operator = (const char* pstr)
{
    AssignString(pstr, pstr ? OVR_strlen(pstr) : 0);
}
Пример #11
0
void    String::StripProtocol()
{
    const char* protocol = ScanPathProtocol(ToCStr());
    if (protocol)
        AssignString(protocol, OVR_strlen(protocol));
}