Fix spelling of "update handler".

GitOrigin-RevId: 2137852d967606e909e82396b4103817b1b39386
This commit is contained in:
levlam 2020-10-05 20:13:15 +03:00
parent c72d18bcd3
commit 5f605d2dd2
4 changed files with 28 additions and 28 deletions

View File

@ -33,7 +33,7 @@ namespace TdExample
private static Td.Client CreateTdClient()
{
Td.Client result = Td.Client.Create(new UpdatesHandler());
Td.Client result = Td.Client.Create(new UpdateHandler());
new Thread(() =>
{
Thread.CurrentThread.IsBackground = true;
@ -250,7 +250,7 @@ namespace TdExample
}
}
private class UpdatesHandler : Td.ClientResultHandler
private class UpdateHandler : Td.ClientResultHandler
{
void Td.ClientResultHandler.OnResult(TdApi.BaseObject @object)
{

View File

@ -106,27 +106,27 @@ public final class Client implements Runnable {
/**
* Replaces handler for incoming updates from the TDLib.
*
* @param updatesHandler Handler with onResult method which will be called for every incoming
* @param updateHandler Handler with onResult method which will be called for every incoming
* update from the TDLib.
* @param exceptionHandler Exception handler with onException method which will be called on
* exception thrown from updatesHandler, if it is null, defaultExceptionHandler will be invoked.
* exception thrown from updateHandler, if it is null, defaultExceptionHandler will be invoked.
*/
public void setUpdatesHandler(ResultHandler updatesHandler, ExceptionHandler exceptionHandler) {
updateHandlers.put(nativeClientId, new Handler(updatesHandler, exceptionHandler));
public void setUpdateHandler(ResultHandler updateHandler, ExceptionHandler exceptionHandler) {
updateHandlers.put(nativeClientId, new Handler(updateHandler, exceptionHandler));
}
/**
* Replaces handler for incoming updates from the TDLib. Sets empty ExceptionHandler.
*
* @param updatesHandler Handler with onResult method which will be called for every incoming
* update from the TDLib.
* @param updateHandler Handler with onResult method which will be called for every incoming
* update from the TDLib.
*/
public void setUpdatesHandler(ResultHandler updatesHandler) {
setUpdatesHandler(updatesHandler, null);
public void setUpdateHandler(ResultHandler updateHandler) {
setUpdateHandler(updateHandler, null);
}
/**
* Replaces default exception handler to be invoked on exceptions thrown from updatesHandler and all other ResultHandler.
* Replaces default exception handler to be invoked on exceptions thrown from updateHandler and all other ResultHandler.
*
* @param defaultExceptionHandler Default exception handler. If null Exceptions are ignored.
*/
@ -147,13 +147,13 @@ public final class Client implements Runnable {
/**
* Creates new Client.
*
* @param updatesHandler Handler for incoming updates.
* @param updatesExceptionHandler Handler for exceptions thrown from updatesHandler. If it is null, exceptions will be iggnored.
* @param updateHandler Handler for incoming updates.
* @param updateExceptionHandler Handler for exceptions thrown from updateHandler. If it is null, exceptions will be iggnored.
* @param defaultExceptionHandler Default handler for exceptions thrown from all ResultHandler. If it is null, exceptions will be iggnored.
* @return created Client
*/
public static Client create(ResultHandler updatesHandler, ExceptionHandler updatesExceptionHandler, ExceptionHandler defaultExceptionHandler) {
Client client = new Client(updatesHandler, updatesExceptionHandler, defaultExceptionHandler);
public static Client create(ResultHandler updateHandler, ExceptionHandler updateExceptionHandler, ExceptionHandler defaultExceptionHandler) {
Client client = new Client(updateHandler, updateExceptionHandler, defaultExceptionHandler);
new Thread(client, "TDLib thread").start();
return client;
}
@ -213,9 +213,9 @@ public final class Client implements Runnable {
}
}
private Client(ResultHandler updatesHandler, ExceptionHandler updateExceptionHandler, ExceptionHandler defaultExceptionHandler) {
private Client(ResultHandler updateHandler, ExceptionHandler updateExceptionHandler, ExceptionHandler defaultExceptionHandler) {
nativeClientId = createNativeClient();
updateHandlers.put(nativeClientId, new Handler(updatesHandler, updateExceptionHandler));
updateHandlers.put(nativeClientId, new Handler(updateHandler, updateExceptionHandler));
this.defaultExceptionHandler = defaultExceptionHandler;
}

View File

@ -161,7 +161,7 @@ public final class Example {
case TdApi.AuthorizationStateClosed.CONSTRUCTOR:
print("Closed");
if (!quiting) {
client = Client.create(new UpdatesHandler(), null, null); // recreate client after previous has closed
client = Client.create(new UpdateHandler(), null, null); // recreate client after previous has closed
}
break;
default:
@ -310,7 +310,7 @@ public final class Example {
}
// create client
client = Client.create(new UpdatesHandler(), null, null);
client = Client.create(new UpdateHandler(), null, null);
// test Client.execute
defaultHandler.onResult(Client.execute(new TdApi.GetTextEntities("@telegram /test_command https://telegram.org telegram.me @gif @test")));
@ -367,7 +367,7 @@ public final class Example {
}
}
private static class UpdatesHandler implements Client.ResultHandler {
private static class UpdateHandler implements Client.ResultHandler {
@Override
public void onResult(TdApi.Object object) {
switch (object.getConstructor()) {

View File

@ -79,9 +79,9 @@ public:
/// <summary>
/// Replaces handler for incoming updates from the TDLib.
/// </summary>
/// <param name="updatesHandler">Handler with OnResult method which will be called for every incoming update from the TDLib.</param>
void SetUpdatesHandler(ClientResultHandler^ updatesHandler) {
handlers[0] = updatesHandler;
/// <param name="updateHandler">Handler with OnResult method which will be called for every incoming update from the TDLib.</param>
void SetUpdateHandler(ClientResultHandler^ updateHandler) {
handlers[0] = updateHandler;
}
/// <summary>
@ -107,16 +107,16 @@ public:
/// <summary>
/// Creates new Client.
/// </summary>
/// <param name="updatesHandler">Handler for incoming updates.</param>
/// <param name="updateHandler">Handler for incoming updates.</param>
/// <returns>Returns created Client.</returns>
static Client^ Create(ClientResultHandler^ updatesHandler) {
return REF_NEW Client(updatesHandler);
static Client^ Create(ClientResultHandler^ updateHandler) {
return REF_NEW Client(updateHandler);
}
private:
Client(ClientResultHandler^ updatesHandler) {
Client(ClientResultHandler^ updateHandler) {
client = new td::Client();
handlers[0] = updatesHandler;
handlers[0] = updateHandler;
}
~Client() {