Mercurial > pidgin
comparison src/protocols/msn/msn.c @ 2665:b0478af51be0
[gaim-migrate @ 2678]
hi
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 02 Nov 2001 20:55:55 +0000 |
parents | d324478ee203 |
children | 37d80035e77f |
comparison
equal
deleted
inserted
replaced
2664:0b4ef57035af | 2665:b0478af51be0 |
---|---|
1577 | 1577 |
1578 static void msn_set_permit_deny(struct gaim_connection *gc) | 1578 static void msn_set_permit_deny(struct gaim_connection *gc) |
1579 { | 1579 { |
1580 struct msn_data *md = gc->proto_data; | 1580 struct msn_data *md = gc->proto_data; |
1581 char buf[MSN_BUF_LEN]; | 1581 char buf[MSN_BUF_LEN]; |
1582 GSList *s; | 1582 GSList *s, *t = NULL; |
1583 | 1583 |
1584 if (gc->permdeny == PERMIT_ALL || gc->permdeny == DENY_SOME) | 1584 if (gc->permdeny == PERMIT_ALL || gc->permdeny == DENY_SOME) |
1585 g_snprintf(buf, sizeof(buf), "BLP %d AL\r\n", ++md->trId); | 1585 g_snprintf(buf, sizeof(buf), "BLP %d AL\r\n", ++md->trId); |
1586 else | 1586 else |
1587 g_snprintf(buf, sizeof(buf), "BLP %d BL\r\n", ++md->trId); | 1587 g_snprintf(buf, sizeof(buf), "BLP %d BL\r\n", ++md->trId); |
1607 return; | 1607 return; |
1608 | 1608 |
1609 s = g_slist_nth(gc->permit, g_slist_length(md->permit)); | 1609 s = g_slist_nth(gc->permit, g_slist_length(md->permit)); |
1610 while (s) { | 1610 while (s) { |
1611 char *who = s->data; | 1611 char *who = s->data; |
1612 s = s->next; | |
1613 if (!strchr(who, '@')) { | |
1614 t = g_slist_append(t, who); | |
1615 continue; | |
1616 } | |
1612 g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, who, who); | 1617 g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, who, who); |
1613 if (msn_write(md->fd, buf, strlen(buf)) < 0) { | 1618 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
1614 hide_login_progress(gc, "Write error"); | 1619 hide_login_progress(gc, "Write error"); |
1615 signoff(gc); | 1620 signoff(gc); |
1616 return; | 1621 return; |
1617 } | 1622 } |
1618 s = s->next; | 1623 } |
1619 } | 1624 while (t) { |
1625 char *who = t->data; | |
1626 gc->permit = g_slist_remove(gc->permit, who); | |
1627 g_free(who); | |
1628 t = t->next; | |
1629 } | |
1630 if (t) | |
1631 g_slist_free(t); | |
1632 t = NULL; | |
1620 g_slist_free(md->permit); | 1633 g_slist_free(md->permit); |
1621 md->permit = NULL; | 1634 md->permit = NULL; |
1622 | 1635 |
1623 s = g_slist_nth(gc->deny, g_slist_length(md->deny)); | 1636 s = g_slist_nth(gc->deny, g_slist_length(md->deny)); |
1624 while (s) { | 1637 while (s) { |
1625 char *who = s->data; | 1638 char *who = s->data; |
1639 s = s->next; | |
1640 if (!strchr(who, '@')) { | |
1641 t = g_slist_append(t, who); | |
1642 continue; | |
1643 } | |
1626 g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, who, who); | 1644 g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, who, who); |
1627 if (msn_write(md->fd, buf, strlen(buf)) < 0) { | 1645 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
1628 hide_login_progress(gc, "Write error"); | 1646 hide_login_progress(gc, "Write error"); |
1629 signoff(gc); | 1647 signoff(gc); |
1630 return; | 1648 return; |
1631 } | 1649 } |
1632 s = s->next; | 1650 } |
1633 } | 1651 while (t) { |
1652 char *who = t->data; | |
1653 gc->deny = g_slist_remove(gc->deny, who); | |
1654 g_free(who); | |
1655 t = t->next; | |
1656 } | |
1657 if (t) | |
1658 g_slist_free(t); | |
1634 g_slist_free(md->deny); | 1659 g_slist_free(md->deny); |
1635 md->deny = NULL; | 1660 md->deny = NULL; |
1636 } | 1661 } |
1637 | 1662 |
1638 static void msn_add_permit(struct gaim_connection *gc, char *who) | 1663 static void msn_add_permit(struct gaim_connection *gc, char *who) |
1639 { | 1664 { |
1640 struct msn_data *md = gc->proto_data; | 1665 struct msn_data *md = gc->proto_data; |
1641 char buf[MSN_BUF_LEN]; | 1666 char buf[MSN_BUF_LEN]; |
1667 | |
1668 if (!strchr(who, '@')) { | |
1669 do_error_dialog(_("Invalid name"), _("MSN Error")); | |
1670 gc->permit = g_slist_remove(gc->permit, who); | |
1671 g_free(who); | |
1672 return; | |
1673 } | |
1642 | 1674 |
1643 g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, who, who); | 1675 g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, who, who); |
1644 if (msn_write(md->fd, buf, strlen(buf)) < 0) { | 1676 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
1645 hide_login_progress(gc, "Write error"); | 1677 hide_login_progress(gc, "Write error"); |
1646 signoff(gc); | 1678 signoff(gc); |
1663 | 1695 |
1664 static void msn_add_deny(struct gaim_connection *gc, char *who) | 1696 static void msn_add_deny(struct gaim_connection *gc, char *who) |
1665 { | 1697 { |
1666 struct msn_data *md = gc->proto_data; | 1698 struct msn_data *md = gc->proto_data; |
1667 char buf[MSN_BUF_LEN]; | 1699 char buf[MSN_BUF_LEN]; |
1700 | |
1701 if (!strchr(who, '@')) { | |
1702 do_error_dialog(_("Invalid name"), _("MSN Error")); | |
1703 gc->deny = g_slist_remove(gc->deny, who); | |
1704 g_free(who); | |
1705 return; | |
1706 } | |
1668 | 1707 |
1669 g_snprintf(buf, sizeof(buf), "ADD %d BL %s %s\r\n", ++md->trId, who, who); | 1708 g_snprintf(buf, sizeof(buf), "ADD %d BL %s %s\r\n", ++md->trId, who, who); |
1670 if (msn_write(md->fd, buf, strlen(buf)) < 0) { | 1709 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
1671 hide_login_progress(gc, "Write error"); | 1710 hide_login_progress(gc, "Write error"); |
1672 signoff(gc); | 1711 signoff(gc); |