diff -r 5b448ef8610a -r 73b94979f76b src/protocols/oscar/icq.c
--- a/src/protocols/oscar/icq.c Thu Oct 16 04:35:41 2003 +0000
+++ b/src/protocols/oscar/icq.c Thu Oct 16 06:12:43 2003 +0000
@@ -320,6 +320,99 @@
return 0;
}
+/*
+ * Send an SMS message. This is the non-US way. The US-way is to IM
+ * their cell phone number (+19195551234).
+ *
+ * We basically construct and send an XML message. The format is:
+ *
+ * full_phone_without_leading_+
+ * message
+ * 1252
+ * self_uin
+ * self_name
+ * Yes|No
+ *
+ *
+ *
+ * Yeah hi Peter, whaaaat's happening. If there's any way to use
+ * a codepage other than 1252 that would be great. Thaaaanks.
+ */
+faim_export int aim_icq_sendsms(aim_session_t *sess, const char *name, const char *msg, const char *alias)
+{
+ aim_conn_t *conn;
+ aim_frame_t *fr;
+ aim_snacid_t snacid;
+ int bslen, xmllen;
+ char *xml, timestr[30];
+ time_t t;
+ struct tm *tm;
+
+ if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015)))
+ return -EINVAL;
+
+ if (!name || !msg || !alias)
+ return -EINVAL;
+
+ time(&t);
+ tm = gmtime(&t);
+ strftime(timestr, 30, "%a, %d %b %Y %T %Z", tm);
+
+ /* The length of xml included the null terminating character */
+ xmllen = 500 + strlen(name) + strlen(msg) + strlen(sess->sn) + strlen(alias) + strlen(timestr) + 1;
+
+ if (!(xml = (char *)malloc(xmllen*sizeof(char))))
+ return -ENOMEM;
+ snprintf(xml, xmllen, "\n"
+ "\t%s\n"
+ "\t%s\n"
+ "\t1252\n"
+ "\t%s\n"
+ "\t%s\n"
+ "\tYes\n"
+ "\t\n"
+ "\n",
+ name, msg, sess->sn, alias, timestr);
+
+ bslen = 37 + xmllen;
+
+ if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) {
+ free(xml);
+ return -ENOMEM;
+ }
+
+ snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0);
+ aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid);
+
+ /* For simplicity, don't bother using a tlvlist */
+ aimbs_put16(&fr->data, 0x0001);
+ aimbs_put16(&fr->data, bslen);
+
+ aimbs_putle16(&fr->data, bslen - 2);
+ aimbs_putle32(&fr->data, atoi(sess->sn));
+ aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */
+ aimbs_putle16(&fr->data, snacid); /* eh. */
+
+ /* From libicq200-0.3.2/src/SNAC-SRV.cpp */
+ aimbs_putle16(&fr->data, 0x8214);
+ aimbs_put16(&fr->data, 0x0001);
+ aimbs_put16(&fr->data, 0x0016);
+ aimbs_put32(&fr->data, 0x00000000);
+ aimbs_put32(&fr->data, 0x00000000);
+ aimbs_put32(&fr->data, 0x00000000);
+ aimbs_put32(&fr->data, 0x00000000);
+
+ aimbs_put16(&fr->data, 0x0000);
+ aimbs_put16(&fr->data, xmllen);
+ aimbs_putraw(&fr->data, xml, xmllen);
+
+ aim_tx_enqueue(sess, fr);
+
+ free(xml);
+
+ return 0;
+}
+
static void aim_icq_freeinfo(struct aim_icq_info *info) {
int i;