- Librerias que tiene Javy

This commit is contained in:
2024-04-02 14:30:18 -06:00
parent d5c73471f8
commit 6509580779
54 changed files with 15917 additions and 0 deletions

638
B4A/Net.xml Normal file
View File

@@ -0,0 +1,638 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<doclet-version-NOT-library-version>1.04</doclet-version-NOT-library-version>
<class>
<name>anywheresoftware.b4a.net.SMTPWrapper</name>
<shortname>SMTP</shortname>
<comment>SMTP object allows you to send emails with no user intervention and without relying on the device installed mail clients.
Both text messages and Html messages are supported as well as file attachments.
There are two encryption modes supported: UseSSL and StartTLSMode.
UseSSL means that the connection will be based on a SSL connection right from the start.
StartTLSMode means that the connection will only be upgraded to SSL after the client send the STARTTLS command. Most SMTP servers support this mode.
Gmail for example supports both modes. UseSSL on port 465 and StartTLSMode on port 587.
Example:&lt;code&gt;
Sub Process_Globals
Dim SMTP As SMTP
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
SMTP.Initialize("smtp.gmail.com", 587, "example@gmail.com", "mypassword", "SMTP")
SMTP.StartTLSMode = True
End If
SMTP.To.Add("othermail@example.com")
SMTP.Subject = "This is the subject"
SMTP.Body = "This is the message body."
SMTP.AddAttachment(File.DirRootExternal, "somefile")
SMTP.Send
End Sub
Sub SMTP_MessageSent(Success As Boolean)
Log(Success)
If Success Then
ToastMessageShow("Message sent successfully", True)
Else
ToastMessageShow("Error sending message", True)
Log(LastException.Message)
End If
End Sub&lt;/code&gt;</comment>
<owner>process</owner>
<event>MessageSent(Success As Boolean)</event>
<permission>android.permission.INTERNET</permission>
<method>
<name>Send</name>
<comment>Sends the message. The MessageSent event will be raised after the message was sent.
Note that the message fields are cleared after this method to allow you to send new messages with the same object.</comment>
<returntype>void</returntype>
<parameter>
<name>ba</name>
<type>anywheresoftware.b4a.BA</type>
</parameter>
</method>
<method>
<name>Initialize</name>
<comment>Initializes the object.
Server - Server address. Host name or Ip.
Port - Mail server port.
Username - Account user name.
Password - Account password.
EventName - The name of the sub that will handle the MessageSent event.</comment>
<returntype>void</returntype>
<parameter>
<name>Server</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>Port</name>
<type>int</type>
</parameter>
<parameter>
<name>Username</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>Password</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>EventName</name>
<type>java.lang.String</type>
</parameter>
</method>
<method>
<name>AddAttachment</name>
<comment>Adds a file attachment.</comment>
<returntype>void</returntype>
<parameter>
<name>Dir</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>FileName</name>
<type>java.lang.String</type>
</parameter>
</method>
<property>
<name>UseSSL</name>
<returntype>boolean</returntype>
<parameter>
<name>b</name>
<type>boolean</type>
</parameter>
<comment>Gets or sets whether the connection should be done with SSL sockets.</comment>
</property>
<property>
<name>BCC</name>
<returntype>anywheresoftware.b4a.objects.collections.List</returntype>
<parameter>
<name>BCC</name>
<type>anywheresoftware.b4a.objects.collections.List</type>
</parameter>
<comment>Gets or sets the list of "BCC" recipients.</comment>
</property>
<property>
<name>Body</name>
<returntype>java.lang.String</returntype>
<parameter>
<name>text</name>
<type>java.lang.String</type>
</parameter>
<comment>Gets or sets the message body.</comment>
</property>
<property>
<name>Subject</name>
<returntype>java.lang.String</returntype>
<parameter>
<name>text</name>
<type>java.lang.String</type>
</parameter>
<comment>Gets or sets the message subject.</comment>
</property>
<property>
<name>HtmlBody</name>
<returntype>boolean</returntype>
<parameter>
<name>b</name>
<type>boolean</type>
</parameter>
<comment>Gets or sets whether this message body is Html text.</comment>
</property>
<property>
<name>CC</name>
<returntype>anywheresoftware.b4a.objects.collections.List</returntype>
<parameter>
<name>CC</name>
<type>anywheresoftware.b4a.objects.collections.List</type>
</parameter>
<comment>Gets or sets the list of "CC" recipients.</comment>
</property>
<property>
<name>To</name>
<returntype>anywheresoftware.b4a.objects.collections.List</returntype>
<parameter>
<name>To</name>
<type>anywheresoftware.b4a.objects.collections.List</type>
</parameter>
<comment>Gets or sets the list of "To" recipients.
Example:&lt;code&gt;SMTP.To.Add("email@example.com")&lt;/code&gt;</comment>
</property>
<property>
<name>AuthMethod</name>
<returntype EnumType="true">org.apache.commons.net.smtp.AuthenticatingSMTPClient.AUTH_METHOD</returntype>
<parameter>
<name>m</name>
<type EnumType="true">org.apache.commons.net.smtp.AuthenticatingSMTPClient.AUTH_METHOD</type>
</parameter>
<comment>Gets or sets the SMTP AUTH method. Default value is PLAIN.</comment>
</property>
<property>
<name>StartTLSMode</name>
<returntype>boolean</returntype>
<parameter>
<name>b</name>
<type>boolean</type>
</parameter>
<comment>Gets or sets whether the connection should be done in StartTLS mode.</comment>
</property>
<field>
<name>Sender</name>
<comment>Gets or sets the Sender field. By default it is the same as the Username.</comment>
<returntype>java.lang.String</returntype>
</field>
<field>
<name>AUTH_LOGIN</name>
<comment></comment>
<returntype EnumType="true">org.apache.commons.net.smtp.AuthenticatingSMTPClient.AUTH_METHOD</returntype>
</field>
<field>
<name>AUTH_CRAM_MD5</name>
<comment></comment>
<returntype EnumType="true">org.apache.commons.net.smtp.AuthenticatingSMTPClient.AUTH_METHOD</returntype>
</field>
<field>
<name>AUTH_PLAIN</name>
<comment></comment>
<returntype EnumType="true">org.apache.commons.net.smtp.AuthenticatingSMTPClient.AUTH_METHOD</returntype>
</field>
</class>
<class>
<name>anywheresoftware.b4a.net.POPWrapper</name>
<shortname>POP3</shortname>
<comment>POP3 object allows you to connect to mail servers and read the mail messages.
This object returns the raw string of each message, including the headers. Parsing the raw string is currently out of the scope of this library.
The connection is established when it is first required.
ListCompleted event passes a parameter named Messages. This is a map with the messages IDs as keys and the messages sizes as values.
DownloadCompleted event passes the message raw string in the Message parameter.
Example:&lt;code&gt;
Sub Process_Globals
Dim POP As POP3
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
POP.Initialize("pop.gmail.com", 995, "example@gmail.com", "mypassword", "pop")
POP.UseSSL = True 'Gmail requires SSL.
End If
POP.ListMessages
End Sub
Sub POP_ListCompleted (Success As Boolean, Messages As Map)
Log("List: " &amp; Success)
If Success Then
For i = 0 To Messages.Size - 1
Pop.DownloadMessage(Messages.GetKeyAt(i), True) 'Download all messages and delete them
Next
Else
Log(LastException.Message)
End If
POP.Close 'The connection will be closed after all messages are downloaded
End Sub
Sub POP_DownloadCompleted (Success As Boolean, MessageId As Int, Message As String)
Log("Download: " &amp; Success &amp; ", " &amp; MessageId)
If Success Then
Log(Message)
Log(Message.Length)
Log(MessageId)
Else
Log(LastException.Message)
End If
End Sub&lt;/code&gt;</comment>
<owner CheckForReinitialize="true">process</owner>
<event>ListCompleted (Success As Boolean, Messages As Map)</event>
<event>DownloadCompleted (Success As Boolean, MessageId As Int, Message As String)</event>
<event>StatusCompleted (Success As Boolean, NumberOfMessages As Int, TotalSize As Int)</event>
<permission>android.permission.INTERNET</permission>
<method>
<name>Initialize</name>
<comment>Initializes the object.
Server - Server address. Host name or Ip.
Port - Mail server port.
Username - Account user name.
Password - Account password.
EventName - The name of the sub that will handle the MessageSent event.</comment>
<returntype>void</returntype>
<parameter>
<name>Server</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>Port</name>
<type>int</type>
</parameter>
<parameter>
<name>Username</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>Password</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>EventName</name>
<type>java.lang.String</type>
</parameter>
</method>
<method>
<name>Status</name>
<comment>Gets the mailbox status. The StatusCompleted event will be raised when the request is completed with the number of messages and the total size.</comment>
<returntype>void</returntype>
<parameter>
<name>ba</name>
<type>anywheresoftware.b4a.BA</type>
</parameter>
</method>
<method>
<name>Close</name>
<comment>Closes the connection after all submitted tasks finish. Note that this method do not block.</comment>
<returntype>void</returntype>
</method>
<method>
<name>DownloadMessageTop</name>
<comment>Calls the server and downloads the top number of lines from the message. When the message is ready the DownloadedCompleted event is raised.
MessageId - The message id which was previously retrieved by calling ListMessages.
NumberOfLines - Maximum number of lines to read from the message.
Delete - Whether to delete the message after it is downloaded. Note that the message will only be deleted after the connection is closed.</comment>
<returntype>void</returntype>
<parameter>
<name>ba</name>
<type>anywheresoftware.b4a.BA</type>
</parameter>
<parameter>
<name>MessageId</name>
<type>int</type>
</parameter>
<parameter>
<name>NumberOfLines</name>
<type>int</type>
</parameter>
<parameter>
<name>Delete</name>
<type>boolean</type>
</parameter>
</method>
<method>
<name>DownloadMessage</name>
<comment>Calls the server and downloads a message. When the message is ready the DownloadedCompleted event is raised.
MessageId - The message id which was previously retrieved by calling ListMessages.
Delete - Whether to delete the message after it is downloaded. Note that the message will only be deleted after the connection is closed.</comment>
<returntype>void</returntype>
<parameter>
<name>ba</name>
<type>anywheresoftware.b4a.BA</type>
</parameter>
<parameter>
<name>MessageId</name>
<type>int</type>
</parameter>
<parameter>
<name>Delete</name>
<type>boolean</type>
</parameter>
</method>
<method>
<name>ListMessages</name>
<comment>Calls the server and when data is ready raises the ListCompleted event.
See the example described above.</comment>
<returntype>void</returntype>
<parameter>
<name>ba</name>
<type>anywheresoftware.b4a.BA</type>
</parameter>
</method>
<method>
<name>CloseNow</name>
<comment>Closes the connection immediately without waiting for current tasks to finish.</comment>
<returntype>void</returntype>
</method>
<method>
<name>IsInitialized</name>
<comment></comment>
<returntype>boolean</returntype>
</method>
<property>
<name>UseSSL</name>
<returntype>boolean</returntype>
<parameter>
<name>b</name>
<type>boolean</type>
</parameter>
<comment>Gets or sets whether the connection should be done with SSL sockets.</comment>
</property>
</class>
<class>
<name>anywheresoftware.b4a.net.FTPWrapper</name>
<shortname>FTP</shortname>
<comment>FTP allows you to communicate with FTP servers.
See &lt;link&gt;FTP tutorial|http://www.basic4ppc.com/forum/basic4android-getting-started-tutorials/10407-android-ftp-tutorial.html&lt;/link&gt; for more information.</comment>
<owner CheckForReinitialize="true">process</owner>
<event>DownloadCompleted (ServerPath As String, Success As Boolean)</event>
<event>DownloadProgress (ServerPath As String, TotalDownloaded As Long, Total As Long)</event>
<event>UploadCompleted (ServerPath As String, Success As Boolean)</event>
<event>UploadProgress (ServerPath As String, TotalUploaded As Long, Total As Long)</event>
<event>DeleteCompleted (ServerPath As String, Success As Boolean)</event>
<event>CommandCompleted (Command As String, Success As Boolean, ReplyCode As Int, ReplyString As String)</event>
<event>ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)</event>
<permission>android.permission.INTERNET</permission>
<method>
<name>Initialize</name>
<comment>Initializes the object and sets the subs that will handle the events</comment>
<returntype>void</returntype>
<parameter>
<name>ba</name>
<type>anywheresoftware.b4a.BA</type>
</parameter>
<parameter>
<name>EventName</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>Host</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>Port</name>
<type>int</type>
</parameter>
<parameter>
<name>User</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>Password</name>
<type>java.lang.String</type>
</parameter>
</method>
<method>
<name>DeleteFile</name>
<comment>Deletes a file from the server.
The DeleteCompleted event will be raised when this task completes.</comment>
<returntype>void</returntype>
<parameter>
<name>ba</name>
<type>anywheresoftware.b4a.BA</type>
</parameter>
<parameter>
<name>ServerPath</name>
<type>java.lang.String</type>
</parameter>
</method>
<method>
<name>Close</name>
<comment>Closes the connection after all submitted tasks finish. Note that this method does not block.</comment>
<returntype>void</returntype>
</method>
<method>
<name>DownloadFile</name>
<comment>Downloads a file from the server. The DownloadCompleted event will be raised when download completes.
DownloadProgress events will be raised during download.
ServerFilePath - Full path to the remote file.
AsciiFile - If True then end of line characters will be converted as needed. Note that Android end of line character is the same as Unix / Linux.
DeviceFolder - Folder that the file will be saved to.
DeviceFile - The name of the local file that will be created.</comment>
<returntype>void</returntype>
<parameter>
<name>ba</name>
<type>anywheresoftware.b4a.BA</type>
</parameter>
<parameter>
<name>ServerFilePath</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>AsciiFile</name>
<type>boolean</type>
</parameter>
<parameter>
<name>DeviceFolder</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>DeviceFile</name>
<type>java.lang.String</type>
</parameter>
</method>
<method>
<name>SetCustomSSLTrustManager</name>
<comment></comment>
<returntype>void</returntype>
<parameter>
<name>TrustManager</name>
<type>java.lang.Object</type>
</parameter>
</method>
<method>
<name>UploadFile</name>
<comment>Uploads a file to the server. The UploadCompleted event will be raised when upload completes.
UploadProgress events will be raised during the upload.
DeviceFolder - Local folder.
DeviceFile - Local file name.
AsciiFile - If True then end of line characters will be converted as needed. Note that Android end of line character is the same as Unix / Linux.
ServerFilePath - Full path to file that will be created on the server.</comment>
<returntype>void</returntype>
<parameter>
<name>ba</name>
<type>anywheresoftware.b4a.BA</type>
</parameter>
<parameter>
<name>DeviceFolder</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>DeviceFile</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>AsciiFile</name>
<type>boolean</type>
</parameter>
<parameter>
<name>ServerFilePath</name>
<type>java.lang.String</type>
</parameter>
</method>
<method>
<name>SendCommand</name>
<comment>Sends an FTP command. The CommandCompleted event will be raised with the server reply.
Should only be used with commands that return the reply in the command channel (not the data channel).
It is possible that Success will be false and LastException will not be initialized.
Common commands:
MKD - Creates a new folder.
RMD - Deletes an empty folder.
Example:&lt;code&gt;
FTP.SendCommand("MKD", "/somefolder/newfolder")&lt;/code&gt;</comment>
<returntype>void</returntype>
<parameter>
<name>ba</name>
<type>anywheresoftware.b4a.BA</type>
</parameter>
<parameter>
<name>Command</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>Parameters</name>
<type>java.lang.String</type>
</parameter>
</method>
<method>
<name>CloseNow</name>
<comment>Closes the connection immediately without waiting for current tasks to finish.
The data connection will only be closed when UploadProgress or DownloadProgress events fire.</comment>
<returntype>void</returntype>
</method>
<method>
<name>List</name>
<comment>Fetches the list of folders and files in the specified path.
The ListCompleted event will be raised when the data is available.</comment>
<returntype>void</returntype>
<parameter>
<name>ba</name>
<type>anywheresoftware.b4a.BA</type>
</parameter>
<parameter>
<name>ServerPath</name>
<type>java.lang.String</type>
</parameter>
</method>
<method>
<name>IsInitialized</name>
<comment>Tests whether the object was initialized.</comment>
<returntype>boolean</returntype>
</method>
<property>
<name>UseSSL</name>
<returntype>boolean</returntype>
<parameter>
<name>b</name>
<type>boolean</type>
</parameter>
<comment>Gets or sets whether the connection should be done with SSL sockets (FTPS Implicit).</comment>
</property>
<property>
<name>PassiveMode</name>
<returntype>boolean</returntype>
<parameter>
<name>b</name>
<type>boolean</type>
</parameter>
<comment>Gets or sets whether FTP is in passive mode. The default mode is active mode.</comment>
</property>
<property>
<name>UseSSLExplicit</name>
<returntype>boolean</returntype>
<parameter>
<name>b</name>
<type>boolean</type>
</parameter>
<comment>Gets or sets whether the connection should be done with SSL sockets (FTPS Explicit).</comment>
</property>
</class>
<class>
<name>anywheresoftware.b4a.net.FTPWrapper.FTPFileWrapper</name>
<shortname>FTPEntry</shortname>
<comment>FTPEntry represents a file or a folder. Call FTP.List to get the files and folders.</comment>
<objectwrapper>org.apache.commons.net.ftp.FTPFile</objectwrapper>
<owner>process</owner>
<method>
<name>IsInitialized</name>
<comment></comment>
<returntype>boolean</returntype>
</method>
<property>
<name>Name</name>
<returntype>java.lang.String</returntype>
<comment></comment>
</property>
<property>
<name>Timestamp</name>
<returntype>long</returntype>
<comment></comment>
</property>
<property>
<name>Size</name>
<returntype>long</returntype>
<comment></comment>
</property>
</class>
<class>
<name>anywheresoftware.b4a.net.FTPWrapper.CustomTrustManager</name>
<shortname>CustomTrustManager</shortname>
<comment>CustomTrustManager allows you to create a SSL trust manager from a cert file or to create a trust manager that accepts all certificates.</comment>
<objectwrapper>javax.net.ssl.TrustManager[]</objectwrapper>
<owner>process</owner>
<method>
<name>Initialize</name>
<comment>Initializes the trust manager based on the given cert file.</comment>
<returntype>void</returntype>
<parameter>
<name>Dir</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>FileName</name>
<type>java.lang.String</type>
</parameter>
</method>
<method>
<name>InitializeAcceptAll</name>
<comment>Initializes an "accept all" trust manager. This option should only be used in safe networks as it offers no real protection.</comment>
<returntype>void</returntype>
</method>
<method>
<name>IsInitialized</name>
<comment></comment>
<returntype>boolean</returntype>
</method>
</class>
<version>1.53</version>
<comment>The Net library implements the following protocols: FTP, SMTP and POP3. Both regular connections and secured connections are supported.
The implementations are based on &lt;link&gt;Apache Commons Net|http://commons.apache.org/net/&lt;/link&gt;.
All the methods in this library are non-blocking.
This library replaces the FTP library.</comment>
</root>