Mercurial > pidgin.yaz
comparison plugins/msn/msn.c @ 1308:4741b5a75b9f
[gaim-migrate @ 1318]
The MSN plugin now notifies you of new incoming hotmail messages.
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Tue, 19 Dec 2000 08:37:12 +0000 |
parents | 751937b4f109 |
children | 113a3d16f1ce |
comparison
equal
deleted
inserted
replaced
1307:751937b4f109 | 1308:4741b5a75b9f |
---|---|
408 gchar *message; | 408 gchar *message; |
409 gchar *buf2; | 409 gchar *buf2; |
410 int size; | 410 int size; |
411 int status; | 411 int status; |
412 | 412 |
413 if (strcasecmp("hotmail", resps[1]) == 0) { | |
414 /* We want to ignore these. We can parse them | |
415 * eventually if we ever plan on doing anything | |
416 * with them */ | |
417 g_strfreev(resps); | |
418 return; | |
419 } | |
420 | |
421 /* Determine our message size */ | 413 /* Determine our message size */ |
422 size = atoi(resps[3]); | 414 size = atoi(resps[3]); |
423 | 415 |
424 buf2 = (gchar *) g_malloc(sizeof(gchar) * (size + 1)); | 416 buf2 = (gchar *) g_malloc(sizeof(gchar) * (size + 1)); |
425 status = recv(fd, buf2, size, 0); | 417 status = recv(fd, buf2, size, 0); |
426 buf2[size] = 0; | 418 buf2[size] = 0; |
419 | |
420 if (strcasecmp("hotmail", resps[1]) == 0) { | |
421 | |
422 if (strstr(buf2, "Content-Type: text/x-msmsgsemailnotification")) { | |
423 g_snprintf(buf, sizeof(buf), "%s has new hotmail", gc->username); | |
424 do_error_dialog(buf, "Gaim: MSN New Mail"); | |
425 } | |
426 | |
427 g_strfreev(resps); | |
428 return; | |
429 } | |
427 | 430 |
428 /* Looks like we got the message. If it's blank, let's bail */ | 431 /* Looks like we got the message. If it's blank, let's bail */ |
429 if (strcasecmp(strstr(buf2, "\r\n\r\n") + 4, "\r\n") == 0) { | 432 if (strcasecmp(strstr(buf2, "\r\n\r\n") + 4, "\r\n") == 0) { |
430 g_free(buf2); | 433 g_free(buf2); |
431 g_strfreev(resps); | 434 g_strfreev(resps); |
504 hide_login_progress(gc, "Error connection to server"); | 507 hide_login_progress(gc, "Error connection to server"); |
505 signoff(gc); | 508 signoff(gc); |
506 return; | 509 return; |
507 } | 510 } |
508 | 511 |
512 printf("AAA: %s (%d)\n", strerror(errno), errno); | |
513 | |
509 g_snprintf(buf, sizeof(buf), "Signon: %s", gc->username); | 514 g_snprintf(buf, sizeof(buf), "Signon: %s", gc->username); |
510 set_login_progress(gc, 2, buf); | 515 set_login_progress(gc, 2, buf); |
511 | 516 |
512 while (gtk_events_pending()) | 517 while (gtk_events_pending()) |
513 gtk_main_iteration(); | 518 gtk_main_iteration(); |
514 | 519 |
520 printf("AAA: %s (%d)\n", strerror(errno), errno); | |
515 /* This is where we will attempt to sign on */ | 521 /* This is where we will attempt to sign on */ |
516 g_snprintf(buf, 4096, "VER %d %s\n", trId, mdata->protocol); | 522 g_snprintf(buf, 4096, "VER %d %s\n", trId, mdata->protocol); |
517 write(mdata->fd, buf, strlen(buf)); | 523 write(mdata->fd, buf, strlen(buf)); |
518 | 524 |
525 printf("AAA: %s (%d)\n", strerror(errno), errno); | |
519 msn_read_line(&buf2, mdata->fd); | 526 msn_read_line(&buf2, mdata->fd); |
520 | 527 |
528 printf("AAA: %s (%d)\n", strerror(errno), errno); | |
521 buf[strlen(buf) - 1] = '\0'; | 529 buf[strlen(buf) - 1] = '\0'; |
522 if (strcmp(buf, buf2) != 0) { | 530 if (strcmp(buf, buf2) != 0) { |
523 hide_login_progress(gc, buf2); | 531 hide_login_progress(gc, buf2); |
524 signoff(gc); | 532 signoff(gc); |
525 return; | 533 return; |
526 } | 534 } |
527 | 535 |
528 /* Looks like our versions matched up. Let's find out | 536 /* Looks like our versions matched up. Let's find out |
529 * which policy we should use */ | 537 * which policy we should use */ |
530 | 538 |
539 printf("AAA: %s (%d)\n", strerror(errno), errno); | |
531 g_snprintf(buf, 4096, "INF %d\n", trId); | 540 g_snprintf(buf, 4096, "INF %d\n", trId); |
532 write(mdata->fd, buf, strlen(buf)); | 541 write(mdata->fd, buf, strlen(buf)); |
533 | 542 |
543 printf("AAA: %s (%d)\n", strerror(errno), errno); | |
534 msn_read_line(&buf2, mdata->fd); | 544 msn_read_line(&buf2, mdata->fd); |
535 results = g_strsplit(buf2, " ", 0); | 545 results = g_strsplit(buf2, " ", 0); |
536 mdata->policy = g_strdup(results[2]); | 546 mdata->policy = g_strdup(results[2]); |
537 g_strfreev(results); | 547 g_strfreev(results); |
538 | 548 |
549 printf("AAA: %s (%d)\n", strerror(errno), errno); | |
539 /* We've set our policy. Now, lets attempt a sign on */ | 550 /* We've set our policy. Now, lets attempt a sign on */ |
540 g_snprintf(buf, 4096, "USR %d %s I %s\n", trId, mdata->policy, gc->username); | 551 g_snprintf(buf, 4096, "USR %d %s I %s\n", trId, mdata->policy, gc->username); |
541 write(mdata->fd, buf, strlen(buf)); | 552 write(mdata->fd, buf, strlen(buf)); |
542 | 553 |
554 printf("AAA: %s (%d)\n", strerror(errno), errno); | |
543 msn_read_line(&buf2, mdata->fd); | 555 msn_read_line(&buf2, mdata->fd); |
544 | 556 |
557 printf("AAA: %s (%d)\n", strerror(errno), errno); | |
545 /* This is where things get kinky */ | 558 /* This is where things get kinky */ |
546 results = g_strsplit(buf2, " ", 0); | 559 results = g_strsplit(buf2, " ", 0); |
547 | 560 |
548 /* Are we being transfered to another server ? */ | 561 /* Are we being transfered to another server ? */ |
549 if (strcasecmp(results[0], "XFR") == 0) { | 562 if (strcasecmp(results[0], "XFR") == 0) { |