help me to create enigma plugin done

this class ok

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
void Fetcher::fetch()
{	
  	// declare variable
	eString url, code;
    code = mytext->getText();
	// assign to the variable the url we want to connect
	url = "http://www.host.com/activate.php?actvcode="+code;
	// assign to class variable the temporary file we will use to store the dowanloaded data
	tempPath = "/var/tmp/bdemo.sh";
	// inizialize the control error flag
	int error = 0;
	// start connection
	connectionP = eHTTPConnection::doRequest(url.c_str(), eApp, &error);
	//Show a Messagebox in case of connection error
	if(!connectionP || error)
	{	eMessageBox msg("Error Activation " + url + "(" + eString().sprintf("%d", error) + ")", _("Details"), eMessageBox::btOK);
		msg.show();     msg.exec();     msg.hide();
	}
	else
	{
		//if the connection is estabilished start the download funcions
		CONNECT(connectionP->transferDone, Fetcher::transferDone);
		CONNECT(connectionP->createDataSource, Fetcher::createDownloadSink);
		// set the user-agent name
		connectionP->local_header["User-Agent"] = "PLBOT";
		connectionP->start();
	}
}

void Fetcher::transferDone(int err)
{	
	// If no error we can call the downloadDone function
	if(!err)
	{	connectionP = NULL;
		// Tell caller download is ready
		/*emit*/ downloadDone(err);
	}
	else
	{
		//else show a Messagebox with Error description.
		eString sMsg = "Error " + eString().sprintf("%d", err);
		eMessageBox msg(sMsg, _("User Abort"), eMessageBox::iconWarning|eMessageBox::btOK);
		msg.show();     msg.exec();     msg.hide();
	}
}
// internal download procedure (standard)
eHTTPDataSource * Fetcher::createDownloadSink(eHTTPConnection *conn)
{	dataSinkP = new eHTTPDownload(connectionP, (char *)tempPath.c_str());

	return(dataSinkP);


ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ


When I put the code inside the text box and click I operate fully activate the code and the code but I want plugin news was the activation and the property is in the script when you put the code and tell me that he was activation but How do I add this feature on cpp script to tell sucsses or wrong in this class

i want link with url php if download done or not
101 Account is Active
102 No Code
103 Wrong Code
104 Expired Code

where's location in this class downloadDone

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
void eBibleMainWindow::downloadDone(int err)
{
	// set the flag that indicates that download is complete
	if(!downloadDoneFlag)
	{	downloadDoneFlag = 1;
		// create a buffer to read the temp file with download data.
		char buf[512];
		// declare the variables we will use in this function
		eString strview, strview1;
		// open temporary file cotaining the downloaded data 
  		FILE *f = fopen("/var/tmp/bdemo.tmp", "w+");
   		if (f)
   		{
			//Add an introduction text
			strview = "";
			// find the line we want (The mkportal definition in the wiki page we downloaded)
			while (fgets(buf, 512, f))
     		{
				if (strstr(buf, ""))
				break;
			}
			// store this line in the variable
			strview1 = eString(buf);
			// remove html tags
			strview1 = removeTags(strview1);
			//  concate strings to compose our output text
			strview += strview1;
			// read the next lines .....
      		while (fgets(buf, 512, f))
      		{
			// if we found this string the defnition is ended so we can stop to read the file
				if (strstr(buf, ""))
				break;
			// else store the line in the variable
				strview1 = eString(buf);
			// remove html tags
				strview1 = removeTags(strview1);
			//  concate strings to compose our output text
				strview += strview1; 
      		}
			// close file
      		fclose(f);
   		}
		//Delete the temporary file we used to store downloaded data
   		::unlink("/var/tmp/bdemo.tmp");
		// Hide label to change the text
		label->hide();
		// Insert into the label the output we have stored in the variable strview
		label->setText(strview);
		// Show the label with the new text
		label->show();
		// hide the connection button
		ok->hide();
		// set the flag that indicates we are not in download state anymore
		inDownloadFlag = 0;

	}

}



Last edited on
any one to help plz!!!
help me plz
Line 11...looks like you are saving the result to a file. Just open the file to get the code...and don't delete it like on line 45
Last edited on
Topic archived. No new replies allowed.