本文整理汇总了C++中contact函数的典型用法代码示例。如果您正苦于以下问题:C++ contact函数的具体用法?C++ contact怎么用?C++ contact使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了contact函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: contact
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();
}
示例2: contact
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);
}
示例3: ICQ_Send_URL
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);
}
}
示例4: ICQ_Send_Message
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);
}
}
}
示例5: contact
bool StandardContactList::contactExists(int id) const
{
ContactPtr c = contact(id);
if(c)
return true;
return false;
}
示例6: ICQ_Get_Away_Message
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);
}
}
示例7: str
/**
* 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();
}
}
示例8: remote_page_request
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;
}
示例9: mb_client_query_total
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;
}
示例10: contact
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);
}
示例11: contact
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();
}
}
示例12: EndContact
// 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);
}
示例13: 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();
}
示例14: doCapsuleSphereTest
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()));
}
}
示例15: main
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;
};
};