src/main/ChatController.js
/**
 * Looks if a username exists and adds it to the list if that's the case.
 */
Looks if a username exists and adds it to the list if that's the case.
Looks if a username exists and adds it to the list if that ' s the case .
async function lookForUsername(name, provider) {
    var contact = "https://" + name + "." + provider + "/profile/card#me";
    var permission;
    try {
        permission = await baseService.readPermission(contact);
    } catch (err) {
        permission = false;
    }
    if (permission) {
        let name = await baseService.getFormattedName(contact);
        var friendPhoto = await baseService.getPhoto(contact);
        if (!friendPhoto) {
            friendPhoto = baseService.getDefaultFriendPhoto();
        }
        var html = "<div style='cursor: pointer;' class='contact' id='openchatwindow" + contact + "'><img src='" + friendPhoto + "' alt='!' onerror='this.onerror=null;this.src='http://www.philosophica.info/voces/aquino/Aquino.jpg';'><div class='contact-preview'><div class='contact-text'><h1 class='font-name'>" + name + "</h1><p class='font-preview' id='ctmsg" + contact.split("/")[2].split(".")[0] + "'></p></div></div><div class='contact-time'><p>" + "</p></div></div>";
        $(".contact-list").prepend(html);
        document.getElementById("openchatwindow" + contact).addEventListener("click", contactsToOpen ? openContact : markContactForGroup, false);
    } else {
        alert("No user found with web id " + contact);
    }
}
async function lookForUsername ( name , provider ) { var contact = "https://" + name + "." + provider + "/profile/card#me" ; var permission ; try { permission = await baseService . readPermission ( contact ) ; } catch ( err ) { permission = false ; } if ( permission ) { let name = await baseService . getFormattedName ( contact ) ; var friendPhoto = await baseService . getPhoto ( contact ) ; if ( ! friendPhoto ) { friendPhoto = baseService . getDefaultFriendPhoto ( ) ; } var html = "<div style='cursor: pointer;' class='contact' id='openchatwindow" + contact + "'><img src='" + friendPhoto + "' alt='!' onerror='this.onerror=null;this.src='http://www.philosophica.info/voces/aquino/Aquino.jpg';'><div class='contact-preview'><div class='contact-text'><h1 class='font-name'>" + name + "</h1><p class='font-preview' id='ctmsg" + contact . split ( "/" ) [ 2 ] . split ( "." ) [ 0 ] + "'></p></div></div><div class='contact-time'><p>" + "</p></div></div>" ; $ ( ".contact-list" ) . prepend ( html ) ; document . getElementById ( "openchatwindow" + contact ) . addEventListener ( "click" , contactsToOpen ? openContact : markContactForGroup , false ) ; } else { alert ( "No user found with web id " + contact ) ; } }
Looks if a username exists and adds it to the list if that's the case.
Looks if a username exists and adds it to the list if that ' s the case .