void CreateContactInstanceTask::onFolderCreated() { // now the folder exists, perform the requested type of contact instance creation if ( m_userId.isEmpty() ) contact( new Field::SingleField( Field::NM_A_SZ_DN, 0, NMFIELD_TYPE_UTF8, m_dn ), m_displayName, m_folderId ); else contact( new Field::SingleField( Field::NM_A_SZ_USERID, 0, NMFIELD_TYPE_UTF8, m_userId ), m_displayName, m_folderId ); // send the transfer immediately RequestTask::onGo(); }
void contact(struct bnode *root) { if (nullptr == root) return; if(root->left != nullptr) root->left->next = root->right; if (root->right != nullptr) { if (nullptr != root->next) root->right->next = root->next->left; else root->right->next = nullptr; } contact(root->left); contact(root->right); }
void ICQ_Send_URL(guint32 uin, gchar *url, gchar *text) { Contact_Member *c; MESSAGE_DATA_PTR msg; ICQ_Debug(ICQ_VERB_INFO, "LIBICQ> ICQ_Send_URL"); if (!(c = contact(uin))) return; if (c->tcp_status & TCP_CONNECTED) { if (!TCP_SendURL(uin, url, text)) Send_URL(uin, url, text); } else if (c->tcp_status & TCP_FAILED || c->status == STATUS_OFFLINE) { Send_URL(uin, url, text); } else { msg = g_malloc(sizeof(MESSAGE_DATA)); msg->type = URL_MESS; msg->text = g_strdup(text); msg->url = g_strdup(url); c->messages = g_list_append(c->messages, (gpointer) msg); c->tcp_sok = TCP_Connect(c->current_ip, c->tcp_port); } }
void ICQ_Send_Message(guint32 uin, gchar *text) { Contact_Member *c; MESSAGE_DATA_PTR msg; ICQ_Debug(ICQ_VERB_INFO, "LIBICQ> ICQ_Send_Message"); if (!(c = contact(uin))) return; if (c->tcp_status & TCP_CONNECTED) { if (!TCP_SendMessage(uin, text)) Send_Message(uin, text); /* fall back on UDP send */ } else if (c->tcp_status & TCP_FAILED || c->status == STATUS_OFFLINE) { Send_Message(uin, text); } else { msg = g_malloc(sizeof(MESSAGE_DATA)); msg->type = MSG_MESS; msg->text = g_strdup(text); msg->url = NULL; c->messages = g_list_append(c->messages, (gpointer) msg); c->tcp_sok = TCP_Connect(c->current_ip, c->tcp_port); if (c->tcp_sok == -1) { c->tcp_status |= TCP_FAILED; Send_Message(uin, text); } } }
bool StandardContactList::contactExists(int id) const { ContactPtr c = contact(id); if(c) return true; return false; }
void ICQ_Get_Away_Message(guint32 uin) { Contact_Member *c; MESSAGE_DATA_PTR msg; /*** MIZHI 04162001 */ gchar errmsg[255]; sprintf(errmsg, "LIBICQ> ICQ_Get_Away_Message(%d)", uin); ICQ_Debug(ICQ_VERB_INFO, errmsg); /*** */ if (!(c = contact(uin))) return; if (c->tcp_status & TCP_CONNECTED) { TCP_GetAwayMessage(uin); } else if (c->tcp_status & TCP_FAILED) { printf("ICQ_Get_Away_Message(): Connection timed out\n"); } else { msg = g_malloc(sizeof(MESSAGE_DATA)); msg->type = AWAY_MESS; msg->text = NULL; msg->url = NULL; c->messages = g_list_append(c->messages, (gpointer) msg); c->tcp_sok = TCP_Connect(c->current_ip, c->tcp_port); } }
/** * Called when user presses a button to add a contact. * Prompts user with an input dialog to name his new contact. * @brief MainWindow::on_pushButton_clicked */ void MainWindow::on_pushButton_clicked() { QString str(ui->addContact->text()); QRegularExpression re("^\\d+\\.\\d+\\.\\d+\\.\\d+$"); QRegularExpressionMatch match = re.match(str); if(match.hasMatch()) { bool ok; QString text = QInputDialog::getText(this, "Name the contact", "Name:", QLineEdit::Normal, str, &ok); if (!ok) return; QString contact(str + "/" + str); if(!text.isEmpty()) contact = text + "/" + str; ui->lstContacts->addItem(contact); controller->addExternalContact(contact); } else { QMessageBox msgBox; msgBox.setText("Invalid ip"); msgBox.setInformativeText("Please provide a valid IPv4 adress"); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok); msgBox.exec(); } }
static int remote_page_request(mbclient* client, MbCodes type, int pages) { int fd; int ret, param=0; if (client->is_bidi) return MB_BAD_CLIENT_TYPE; if (pages < 0) return MB_BAD_PARAM; if (pages > 0) { fd = contact(client); if (fd == -1) return MB_IO; if ((ret = mb_encode_and_send (client->id, fd, type, pages)) < 0) return ret; ret = mb_receive_response_and_decode (fd, client->id, SHARE, ¶m); if (ret <= 0 ) return ret; client->pages += param; } return param; }
int mb_client_query_total(MbClientHandle client) { int ret, param; int fd; if (((mbclient*)client)->is_bidi) return MB_BAD_CLIENT_TYPE; fd = contact ((mbclient*)client); if (fd == -1) return MB_IO; if ((ret = mb_encode_and_send (((mbclient*)client)->id, fd, TOTAL, 0)) < 0) return ret; ret = mb_receive_response_and_decode (fd, ((mbclient*)client)->id, TOTAL, ¶m); if (ret < 0) param = ret; return param; }
void ContactModel::updateContactPresence(QString jid) { Contact contact(qobject_cast<MAGNORMOBOT*>(sender()), jid); QList<QModelIndex> indexes = getIndexesOfContact(contact); foreach (QModelIndex index, indexes) { emit dataChanged(index, index); }
QVariant BuddyContactModel::data(const QModelIndex &index, int role) const { Contact data = contact(index); if (data.isNull()) return QVariant(); switch (role) { case Qt::DisplayRole: if (IncludeIdentityInDisplay) return QString("%1 (%2)").arg(data.id()).arg(data.contactAccount().accountIdentity().name()); else return data.id(); case Qt::DecorationRole: return data.contactAccount().protocolHandler() ? data.contactAccount().protocolHandler()->icon().icon() : QIcon(); case ContactRole: return QVariant::fromValue<Contact>(data); default: return QVariant(); } }
// Add the contact to m_endParticlContacts. virtual void EndContact(b2ParticleSystem* particleSystem, int32 indexA, int32 indexB) { EXPECT_EQ(particleSystem, m_system); ParticleContact contact(indexA, indexB); m_endParticleContacts.push_back(contact); }
// Add the contact to m_endFixtureContacts. virtual void EndContact(b2Fixture* fixture, b2ParticleSystem* particleSystem, int32 index) { EXPECT_EQ(particleSystem, m_system); FixtureParticleContact contact(fixture, index); m_endFixtureContacts.push_back(contact); }
bool MySqlStorage::updateSubscriptionToContact(QString jid, QString contactJid, QString subscription) { if (!contactExists(jid, contactJid)) { Contact contact("", false, "", contactJid, "", subscription, QSet<QString>()); return addContactToRoster(jid, contact); } QString contactSubscription = getContact(jid, contactJid).getSubscription(); QSqlQuery query; query.prepare("UPDATE qjabberd_contact SET subscription = :subscription WHERE user_id = :user_id AND jid = :jid"); query.bindValue(":user_id", getUserId(jid)); query.bindValue(":jid", contactJid); if (((subscription == "from") && (contactSubscription == "to")) || ((subscription == "to") && (contactSubscription == "from"))) { query.bindValue(":subscription", "both"); } else { query.bindValue(":subscription", subscription); } return query.exec(); }
void doCapsuleSphereTest(double capsuleHeight, double capsuleRadius, const Vector3d& capsulePosition, const Quaterniond& capsuleQuat, double sphereRadius, const Vector3d& spherePosition, const Quaterniond& sphereQuat, bool hasContacts, double depth, const Vector3d& sphereProjection = Vector3d::Zero(), const Vector3d& expectedNorm = Vector3d::Zero()) { std::shared_ptr<CollisionPair> pair = std::make_shared<CollisionPair>( makeCapsuleRepresentation(capsuleHeight, capsuleRadius, capsuleQuat, capsulePosition), makeSphereRepresentation(sphereRadius, sphereQuat, spherePosition)); CapsuleSphereDcdContact calc; calc.calculateContact(pair); EXPECT_EQ(hasContacts, pair->hasContacts()); if (pair->hasContacts()) { std::shared_ptr<Contact> contact(pair->getContacts().front()); EXPECT_TRUE(eigenEqual(expectedNorm, contact->normal)); EXPECT_NEAR(depth, contact->depth, SurgSim::Math::Geometry::DistanceEpsilon); EXPECT_TRUE(contact->penetrationPoints.first.rigidLocalPosition.hasValue()); EXPECT_TRUE(contact->penetrationPoints.second.rigidLocalPosition.hasValue()); Vector3d capsuleLocalNormal = capsuleQuat.inverse() * expectedNorm; Vector3d penetrationPoint0(sphereProjection - capsuleLocalNormal * capsuleRadius); Vector3d sphereLocalNormal = sphereQuat.inverse() * expectedNorm; Vector3d penetrationPoint1(sphereLocalNormal * sphereRadius); EXPECT_TRUE(eigenEqual(penetrationPoint0, contact->penetrationPoints.first.rigidLocalPosition.getValue())); EXPECT_TRUE(eigenEqual(penetrationPoint1, contact->penetrationPoints.second.rigidLocalPosition.getValue())); } }
int main(int argc, char *argv[]) { if (argc < 3) { printf("Usage is\n\t%s {path to People file} {protocol} {path to image}\n", argv[0]); printf("Note: Protocol can be \"general\" to give a fall back icon\n"); return -1; }; BApplication app("application/x-vnd.BeClan.IMKit.IconSetter"); entry_ref ref; if (get_ref_for_path(argv[1], &ref) == B_OK) { IM::Contact contact(&ref); BBitmap *originalIcon = BTranslationUtils::GetBitmap(argv[3]); if ( !originalIcon ) { printf("Couldn't load image\n"); return -1; } status_t ret = contact.SetBuddyIcon(argv[2], originalIcon); if (ret >= B_OK) { return 0; } else { printf("Error setting icon: %s (%ld)\n", strerror(ret), ret); }; } else { printf("Couldn't find the People file you specified\n"); return -1; }; };
void on_button_ok_clicked (GtkWidget* button,gpointer data) { gint type; GtkWidget *subwindow; const gchar *username = gtk_entry_get_text(GTK_ENTRY(entry1)); strcpy(usrName, username); const gchar *password = gtk_entry_get_text(GTK_ENTRY(entry2)); type = selectpsd((char *)username, (char *)password); if(type == 0) { subwindow = contact(username); gtk_widget_show_all(subwindow); verify(username, password); gtk_widget_show(subwindow); //gtk_widget_destroy(data); gtk_widget_hide_all(data); } else { informationdialog(type); } gtk_entry_set_text(GTK_ENTRY(entry1), ""); gtk_entry_set_text(GTK_ENTRY(entry2), ""); }
void GaduFileTransfer::send() { if (FileTransfer::TypeSend != transferType()) // maybe assert here? return; if (SocketNotifiers || WaitingForSocketNotifiers) // already sending/receiving return; setRemoteFile(QString::null); if (!account() || localFileName().isEmpty()) { changeFileTransferStatus(FileTransfer::StatusNotConnected); return; // TODO: notify } GaduProtocol *gaduProtocol = dynamic_cast<GaduProtocol *>(account()->protocol()); if (!gaduProtocol) { changeFileTransferStatus(FileTransfer::StatusNotConnected); return; } GaduContactAccountData *gcad = gaduProtocol->gaduContactAccountData(contact()); if (!gcad) { changeFileTransferStatus(FileTransfer::StatusNotConnected); return; } // async call, will return in setFileTransferNotifiers changeFileTransferStatus(FileTransfer::StatusWaitingForConnection); WaitingForSocketNotifiers = true; gaduProtocol->dccManager()->attachSendFileTransferSocket(this); }
bool StandardContactList::addContact(const ContactPtr& newContact) { ContactPtr c = contact(newContact->id()); if(c) return false; m_contacts.insert(newContact->id(), newContact); return true; }
// Add the contact to the list of particle / particle contacts. virtual bool ShouldCollide(b2ParticleSystem* particleSystem, int32 particleIndexA, int32 particleIndexB) { EXPECT_EQ(particleSystem, m_system); ParticleContact contact(particleIndexA, particleIndexB); m_particleContacts.push_back(contact); return true; }
int ContactsModelBase::rowCount(const QModelIndex &parentIndex) const { if (!parentIndex.isValid() || parent(parentIndex).isValid()) return 0; Contact con = contact(parentIndex); return con.accountDatas().size(); }
/*! \reimp */ QList<QContact> QContactWinCEEngine::contacts(const QContactFilter& filter, const QList<QContactSortOrder>& sortOrders, const QContactFetchHint& fetchHint, QContactManager::Error* error) const { QList<QContactLocalId> ids = contactIds(filter, sortOrders, error); QList<QContact> cs; if (*error == QContactManager::NoError) { foreach (const QContactLocalId& id, ids) { cs << contact(id, fetchHint, error); }
void ICQ_Add_User(guint32 uin, gchar *name) { Contact_Member *c; /*** MIZHI 04162001 */ gchar *errmsg; errmsg = g_new0(gchar, 128 + strlen(name)); sprintf(errmsg, "LIBICQ> ICQ_Add_User(%d, %s)", uin, name); ICQ_Debug(ICQ_VERB_INFO, errmsg); g_free(errmsg); /*** */ c = contact(uin); if (!c) { Contacts[Num_Contacts].uin = uin; Contacts[Num_Contacts].status = STATUS_OFFLINE; Contacts[Num_Contacts].last_time = -1L; Contacts[Num_Contacts].current_ip = -1L; Contacts[Num_Contacts].tcp_sok = -1L; Contacts[Num_Contacts].tcp_port = 0; Contacts[Num_Contacts].tcp_status = TCP_NOT_CONNECTED; Contacts[Num_Contacts].chat_sok = -1L; Contacts[Num_Contacts].chat_port = 0; Contacts[Num_Contacts].chat_status = TCP_NOT_CONNECTED; memcpy(Contacts[Num_Contacts].nick, name, sizeof(Contacts->nick)); Num_Contacts++; } else { if (c->tcp_sok > 0) { open_sockets = g_list_remove(open_sockets, (gpointer) c->tcp_sok); close(c->tcp_sok); } if (c->chat_sok > 0) { open_sockets = g_list_remove(open_sockets, (gpointer) c->chat_sok); close(c->chat_sok); } c->status = STATUS_OFFLINE; c->current_ip = -1L; c->tcp_sok = 0; c->tcp_port = 0; c->tcp_status = TCP_NOT_CONNECTED; c->chat_sok = 0; c->chat_port = 0; c->chat_status = TCP_NOT_CONNECTED; c->chat_active = FALSE; c->chat_active2 = FALSE; } Send_ContactList(); // Write_Contacts_RC(contacts_rc); }
Contact Link::contact() { RecursiveUniqueLock lock(m_mutex); Contact contact(m_peerKey); for (const Address &address : m_addressList) { contact.addAddress(address); } return contact; }
void ChannelContactModel::onContactBlockStatusChanged(bool blocked) { Tp::ContactPtr contact(qobject_cast<Tp::Contact*>(sender())); QModelIndex index = createIndex(m_contacts.lastIndexOf(contact), 0); Q_EMIT dataChanged(index, index); Q_EMIT contactBlockStatusChanged(contact, blocked); }
// Add the contact to the list of particle / fixture contacts. virtual bool ShouldCollide(b2Fixture* fixture, b2ParticleSystem* particleSystem, int32 particleIndex) { EXPECT_EQ(particleSystem, m_system); FixtureParticleContact contact(fixture, particleIndex); m_fixtureParticleContacts.push_back(contact); return true; }
bool TransferQueueManager::GetContactInfo(char const *command_sock_addr, std::string &contact_str) { TransferQueueContactInfo contact( command_sock_addr, m_max_uploads == 0, m_max_downloads == 0); return contact.GetStringRepresentation(contact_str); }
void ChannelContactModel::onContactAliasChanged(const QString &alias) { Tp::ContactPtr contact(qobject_cast<Tp::Contact*>(sender())); QModelIndex index = createIndex(m_contacts.lastIndexOf(contact), 0); Q_EMIT dataChanged(index, index); Q_EMIT contactAliasChanged(contact, alias); }
void ChannelContactModel::onContactPresenceChanged(const Tp::Presence &presence) { Tp::ContactPtr contact(qobject_cast<Tp::Contact*>(sender())); QModelIndex index = createIndex(m_contacts.lastIndexOf(contact), 0); Q_EMIT dataChanged(index, index); Q_EMIT contactPresenceChanged(contact, KTp::Presence(presence)); }
dgFloat32 dgCollisionSphere::RayCast (const dgVector& p0, const dgVector& p1, dgFloat32 maxT, dgContactPoint& contactOut, const dgBody* const body, void* const userData, OnRayPrecastAction preFilter) const { dgFloat32 t = dgRayCastSphere (p0, p1, dgVector (dgFloat32 (0.0f)), m_radius); if (t < maxT) { dgVector contact (p0 + (p1 - p0).Scale3 (t)); contactOut.m_normal = contact.Scale3 (dgRsqrt (contact % contact)); //contactOut.m_userId = SetUserDataID(); } return t; }