How to do a basic remote procedure call (RPC) in Telegram? -


i'm attempting create small program can demonstrate features of telegram api. wish able register , authenticate users via sms. according user authorization guide, need invoke auth.sendcode rpc. however, codebase inadequately documented , proving hard into.

how send auth.sendcode remote procedure call in telegram? please provide code snippet shows starting set , initialization.

try this...

tlsentcode sentcode;     try {         sentcode = api.dorpccallnonauth(new tlrequestauthsendcode(phone, 0, 5, "your app id", "en"));     } catch (rpcexception e) {         if (e.geterrorcode() == 303) {             int destdc;             if (e.geterrortag().startswith("network_migrate_")) {                 destdc = integer.parseint(e.geterrortag().substring("network_migrate_".length()));             } else if (e.geterrortag().startswith("phone_migrate_")) {                 destdc = integer.parseint(e.geterrortag().substring("phone_migrate_".length()));             } else if (e.geterrortag().startswith("user_migrate_")) {                 destdc = integer.parseint(e.geterrortag().substring("user_migrate_".length()));             } else {                 throw e;             }             api.switchtodc(destdc);             sentcode = api.dorpccallnonauth(new tlrequestauthsendcode(phone, 0, 5, "youa app id", "en"));         } else {             throw e;         }     } 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -